You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/02/02 00:53:51 UTC

[jira] [Commented] (TRAFODION-2470) Warning 6004 on histograms for NUMERIC(38,12) column

    [ https://issues.apache.org/jira/browse/TRAFODION-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15849193#comment-15849193 ] 

ASF GitHub Bot commented on TRAFODION-2470:
-------------------------------------------

GitHub user DaveBirdsall opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/943

    [TRAFODION-2470] Fixed one cause of 6004 warnings

    The function literalOfNumericPassingScale (parser/SqlParserAux.cpp) is used to parse literals into ConstValue nodes and encoded values. It was incorrectly handling signed numeric literals of 20 characters in length: it would encode these as an unsigned 64-bit integer, then create a signed SQLLargeInt or SQLNumeric with that unsigned encoded value. One symptom of this is that histograms for NUMERIC datatypes would encounter 6004 errors (out-of-order histogram intervals) if there were some values requiring less than 20 characters and others requiring 20 or more.
    
    The fix here reverts to using SQLBigNum instead for such values. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2470

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/943.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #943
    
----
commit 24e93d859ccd03b9a1892aef2e63bf7606f39675
Author: Dave Birdsall <db...@apache.org>
Date:   2017-02-02T00:47:55Z

    [TRAFODION-2470] Fixed one cause of 6004 warnings

----


> Warning 6004 on histograms for NUMERIC(38,12) column
> ----------------------------------------------------
>
>                 Key: TRAFODION-2470
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2470
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmp
>    Affects Versions: 2.1-incubating
>         Environment: All
>            Reporter: David Wayne Birdsall
>            Assignee: David Wayne Birdsall
>
> The following sqlci session log demonstrates the problem:
> >>drop table if exists T1;
> --- SQL operation complete.
> >>
> >>CREATE TABLE T1
> +>  (
> +>    C1 LARGEINT NO DEFAULT NOT NULL NOT SERIALIZED
> +>  , C2 LARGEINT NO DEFAULT NOT NULL NOT SERIALIZED
> +>  , C3 NUMERIC(38, 12) DEFAULT NULL NOT SERIALIZED
> +>  , C4 LARGEINT DEFAULT NULL NOT SERIALIZED
> +>  , PRIMARY KEY (C2 ASC, C1 ASC)
> +>  )
> +>;
> --- SQL operation complete.
> >>
> >>insert into T1 values
> +>( 1,1, 1, 1), 
> +>(1,2,9696239.280000000000, 3),
> +>(2,3, 9696240.0, 4),
> +>(2,5, 9698840.0, 6),
> +>(3,1, 9996240.0, 7),
> +>(3,2, 9999999.99, 8),
> +>(3,3, 10000000.0, 9),
> +>(4,1, 10229050.000000000000, 10);
> --- 8 row(s) inserted.
> >>
> >>update statistics for table T1 on every column;
> --- SQL operation complete.
> >>
> >>showstats for table T1 on C3 detail;
> Detailed Histogram data for Table TRAFODION.SEABASE.T1
> Table ID: 8707267549712621116
> Hist ID:    333471856
> Column(s):  C3
> Total Rows: 8
> Total UEC:  8
> Low Value:  (1.000000000000)
> High Value: (10229050.000000000000)
> Intervals:  8
> Number    Rowcount         UEC Boundary
> ====== =========== =========== ======================================
>      0           0           0 (1.000000000000)
>      1           1           1 (1.000000000000)
>      2           1           1 (9696239.280000000000)
>      3           1           1 (9696240.000000000000)
>      4           1           1 (9698840.000000000000)
>      5           1           1 (9996240.000000000000)
>      6           1           1 (9999999.990000000000)
>      7           1           1 (10000000.000000000000)
>      8           1           1 (10229050.000000000000)
> --- SQL operation complete.
> >>
> >>prepare S1 from select * from T1 
> +> where C3 > 10229050;
> *** WARNING[6004] The metadata table HISTOGRAM_INTERVALS for column TRAFODION.SEABASE.T1.C3 do not have intervals 6 and 7 in order. If you have manually modified the metadata table, then you should undo your changes using the CLEAR option in UPDATE STATISTICS and regenerate the statistics.
> --- SQL command prepared.
> >>
> Note that intervals 6 and 7 in the histograms are in fact in the proper order. The problem seems to be that the character string representation of the value for interval 7 is 20 characters long.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)