Hive
  1. Hive
  2. HIVE-3190

allow INTEGER as a type name in a column/cast expression (per ISO-SQL 2011)

    Details

    • Type: Improvement Improvement
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.8.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:
      None

      Description

      Just extend the parser to allow INTEGER instead of making folks use INT

      select cast('10' as integer) from cert.tversion tversion

      FAILED: Parse Error: line 1:20 cannot recognize input near 'integer' ')' 'from' in primitive type specification

      1. HIVE-3190.3.patch
        26 kB
        Jason Dere
      2. HIVE-3190.2.patch
        25 kB
        Jason Dere
      3. HIVE-3190.1.patch
        26 kB
        Jason Dere

        Activity

        Hide
        Hive QA added a comment -

        Overall: +1 all checks pass

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12611495/HIVE-3190.3.patch

        SUCCESS: +1 4548 tests passed

        Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/102/testReport
        Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/102/console

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        

        This message is automatically generated.

        Show
        Hive QA added a comment - Overall : +1 all checks pass Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12611495/HIVE-3190.3.patch SUCCESS: +1 4548 tests passed Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/102/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/102/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase This message is automatically generated.
        Hide
        Jason Dere added a comment -

        patch v3. updated unit test failure

        Show
        Jason Dere added a comment - patch v3. updated unit test failure
        Hide
        Hive QA added a comment -

        Overall: -1 at least one tests failed

        Here are the results of testing the latest attachment:
        https://issues.apache.org/jira/secure/attachment/12611140/HIVE-3190.2.patch

        ERROR: -1 due to 1 failed/errored test(s), 4532 tests executed
        Failed tests:

        org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_show_functions
        

        Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/80/testReport
        Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/80/console

        Messages:

        Executing org.apache.hive.ptest.execution.PrepPhase
        Executing org.apache.hive.ptest.execution.ExecutionPhase
        Executing org.apache.hive.ptest.execution.ReportingPhase
        Tests failed with: TestsFailedException: 1 tests failed
        

        This message is automatically generated.

        Show
        Hive QA added a comment - Overall : -1 at least one tests failed Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12611140/HIVE-3190.2.patch ERROR: -1 due to 1 failed/errored test(s), 4532 tests executed Failed tests: org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_show_functions Test results: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/80/testReport Console output: http://bigtop01.cloudera.org:8080/job/PreCommit-HIVE-Build/80/console Messages: Executing org.apache.hive.ptest.execution.PrepPhase Executing org.apache.hive.ptest.execution.ExecutionPhase Executing org.apache.hive.ptest.execution.ReportingPhase Tests failed with: TestsFailedException: 1 tests failed This message is automatically generated.
        Hide
        Xuefu Zhang added a comment -

        Got it. Thanks for the explanation. I think we can have keywords defined for those in the lexer, and accommodate them in the grammar.

        Show
        Xuefu Zhang added a comment - Got it. Thanks for the explanation. I think we can have keywords defined for those in the lexer, and accommodate them in the grammar.
        Hide
        Jason Dere added a comment -

        The issue would have been if we had put the folliowing alias rule in the lexer:

        KW_BINARY: 'BINARY' | 'BLOB'
        

        which would have been bad because the parsing rules would then allow BLOB LARGE OBJECT, in addition to BINARY LARGE OBJECT. So BINARY and BLOB need to stay as separate keywords in the lexer rules.

        Show
        Jason Dere added a comment - The issue would have been if we had put the folliowing alias rule in the lexer: KW_BINARY: 'BINARY' | 'BLOB' which would have been bad because the parsing rules would then allow BLOB LARGE OBJECT, in addition to BINARY LARGE OBJECT. So BINARY and BLOB need to stay as separate keywords in the lexer rules.
        Hide
        Xuefu Zhang added a comment -

        Not sure I understand the problem. Don't you mean to make the following:
        binary = BLOB = BINARY LARGE OBJECT?

        Show
        Xuefu Zhang added a comment - Not sure I understand the problem. Don't you mean to make the following: binary = BLOB = BINARY LARGE OBJECT?
        Hide
        Jason Dere added a comment -

        Tried doing Xuefu's suggestion of doing some of the aliases as lexer rules. Could not do this with BINARY/BLOB because this would have resulted BLOB LARGE OBJECT being legal. Which is the danger of doing it in the lexer - I think i general it's probably better to have each keyword parsed as its on token.

        Show
        Jason Dere added a comment - Tried doing Xuefu's suggestion of doing some of the aliases as lexer rules. Could not do this with BINARY/BLOB because this would have resulted BLOB LARGE OBJECT being legal. Which is the danger of doing it in the lexer - I think i general it's probably better to have each keyword parsed as its on token.
        Hide
        Jason Dere added a comment -

        I can change it for the aliases which are just a single token.

        Show
        Jason Dere added a comment - I can change it for the aliases which are just a single token.
        Hide
        Xuefu Zhang added a comment -

        INTEGER needs in ''. I guess you got my point now.

        Show
        Xuefu Zhang added a comment - INTEGER needs in ''. I guess you got my point now.
        Hide
        Xuefu Zhang added a comment -

        We should really have a preview button here.

        KW_INT : 'INT'
               | INTEGER
               ;
        
        Show
        Xuefu Zhang added a comment - We should really have a preview button here. KW_INT : 'INT' | INTEGER ;
        Hide
        Xuefu Zhang added a comment -

        I meant to say this:

        KW_INT : INT
                        INTEGER
                      ; 
        
        Show
        Xuefu Zhang added a comment - I meant to say this: KW_INT : INT INTEGER ;
        Hide
        Xuefu Zhang added a comment -

        Jason Dere It might be simpler if we treat those as syntactic flavours. Thus, you might be able to have something like this:
        {code|
        KW_INT : INT

        INTEGER
        ;
        
        

        Then, you don't need anything after that.

        Show
        Xuefu Zhang added a comment - Jason Dere It might be simpler if we treat those as syntactic flavours. Thus, you might be able to have something like this: {code| KW_INT : INT INTEGER ; Then, you don't need anything after that.
        Hide
        Jason Dere added a comment -

        patch v1

        Show
        Jason Dere added a comment - patch v1
        Hide
        Jason Dere added a comment -

        How about the following aliases:

        INTEGER = INT
        BLOB/BINARY LARGE OBJECT = BINARY
        CLOB/CHARACTER LARGE OBJECT = STRING
        NUMERIC = DECIMAL
        REAL = FLOAT
        DOUBLE PRECISION = DOUBLE

        Show
        Jason Dere added a comment - How about the following aliases: INTEGER = INT BLOB/BINARY LARGE OBJECT = BINARY CLOB/CHARACTER LARGE OBJECT = STRING NUMERIC = DECIMAL REAL = FLOAT DOUBLE PRECISION = DOUBLE

          People

          • Assignee:
            Jason Dere
            Reporter:
            N Campbell
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:

              Development