pandalanax commented on issue #2390:
URL: https://github.com/apache/drill/issues/2390#issuecomment-984546322


   Thanks for the quick answer!
   Neat trick although the second one with `TO_DATE` throws following error:
   ```sql
   SELECT TO_DATE(nearestDate(CURRENT_DATE, 'WEEK_SUNDAY'), 'w') AS week_num
   FROM (VALUES(1));
   ```
   ```java
   Error: SYSTEM ERROR: IllegalArgumentException: Invalid format: "2021-11-28 
00:00:00.000" is malformed at "21-11-28 00:00:00.000"
   
   Fragment 0:0
   
   Please, refer to logs for more information.
   
   [Error Id: 02de9e0a-7521-45c9-b1bc-140352bc934b on xxxxxxx]
   
     (java.lang.IllegalArgumentException) Invalid format: "2021-11-28 
00:00:00.000" is malformed at "21-11-28 00:00:00.000"
       org.joda.time.format.DateTimeFormatter.parseDateTime():899
       org.joda.time.DateMidnight.parse():152
       org.apache.drill.exec.test.generated.ProjectorGen212045.doSetup():185
       org.apache.drill.exec.test.generated.ProjectorGen212045.setup():107
       
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchemaFromInput():559
       
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.setupNewSchema():571
       org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():101
       
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():144
       org.apache.drill.exec.record.AbstractRecordBatch.next():188
       org.apache.drill.exec.record.AbstractRecordBatch.next():128
       org.apache.drill.exec.record.AbstractRecordBatch.next():118
       org.apache.drill.exec.record.AbstractUnaryRecordBatch.innerNext():65
       
org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():144
       org.apache.drill.exec.record.AbstractRecordBatch.next():188
       org.apache.drill.exec.physical.impl.BaseRootExec.next():105
       
org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():83
       org.apache.drill.exec.physical.impl.BaseRootExec.next():95
       org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():325
       org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():312
       java.security.AccessController.doPrivileged():-2
       javax.security.auth.Subject.doAs():422
       org.apache.hadoop.security.UserGroupInformation.doAs():1730
       org.apache.drill.exec.work.fragment.FragmentExecutor.run():312
       org.apache.drill.common.SelfCleaningRunnable.run():38
       java.util.concurrent.ThreadPoolExecutor.runWorker():1149
       java.util.concurrent.ThreadPoolExecutor$Worker.run():624
       java.lang.Thread.run():748 (state=,code=0)
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to