pinot icon indicating copy to clipboard operation
pinot copied to clipboard

TIMESTAMP AS LITERAL TYPE NOT SUPPORTED IN V2 MULTI-STAGE QUERY ENGINE

Open DDeena007 opened this issue 2 years ago • 1 comments

[ { "errorCode": 200, "message": "QueryExecutionError:\njava.lang.RuntimeException: Received error query execution result block: {200=QueryExecutionError:\norg.apache.pinot.spi.exception.BadQueryRequestException: java.lang.IllegalArgumentException: Invalid timestamp: 'java.util.GregorianCalendar[time=1664202805190,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"Asia/Kolkata\",offset=19800000,dstSavings=0,useDaylight=false,transitions=7,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=8,WEEK_OF_YEAR=40,WEEK_OF_MONTH=5,DAY_OF_MONTH=26,DAY_OF_YEAR=269,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=8,HOUR_OF_DAY=20,MINUTE=3,SECOND=25,MILLISECOND=190,ZONE_OFFSET=19800000,DST_OFFSET=0]'\n\tat org.apache.pinot.core.operator.filter.predicate.PredicateEvaluatorProvider.getPredicateEvaluator(PredicateEvaluatorProvider.java:87)\n\tat org.apache.pinot.core.plan.FilterPlanNode.constructPhysicalOperator(FilterPlanNode.java:304)\n\tat org.apache.pinot.core.plan.FilterPlanNode.run(FilterPlanNode.java:92)\n...\nCaused by: java.lang.IllegalArgumentException: Invalid timestamp: 'java.util.GregorianCalendar[time=1664202805190,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id=\"Asia/Kolkata\",offset=19800000,dstSavings=0,useDaylight=false,transitions=7,lastRule=null],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2022,MONTH=8,WEEK_OF_YEAR=40,WEEK_OF_MONTH=5,DAY_OF_MONTH=26,DAY_OF_YEAR=269,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=8,HOUR_OF_DAY=20,MINUTE=3,SECOND=25,MILLISECOND=190,ZONE_OFFSET=19800000,DST_OFFSET=0]'\n\tat org.apache.pinot.spi.utils.TimestampUtils.toMillisSinceEpoch(TimestampUtils.java:63)\n\tat org.apache.pinot.core.operator.filter.predicate.PredicateUtils.getStoredTimestampValue(PredicateUtils.java:67)\n\tat org.apache.pinot.core.operator.filter.predicate.PredicateUtils.getStoredValue(PredicateUtils.java:50)\n\tat org.apache.pinot.core.operator.filter.predicate.RangePredicateEvaluatorFactory$SortedDictionaryBasedRangePredicateEvaluator.<init>(RangePredicateEvaluatorFactory.java:133)}" } ] @walterddr @ddcprg @xiangfu0

DDeena007 avatar Sep 30 '22 09:09 DDeena007

please share your minimal reproducible query and table configuration.

I suspect this would be related to converting a literal value to timestamp using scalar function at compile time

walterddr avatar Sep 30 '22 14:09 walterddr

This bug means a feature request: we need to add a new type timestamp to Literal in the query.thrift.

We get an error in query select cast(cast ('2023-01-01 00:00:00' as timestamp) as long) from Table. This is because the inner cast returns a Literal of type String (here the getLiteralExpression function takes a Timestamp object and returns a Literal of type String), which cannot be cast to type long.

The same bug was also reported in https://github.com/apache/pinot/issues/9853 and @Jackie-Jiang identified the missing feature.

shenyu0127 avatar Apr 28 '23 23:04 shenyu0127