yashmayya opened a new pull request, #14502: URL: https://github.com/apache/pinot/pull/14502
- The timestamp literal handling in the multi-stage query engine has some gaps - particularly, when converting from Calcite's internal representation to a long value representing milliseconds since epoch (which is what Pinot uses internally). - The existing logic only handling the case when the representation was an instance of `java.util.Calendar`. However, the internal representation used by Calcite for timestamp types is `org.apache.calcite.util.TimestampString` (see [here](https://github.com/apache/calcite/blob/f2ec11fe7e23ecf2db903bc02c40609242993aad/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L344-L346)). External callers usually convert this to `Calendar` or `Long` (see [here](https://github.com/apache/calcite/blob/f2ec11fe7e23ecf2db903bc02c40609242993aad/core/src/main/java/org/apache/calcite/rex/RexLiteral.java#L951-L990)), but this doesn't always appear to be the case. - One example is range sets in a `Sarg` (search argument) - this issue was detected by a query with a filter predicate like `WHERE ts BETWEEN '2016-01-01 00:00:00' AND '2016-01-01 10:00:00'` where the class cast exception `class org.apache.calcite.util.TimestampString cannot be cast to class java.util.Calendar` was thrown. This wasn't an issue until recently because search nodes were usually reduced before the final query plan was generated (which changed in https://github.com/apache/pinot/pull/14448). - However, simply replacing the `Calendar` based cast logic to `TimestampString` based cast logic is also incorrect and a query with a filter predicate like `WHERE ts >= CAST(1454284798000 AS TIMESTAMP)` will fail with a class cast exception `class java.util.GregorianCalendar cannot be cast to class org.apache.calcite.util.TimestampString`. - This patch fixes the timestamp literal handling logic to cover all the cases. A couple of query compilation tests based on the above two filter predicates have also been added. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org