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

typeof() does not return DECIMAL scale, precision

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.13.0
    • 1.16.0
    • None
    • None

    Description

      The typeof() function returns the type of a column:

      SELECT typeof(CAST(a AS DOUBLE)) FROM (VALUES (1)) AS T(a);
      +---------+
      | EXPR$0  |
      +---------+
      | FLOAT8  |
      +---------+
      

      In Drill, the DECIMAL type is parameterized with scale and precision. However, typeof() does not return this information:

      ALTER SESSION SET `planner.enable_decimal_data_type` = true;
      
      SELECT typeof(CAST(a AS DECIMAL)) FROM (VALUES (1)) AS T(a);
      +------------------+
      |      EXPR$0      |
      +------------------+
      | DECIMAL38SPARSE  |
      +------------------+
      
      SELECT typeof(CAST(a AS DECIMAL(6, 3))) FROM (VALUES (1)) AS T(a);
      +-----------+
      |  EXPR$0   |
      +-----------+
      | DECIMAL9  |
      +-----------+
      

      Expected something of the form DECIMAL<suffix>(<scale>, <precision>).

      Attachments

        Activity

          People

            Paul.Rogers Paul Rogers
            paul-rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: