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

Bad histogram values are sometimes not reported

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.3
    • sql-cmp
    • None

    Description

      Function EncodedValue::constructorFunction has logic to raise a 6003 warning if it encounters invalid values in histogram intervals. When this happens, the compiler generates a default histogram for that column (that is, it behaves as if it has no statistics for that column.) This can lead to poor query plans. In some circumstances, however, this warning does not get reported, so the user is not aware of the possible compromise in plan quality.

      An example of this can be created as follows:

      1. Create a Hive table Test1 with columns (a int, b int). Put some data into it, and in Trafodion, use UPDATE STATISTICS FOR TABLE HIVE.HIVE.TEST1 to generate statistics for it.
      2. Outside of Trafodion (in the Hive shell, say), drop and recreate the Hive table, but this time with columns (a string, b string). Populate that with a few rows.
      3. In a fresh sqlci session, do "prepare s1 from select a,b from hive.hive.test1 where a < 'abcd';". This will appear to be successful, however in fact 6003 warnings were generated internally but not reported.

      Another way to create an example is to create a Trafodion table, test1, with columns (a char(4), b char(4). Put some rows into it and do UPDATE STATISTICS on it. Then manually alter the boundary value in one of the SB_HISTOGRAM_INTERVALS tables, changing a value from a character string literal to a numeric literal. For example, change "('abcd')" to "(3)".

      Attachments

        Issue Links

          Activity

            People

              dbirdsall Dave Birdsall
              dbirdsall Dave Birdsall
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: