FeatureBaseDB / featurebase

A crazy fast analytical database, built on bitmaps. Perfect for ML applications. Learn more at: http://docs.featurebase.com/. Start a Docker instance: https://hub.docker.com/r/featurebasedb/featurebase
https://www.featurebase.com
Apache License 2.0
2.53k stars 233 forks source link

Fix failing selects on views defined with date literals #2313

Closed pg-venkat closed 1 year ago

pg-venkat commented 1 year ago

This PR fixes defect FB-2065, failing select queries on views defined referencing built-in literals (CURRENT_DATE, CURRENT_TIMESTAMP) or string date literals('9999-12-12T00:00:00Z'), these failures are due to stored view definitions loosing references to the original tokens.

As suggested CURRENT_DATE, CURRENT_TIMESTAMP are no longer treated as date literals, they are treated as System Variables. This PR implements AST and Compiler elements needed to support SysVariables.

Also, in this PR a new variable store is added to statement execution context, so multiple references to same variable in a SQL statement will be evaluated with single value, this new single value evaluation will have a very noticeable effect on CURRENT_TIMESTAMP.

pg-venkat commented 1 year ago

@paddyjok This PR is ready for review, the changes you have requested are implemented.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
14.2% 14.2% Duplication

pg-venkat commented 1 year ago

All feedback comments are addressed. Evaluation is deferred until execution, generalized the expression type and removed sysVariable execution context store. This PR is ready for review.