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

Issues with explicit casts to TINYINT, SMALLINT & REAL

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • Future
    • Execution - Data Types
    • None

    Description

      The following have Issues:
      > create table tiny1 as select cast(1 as tinyint) from sys.options limit 1;
      ----------------------+

      ok summary

      ----------------------+

      false Error: Unable to convert the value of 1 and type TINYINT to a Drill constant expression.

      ----------------------+
      1 row selected (0.055 seconds)

      > create table small1 as select cast(1 as smallint) from sys.options limit 1;
      ----------------------+

      ok summary

      ----------------------+

      false Error: Unable to convert the value of 1 and type SMALLINT to a Drill constant expression.

      ----------------------+
      1 row selected (0.055 seconds)

      The following work:
      > create table int1 as select cast(1 as int) from sys.options limit 1;
      -------------------------------------+

      Fragment Number of records written

      -------------------------------------+

      0_0 1

      -------------------------------------+
      1 row selected (0.172 seconds)

      > create table big1 as select cast(1 as bigint) from sys.options limit 1;
      -------------------------------------+

      Fragment Number of records written

      -------------------------------------+

      0_0 1

      -------------------------------------+
      1 row selected (0.195 seconds)

      > create table float1 as select cast(1 as float) from sys.options limit 1;
      -------------------------------------+

      Fragment Number of records written

      -------------------------------------+

      0_0 1

      -------------------------------------+
      1 row selected (0.174 seconds)

      0: jdbc:drill:zk=10.10.103.34:5181> create table double1 as select cast(1 as double) from sys.options limit 1;
      -------------------------------------+

      Fragment Number of records written

      -------------------------------------+

      0_0 1

      -------------------------------------+
      1 row selected (0.153 seconds)

      0: jdbc:drill:zk=10.10.103.34:5181> create table decimal1 as select cast(1 as decimal(1,1)) from sys.options limit 1;
      -------------------------------------+

      Fragment Number of records written

      -------------------------------------+

      0_0 1

      -------------------------------------+
      1 row selected (0.159 seconds)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              agirish Abhishek Girish
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: