Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-2240

Need better errors when DIVISION BY expression is incorrect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1-incubating
    • 2.2.0
    • sql-cmp
    • None

    Description

      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.

      Attachments

        Activity

          People

            hzeller Hans Zeller
            RohitJain13 Rohit Jain
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: