heavyai / heavyai-crossfilter

JavaScript library for exploring large multivariate datasets in the browser.
Other
51 stars 20 forks source link

[FE-9812] Restore `TIMESTAMP(3)` type annotation to string literals #100

Closed int3h closed 4 years ago

int3h commented 4 years ago

PR #97 removed all datetime casts/type annotations from generated SQL for performance reasons. However, there was a miscommunication, and we discovered that SQL date/time functions require that their arguments be CAST'ed or Calcite throws an error.

This PR restores the cast to all datetime literals. The more sophisticated fix would be to only cast string literal function arguments. However, doing that would require we write a RegEx/parser to identify these arguments, then add a cast to them. This PR's implementation just restores the existing Date object formatter's former code (before PR #97) to prepend the cast to Date strings (and, therefore, we already know it works). Note that we retain PR #97's removal of CAST(... AS TIMESTAMP(3)) in SQL queries, which still gives us significant speed improvements over 4.8 (which make the slowdown from this PR insignificant).

Merge Checklist

:wrench: Issue(s) fixed:

:smoking: Smoke Test

:ship: Merge