Rohit Jain created TRAFODION-2240:
-------------------------------------

             Summary: Need better errors when DIVISION BY expression is 
incorrect
                 Key: TRAFODION-2240
                 URL: https://issues.apache.org/jira/browse/TRAFODION-2240
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-cmp
    Affects Versions: 2.1-incubating
            Reporter: Rohit Jain
            Assignee: Hans Zeller
            Priority: Minor


When you don't specify an expression for DIVISION BY, it gives you an error 
that tells you that it is really expecting an expression.

>>CREATE TABLE LINEITEM3
( L_ORDERKEY    INTEGER NOT NULL,
  L_LINENUMBER  INTEGER NOT NULL,
  L_SHIPDATE    DATE NOT NULL,
  PRIMARY KEY (L_ORDERKEY, L_LINENUMBER, L_SHIPDATE))
  SALT USING 54 PARTITIONS ON (L_ORDERKEY)
  DIVISION BY (L_SHIPDATE)
  ;+>+>+>+>+>+>+>

*** ERROR[4243] The DIVISION BY clause only supports very limited types of 
expressions. Expression L_SHIPDATE is not supported.


When you specify an incorrect expression it gets an assertion failure (internal 
error):

>>CREATE TABLE LINEITEM3
+>( L_ORDERKEY    INTEGER NOT NULL,
  L_LINENUMBER  INTEGER NOT NULL,
  L_SHIPDATE    DATE NOT NULL,
  PRIMARY KEY (L_ORDERKEY, L_LINENUMBER, L_SHIPDATE))
  SALT USING 54 PARTITIONS ON (L_ORDERKEY)
  DIVISION BY (YEARMONTH(L_SHIPDATE))
  ;+>+>+>+>+>+>

*** ERROR[2006] Internal error: assertion failure 
(CmpCommon::diags()->getNumber(DgSqlCode::ERROR_) > 0) in file  at line -99999.

*** ERROR[8839] Transaction was aborted.


Of course, when you get it right, you are good:
>>CREATE TABLE LINEITEM3
( L_ORDERKEY    INTEGER NOT NULL,
  L_LINENUMBER  INTEGER NOT NULL,
  L_SHIPDATE    DATE NOT NULL,
  PRIMARY KEY (L_ORDERKEY, L_LINENUMBER, L_SHIPDATE))
  SALT USING 54 PARTITIONS ON (L_ORDERKEY)
  DIVISION BY (date_part('YEARMONTH', L_SHIPDATE))
  ;

--- SQL operation complete.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to