You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Hans Zeller (JIRA)" <ji...@apache.org> on 2016/10/31 23:12:59 UTC

[jira] [Resolved] (TRAFODION-2240) Need better errors when DIVISION BY expression is incorrect

     [ https://issues.apache.org/jira/browse/TRAFODION-2240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hans Zeller resolved TRAFODION-2240.
------------------------------------
       Resolution: Fixed
    Fix Version/s: 2.2-incubating

Code committed on 10/31/2016 with https://github.com/apache/incubator-trafodion/pull/794.

Sorry, I failed to mention this JIRA in the pull request text. The fix is buried in this large change, it's in file core/sql/sqlcomp/CmpSeabaseDDLtable.cpp.

> 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
>             Fix For: 2.2-incubating
>
>
> 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)