You can translate the question and the replies:

Using Analytical Functions and REGEXP_LIKE function causes error

Currently running Denodo 8 and using some views connected to a Postgres 12.9 database. I found that when running a query with an analytical function sum() and a REGEXP_LIKE function, causes the following error: Finished with error: Error executing view: Function sum is not executable SELECT ticket_id, owner, title, ticket_updated_date, ticket_submitted_date, SUM(CASE WHEN ticket_update_date >= ticket_submitted_date THEN 1 ELSE 0 END) OVER (PARTITION BY ticket_id ORDER BY ticket_submitted_date DESC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS num_approvals FROM tickets where ticket_subject REGEXP_LIKE('^testcase$') group by 1, 2, 3, 4, 5 order by 5 desc When we comment out the WHERE clause in the previous statement, the query executes successfully and returns results. Why would REGEXP_LIKE cause the analytical function to fail with this error? Is this a bug? When looking at the Execution Trace of the successful query with the REGEXP_LIKE commented out, the entire query is translated properly to Postgres language and pushed to the data source. I do see that REGEXP_LIKE is not supported in Postgres 12 and will be available in the future Postgres 15. A simple query using the REGEXP_LIKE function without an analytical function executes successfully, but is unable to translate to Postgres language and pushed to the source, as expected. The function is then applied at the Denodo layer in the Projection Plan. Both the analytical function and REGEXP_LIKE function seem to work as expected, but not together for some reason.
user
05-10-2022 16:34:22 -0400
code

3 Answers

Hi, Probably your problem is about Denodo Virtual DataPort specification. Both Analytic Function(SUM) and REGEXP_LIKE function seem to work as expected. It is possible that your query fails because of the following reasons: - If the database does not support the operator REGEXP_LIKE, the selection condition will be executed by Denodo Virtual DataPort. (So the query is executed by Denodo Virtual DataPort) - If Analytic Function(SUM) cannot be pushed down to the database, the query will fail. Therefore, it is possible to think in this way that when the data source does not support REGEXP_LIKE, the VDP will not push down the SELECT condition. So the SUM function in the SELECT condition cannot be pushed down when the REGEXP_LIKE function is used together(in your case: postgres), so it fails. You can read the [Workaround to Execute Analytic Functions](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/analytic_functions/analytic_functions#workaround-to-execute-analytic-functions) and [Analytic Functions](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/analytic_functions/analytic_functions#sum) page of the Virtual DataPort VQL Guide for more information. If you are a valid support account, I would recommend opening a new case in the Denodo Support Site so the Denodo team can help you. Hope this helps!
Denodo Team
06-10-2022 06:14:21 -0400
code
In this instance with Postgres 12.9, both the analytic function and REGEXP_LIKE work as expected independently. When testing the analytic function without the REGEXP_LIKE function, the analytic function is pushed to the database successfully and a dataset is returned. When testing the REGEXP_LIKE without the analytic function, the REGEXP_LIKE executes at the Denodo Virtual DataPort as expected since the function is not supported by Postgres and a dataset is returned. So indpendently, they both execute as expected. But why will they not work together in the same statement? Shouldn't the analytic function be pushed to the database and then the REGEXP_LIKE function be applied at the Denodo Virtual Dataport once the data is returned? In this case there is only one data source, so there is no data movement that can be applied.
user
06-10-2022 11:44:33 -0400
Hi, It sounds like your question needs to be addressed by the Denodo team since it requires deeper analysis so I suggest you open a new case in the [Denodo Support Site](https://support.denodo.com/) if you are a valid support account user, so the Denodo team can help you. Hope this helps!
Denodo Team
18-10-2022 04:27:36 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here