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

Casting integer values from JSON file to float/double datatype fails.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 0.9.0
    • None
    • Storage - JSON
    • None
    • 4 node cluster on CentOS.

    Description

      Casting integer values from JSON file to float/double datatype fails.

      project key without any casting.
      
      0: jdbc:drill:> select key from `bgint_f.json`;
      Query failed: Query stopped., You tried to write a BigInt type when you are using a ValueWriter of type NullableFloat8WriterImpl. [ 9f8610ea-6d99-44ee-80b6-8869e544d10c on centos-02.qa.lab:31010 ]
      
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      
      project key, cast it to float, fails.
      
      0: jdbc:drill:> select cast(key as float) from `bgint_f.json`;
      Query failed: Query stopped., You tried to write a BigInt type when you are using a ValueWriter of type NullableFloat8WriterImpl. [ 8e6200a3-b02e-44fe-81e3-ae3bcd241c01 on centos-02.qa.lab:31010 ]
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      
      project key, cast it double, fails.
      
      0: jdbc:drill:> select cast(key as double) from `bgint_f.json`;
      Query failed: Query stopped., You tried to write a BigInt type when you are using a ValueWriter of type NullableFloat8WriterImpl. [ eb124f63-5665-4f64-bd77-d2bb2d040fe6 on centos-02.qa.lab:31010 ]
      
      
      Error: exception while executing query: Failure while executing query. (state=,code=0)
      
      all_text_mode was set to false.
      
      0: jdbc:drill:> select * from sys.options where name like '%json%';
      +------------+------------+------------+------------+------------+------------+------------+
      |    name    |    kind    |    type    |  num_val   | string_val |  bool_val  | float_val  |
      +------------+------------+------------+------------+------------+------------+------------+
      | store.json.all_text_mode | BOOLEAN    | SYSTEM     | null       | null       | false      | null       |
      +------------+------------+------------+------------+------------+------------+------------+
      1 row selected (0.211 seconds)
      
      Details of version
      
      | 9d92b8e319f2d46e8659d903d355450e15946533 | DRILL-2580: Exit early from HashJoinBatch if build side is empty | 26.03.2015 @ 16:13:53 EDT 
      
      Stack trace from drillbit.log 
      
      2015-04-07 23:19:08,826 [2adb9a12-fbf9-29fe-416a-17a4829e6470:frag:0:0] ERROR o.a.drill.exec.ops.FragmentContext - Fragment Context received failure -- Fragment: 0:0
      java.lang.RuntimeException: Error closing fragment context.
              at org.apache.drill.exec.work.fragment.FragmentExecutor.closeOutResources(FragmentExecutor.java:224) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:166) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.common.SelfCleaningRunnable.run(SelfCleaningRunnable.java:38) [drill-common-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_75]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_75]
              at java.lang.Thread.run(Thread.java:745) [na:1.7.0_75]
      Caused by: java.lang.IllegalArgumentException: You tried to write a BigInt type when you are using a ValueWriter of type NullableFloat8WriterImpl.
              at org.apache.drill.exec.vector.complex.impl.AbstractFieldWriter.fail(AbstractFieldWriter.java:607) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.impl.AbstractFieldWriter.writeBigInt(AbstractFieldWriter.java:189) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.impl.NullableFloat8WriterImpl.writeBigInt(NullableFloat8WriterImpl.java:88) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.fn.JsonReader.writeData(JsonReader.java:276) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.fn.JsonReader.writeDataSwitch(JsonReader.java:197) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.fn.JsonReader.writeToVector(JsonReader.java:171) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.vector.complex.fn.JsonReader.write(JsonReader.java:145) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.store.easy.json.JSONRecordReader.next(JSONRecordReader.java:123) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.ScanBatch.next(ScanBatch.java:170) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:118) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:99) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:89) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:51) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:134) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:142) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:118) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:68) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:96) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:58) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              at org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:163) ~[drill-java-exec-0.9.0-SNAPSHOT-rebuffed.jar:0.9.0-SNAPSHOT]
              ... 4 common frames omitted
      
      Contents from bgint_f.json
      
      {"key":9.223372e+18}
      {"key":100000000}
      {"key":-1}
      {"key":0}
      {"key":99999999}
      {"key":4294967296}
      {"key":-100000}
      {"key":100}
      {"key":536870912}
      
      

      Attachments

        Issue Links

          Activity

            People

              sphillips Steven Phillips
              khfaraaz Khurram Faraaz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: