trinodb / trino-gateway

https://trinodb.github.io/trino-gateway/
Apache License 2.0
122 stars 47 forks source link

Remove unnecessary CONCAT function #375

Open grahamplata opened 4 weeks ago

grahamplata commented 4 weeks ago

Description

Resolves the following error when using Spanner by Explicitly Cast text values in CONCAT function.

SELECT CONCAT(FLOOR(created / 1000 / 60)::text) AS minute,

Resolved the following error ``` trino-gateway org.jdbi.v3.core.statement.UnableToExecuteStatementException: org.postgresql.util.PSQLException: ERROR: Postgres function concat(double precision) is not supported - Statement: 'SELECT CONCAT(FLOOR(created / 1000 / 60)) AS minute, trino-gateway backend_url AS backend_url, trino-gateway COUNT(1) AS query_count trino-gateway FROM query_history trino-gateway WHERE created > $1 trino-gateway GROUP BY minute, backend_url trino-gateway ' [statement:"SELECT CONCAT(FLOOR(created / 1000 / 60)) AS minute, trino-gateway backend_url AS backend_url, trino-gateway COUNT(1) AS query_count trino-gateway FROM query_history trino-gateway WHERE created > :created trino-gateway GROUP BY minute, backend_url trino-gateway ", arguments:{positional:{0:1717180785232}, named:{created:1717180785232}, finder:[]}] ```

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required. ( ) Release notes are required. Please propose a release note for me. ( ) Release notes are required, with the following suggested text:

* 
cla-bot[bot] commented 4 weeks ago

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

grahamplata commented 4 weeks ago

This isn't a valid syntax in case of MySQL.

Ahh, Yep. I see that. My apologies. In that case is CONCAT needed for this since its a singular input? If it is not a hard requirement dropping that should meet the need

mosabua commented 4 weeks ago

Also note that Spanner is not really something we use or test. Currently only MySQL and PostgreSQL are used.

mosabua commented 4 weeks ago

This isn't a valid syntax in case of MySQL.

Ahh, Yep. I see that. My apologies. In that case is CONCAT needed for this since its a singular input? If it is not a hard requirement dropping that should meet the need

Looking at this I think you might be right and its not really needed. Maybe update the PR to get rid of it and we can see .. will also have to check other database scripts and see if there is something related going on.

cla-bot[bot] commented 3 weeks ago

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

mosabua commented 3 weeks ago

I started CI and it seems good. We will have to wait for you to submit a CLA and CLA processing. In the meantime .. @vishalya @willmostly @Chaho12 .. any concerns?

cla-bot[bot] commented 2 weeks ago

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla