Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-2860

Unable to cast integer column from parquet file to interval day

    XMLWordPrintableJSON

Details

    Description

      I can cast numeric literal to "interval day":

      0: jdbc:drill:schema=dfs> select cast(1 as interval day) from t1;
      +------------+
      |   EXPR$0   |
      +------------+
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      | P1D        |
      +------------+
      10 rows selected (0.122 seconds)
      

      Get an error when I'm trying to do the same from parquet file:

      0: jdbc:drill:schema=dfs> select cast(a1 as interval day) from t1 where a1 = 1;
      Query failed: SYSTEM ERROR: Invalid format: "1"
      
      Fragment 0:0
      
      [6a4adf04-f3db-4feb-8010-ebc3bfced1e3 on atsqa4-134.qa.lab:31010]
      
        (java.lang.IllegalArgumentException) Invalid format: "1"
          org.joda.time.format.PeriodFormatter.parseMutablePeriod():326
          org.joda.time.format.PeriodFormatter.parsePeriod():304
          org.joda.time.Period.parse():92
          org.joda.time.Period.parse():81
          org.apache.drill.exec.test.generated.ProjectorGen180.doEval():77
          org.apache.drill.exec.test.generated.ProjectorGen180.projectRecords():62
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.doWork():170
          org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext():93
          org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext():130
          org.apache.drill.exec.record.AbstractRecordBatch.next():144
          org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next():118
          org.apache.drill.exec.physical.impl.BaseRootExec.next():74
          org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext():80
          org.apache.drill.exec.physical.impl.BaseRootExec.next():64
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():198
          org.apache.drill.exec.work.fragment.FragmentExecutor$1.run():192
          java.security.AccessController.doPrivileged():-2
          javax.security.auth.Subject.doAs():415
          org.apache.hadoop.security.UserGroupInformation.doAs():1469
          org.apache.drill.exec.work.fragment.FragmentExecutor.run():192
          org.apache.drill.common.SelfCleaningRunnable.run():38
          java.util.concurrent.ThreadPoolExecutor.runWorker():1145
          java.util.concurrent.ThreadPoolExecutor$Worker.run():615
          java.lang.Thread.run():745
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      

      If I try casting a1 to an integer I run into drill-2859

      Attachments

        1. t1.parquet
          0.5 kB
          Victoria Markman

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vicky Victoria Markman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: