GoogleCloudPlatform / zetasql-toolkit

The ZetaSQL Toolkit is a library that helps users use ZetaSQL Java API to perform SQL analysis for multiple query engines, including BigQuery and Cloud Spanner.
Apache License 2.0
39 stars 10 forks source link

Failed to analyze trim function for integer as parameter #95

Open MajeedB opened 2 months ago

MajeedB commented 2 months ago

Hello Team, Unable validate below expression.

Select trim(5)

Expected : Tool should catch exception. It should throw exception like parameter is incorrect.

Actual : simply validating as correct expression

Please resolve this issue.

dion-ricky commented 1 month ago

Tested working on my setup: image

As you can see the analyzer raises a SqlException with message saying No matching signature for function TRIM for argument types: INT64. ...

The analyzed query is exactly as you've provided, here's the watcher from my debugger showing the value of analyzed query: image

Is there something that i'm missing? Please let me know.

MajeedB commented 1 month ago

I am trying catch the error using below code

analyzer. analyzeStatements(myQuery, this.Catlog, true)

Unable to catch the error msg.