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
35 stars 8 forks source link

Catalog mutations not applied on the last statement on a query #5

Closed ppaglilla closed 1 year ago

ppaglilla commented 1 year ago

When analyzing a query using ZetaSQLToolkitAnalyzer.analyzeStatements(), catalog mutations generated by a statement are currently applied after the ResolvedStatement is returned to the user and before the following statement is analyzed. This means a catalog mutation generated by the last statement is never applied, since there's no following statement to analyze.

This produces an issue while analyzing in place, since that last catalog mutation will not be applied to the catalog when it should.