You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/23 17:58:37 UTC
[GitHub] [pinot] agavra opened a new issue, #9853: Casting TIMESTAMP to TIMESTAMP causes Function Invoker to fail
agavra opened a new issue, #9853:
URL: https://github.com/apache/pinot/issues/9853
The following test:
```java
{
String query = "SELECT DAYOFWEEK(CAST(NOW() AS TIMESTAMP)) as timestampColumn FROM testTable";
BrokerResponseNative brokerResponse = getBrokerResponse(query);
ResultTable resultTable = brokerResponse.getResultTable();
DataSchema dataSchema = resultTable.getDataSchema();
assertEquals(dataSchema,
new DataSchema(new String[]{"timestampColumn"}, new ColumnDataType[]{ColumnDataType.INT}));
List<Object[]> rows = resultTable.getRows();
assertEquals(rows.size(), 10);
for (int i = 0; i < 10; i++) {
Object[] row = rows.get(i);
assertEquals(row.length, 1);
assertEquals(row[0], 3);
}
}
```
Fails with the following exception:
```
Caused by: java.lang.NumberFormatException: For input string: "2022-11-23 09:56:37.877"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.base/java.lang.Long.parseLong(Long.java:692)
at java.base/java.lang.Long.parseLong(Long.java:817)
at org.apache.pinot.common.utils.PinotDataType$11.toLong(PinotDataType.java:609)
at org.apache.pinot.common.utils.PinotDataType$6.convert(PinotDataType.java:369)
at org.apache.pinot.common.utils.PinotDataType$6.convert(PinotDataType.java:318)
at org.apache.pinot.common.function.FunctionInvoker.convertTypes(FunctionInvoker.java:110)
at org.apache.pinot.sql.parsers.rewriter.CompileTimeFunctionsInvoker.invokeCompileTimeFunctionExpression(CompileTimeFunctionsInvoker.java:81)
... 34 more
```
The reason is that the `DayOfWeek` method takes in a long and the cast turns the timestamp into a string (instead of keeping it as a Timestamp type).
--
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-unsubscribe@pinot.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
[GitHub] [pinot] Jackie-Jiang commented on issue #9853: Casting TIMESTAMP to TIMESTAMP causes Function Invoker to fail
Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on issue #9853:
URL: https://github.com/apache/pinot/issues/9853#issuecomment-1329810699
Good catch. I think `cast` can correctly convert the value to `Timestamp`, but we don't have the `Literal` expression support on `Timestamp` type, thus has to store it as string
--
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-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org