Support extract syntax
SQL defines the extract expression that can be used to access components of temporal datatypes. Calcite already supports it, so when an expression includes an extract function it parses. But once Pinot tries to convert it to its own expression AST, it fails with:
ProcessingException(errorCode:150, message:PQLParsingError:
java.lang.ClassCastException: class org.apache.calcite.sql.SqlIntervalQualifier cannot be cast to class org.apache.calcite.sql.SqlBasicCall (org.apache.calcite.sql.SqlIntervalQualifier and org.apache.calcite.sql.SqlBasicCall are in unnamed module of loader 'app')
at org.apache.pinot.sql.parsers.CalciteSqlParser.toExpression(CalciteSqlParser.java:682)
at org.apache.pinot.sql.parsers.CalciteSqlParser.compileFunctionExpression(CalciteSqlParser.java:737)
at org.apache.pinot.sql.parsers.CalciteSqlParser.toExpression(CalciteSqlParser.java:682)
at org.apache.pinot.sql.parsers.CalciteSqlParser.toExpression(CalciteSqlParser.java:619))
Pinot already have functions like minute, year, etc so this seems to be a matter of syntax.
I am planning to pick this up.
I have added the progress so far in the above PR. May I get some eyes on this, to ensure that I am on the right track?
@npawar Update -- PR is merged.
@tanmesh Can you help also update this document page: https://docs.pinot.apache.org/users/user-guide-query/supported-transformations#transform-functions The source code can be found here: https://github.com/pinot-contrib/pinot-docs
I have added the documentation in the PR above ^. Please review it.
Merged. Thank you so much for your contribution!