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-unsubscr...@pinot.apache.org.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

Reply via email to