Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-BETA1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Proposal for implementing a CAST mechanism in Drill.
      ===============================================

      The casting mechanism would be of two types

      • Implicit type casting
      • Explicit type casting

      Details:

      • The Implicit type cast would take care of the casting of the lower datatype holders to the higher datatype holders automatically.

        Eg. IntHolder would be casted to Float4Holder/Float8Holder directly.

      • The explicit type casting would enable the user to use a CAST() function to cast some value to another datatype by specifying the type. The cast function would be a function exposed with syntax similar to standard SQL format.

        Eg. SELECT CAST (somevalue AS INT) FROM sometable;

      Type conversion rules:
      Conversion rules have to be similar to SQL standards.

      Implicit type conversion:

      • For arithmetic & comparison operators (+, -, *, /, <, >, =, etc) -
        • If both operands types are different, Strings would be converted to Double, and then both the operands would be converted to the same type by choosing the type with higher precision.
      • For values passed to a Function/UDF -
        • The values would be converted to the parameter accepted by the Function.
        • In case of multiple overloaded functions are present, the function with least number of conversions would be selected.
        • In case there are multiple functions with least number of conversions, there would be an error returned to user for ambiguous function.

      Explicit Type Conversion

      • User would use the CAST Function for converting types to another specified type.
      • For nonconvertible types user gets an error back.
      1. DRILL_259.combined.patch.3.txt
        89 kB
        Jinfeng Ni
      2. DRILL_259.jinfeng.patch.3.txt
        110 kB
        Jinfeng Ni
      3. DRILL_259.yash.patch.txt
        40 kB
        Jinfeng Ni

        Activity

        Jake Farrell made changes -
        Workflow no-reopen-closed, patch-avail [ 12820300 ] no-reopen-closed, patch-avail, testing [ 12860544 ]
        Jacques Nadeau made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Jinfeng Ni [ jni ]
        Resolution Fixed [ 1 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.combined.patch.3.txt [ 12621403 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.jinfeng.patch.3.txt [ 12621402 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.combined.patch.2.txt [ 12620895 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.jinfeng.patch.2.txt [ 12620894 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.combined.patch.2.txt [ 12620895 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.jinfeng.patch.2.txt [ 12620894 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.combined.patch.txt [ 12620665 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.jinfeng.patch.txt [ 12620664 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.combined.patch.txt [ 12620665 ]
        Jinfeng Ni made changes -
        Attachment DRILL_259.jinfeng.patch.txt [ 12620664 ]
        Jinfeng Ni made changes -
        Field Original Value New Value
        Attachment DRILL_259.yash.patch.txt [ 12620663 ]
        Yash Sharma created issue -

          People

          • Assignee:
            Jinfeng Ni
            Reporter:
            Yash Sharma
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development