Uploaded image for project: 'Apache Trafodion'
  1. Apache Trafodion
  2. TRAFODION-3018

Select of UPPER on upshifted column in join predicate cores

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: sql-cmp
    • Labels:
      None

      Description

      The following script reproduces the problem. First create the table and populate it:

      drop table if exists mytable cascade;

      create table mytable (
      val int,
      c1 char(1) upshift,
      c2 char(1)
      );

      insert into mytable values (1, 'a', 'a');
      select * from mytable;

      If we now do any of the following SELECTs, we'll get an internal error on release builds or a core on debug builds:

      select t1.val from mytable t1, mytable t2 where UCASE(t1.c1) = UCASE(t2.c1);
      select t1.val from mytable t1, mytable t2 where UPPER(t1.c1) = UPPER(t2.c1);
      select t1.val from mytable t1, mytable t2 where UPSHIFT(t1.c1) = UPSHIFT(t2.c1);

      The first several frames on the core stack trace look like:

      (gdb) bt
      #0 0x00007ffff511a495 in raise () from /lib64/libc.so.6
      #1 0x00007ffff511bc75 in abort () from /lib64/libc.so.6
      #2 0x00007fffec50986d in GeneratorAbort (file=
      0x7fffec68fce1 "../generator/Generator.cpp", line=2655, message=
      0x7ffffffe8dc0 "\nValueId 7 (TRAFODION.SCH.MYTABLE.C1...) not found in MapTable 0x7ffffffeb460") at ../generator/Generator.cpp:3029
      #3 0x00007fffec508caa in Generator::getMapInfo (this=0x7ffffffeb460, value_id=
      ..., mapTable=0x0) at ../generator/Generator.cpp:2655
      #4 0x00007fffec5093a7 in Generator::getAttr (this=0x7ffffffeb460, ie=
      0x7fffd300ac80) at ../generator/Generator.cpp:2876
      #5 0x00007fffec551e37 in ItemExpr::codegen_and_set_attributes (this=
      0x7fffd09fd860, generator=0x7ffffffeb460, attr=0x7fffd0a015b8, num_attrs=3)
      at ../generator/GenItemExpr.cpp:127
      #6 0x00007fffec52e2c8 in ExpGenerator::genItemExpr (this=0x7fffd09e2d08,
      item_expr=0x7fffd09fd860, out_attr=0x7ffffffe90a0, num_attrs=3, gen_child=
      -1) at ../generator/GenExpGenerator.cpp:5389
      #7 0x00007fffec553920 in BiRelat::codeGen (this=0x7fffd09fd860, generator=
      0x7ffffffeb460) at ../generator/GenItemExpr.cpp:560
      #8 0x00007fffec5598b1 in BoolResult::codeGen (this=0x7fffd09fe028, generator=
      0x7ffffffeb460) at ../generator/GenItemFunc.cpp:864
      #9 0x00007fffec5255a2 in ExpGenerator::generateExpr (this=0x7fffd09e2d08,
      val_id=..., node_type=ex_expr::exp_SCAN_PRED, expr=0x7ffffffe98b8)
      at ../generator/GenExpGenerator.cpp:2870
      --Type <return> to continue, or q <return> to quit--
      #10 0x00007fffec5ff210 in HashJoin::codeGen (this=0x7fffd09d7590, generator=
      0x7ffffffeb460) at ../generator/GenRelJoin.cpp:1185
      #11 0x00007fffec60f66e in RelRoot::codeGen (this=0x7fffd09d57c0, generator=
      0x7ffffffeb460) at ../generator/GenRelMisc.cpp:1253
      #12 0x00007fffec501535 in Generator::genCode (this=0x7ffffffeb460, source=
      0x7fffd3036ba8 "select t1.val from mytable t1, mytable t2 where UCASE(t1.c1) = UCASE(t2.c1);", expr_node=0x7fffd09d57c0) at ../generator/Generator.cpp:557
      #13 0x00007fffeee01eae in CmpMain::compile (this=0x7ffffffeed60, input_str=
      0x7fffd3036ba8 "select t1.val from mytable t1, mytable t2 where UCASE(t1.c1) = UCASE(t2.c1);", charset=15, queryExpr=@0x7ffffffeec58, gen_code=
      0x7fffd2ff69a8, gen_code_len=0x7fffd2ff69a0, heap=0x7fffd30391d8, phase=
      CmpMain::END, fragmentDir=0x7ffffffeeeb8, op=3004, useQueryCache=
      CmpMain::NORMAL, cacheable=0x7ffffffeec44, begTime=0x7ffffffeec60,
      shouldLog=0) at ../sqlcomp/CmpMain.cpp:2339
      #14 0x00007fffeedff94d in CmpMain::sqlcomp (this=0x7ffffffeed60, input_str=
      0x7fffd3036ba8 "select t1.val from mytable t1, mytable t2 where UCASE(t1.c1) = UCASE(t2.c1);", charset=15, queryExpr=@0x7ffffffeec58, gen_code=
      0x7fffd2ff69a8, gen_code_len=0x7fffd2ff69a0, heap=0x7fffd30391d8, phase=
      CmpMain::END, fragmentDir=0x7ffffffeeeb8, op=3004, useQueryCache=
      CmpMain::NORMAL, cacheable=0x7ffffffeec44, begTime=0x7ffffffeec60,
      shouldLog=0) at ../sqlcomp/CmpMain.cpp:1653
      #15 0x00007fffeedfd23d in CmpMain::sqlcomp (this=0x7ffffffeed60, input=...,
      gen_code=0x7fffd2ff69a8, gen_code_len=0x7fffd2ff69a0, heap=0x7fffd30391d8,
      --Type <return> to continue, or q <return> to quit--q
      pQuit
      (gdb)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: