query plan missing sort operator

Bug #1361754 reported by khaled Bouaziz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Committed
Medium
QF Chen

Bug Description

the query plan generated for a load query that loads data from a table with primary key that has ascendant modifier into a table where the same key has descending modifiers does not add the sort operator and assume the data is already sorted correctly

this issue can be reproduced with below steps and it seems like an optimizer issue:
 -------------------------------------------------
  cqd comp_bool_226 'on';
  set schema mytest2;

create table t_asc (a int not null, b int not null, primary key (a asc, b asc));
 create table t_desc (a int not null, b int not null, primary key (a asc, b desc));
 insert into t_asc values (1,1),(2,2),(3,3),(4,4);
  insert into t_asc values (2,3);
  prepare s from load transform into t_desc select * from t_asc;
 explain options 'f' s;
 execute s;
 ---------------

Tags: sql-cmp
Changed in trafodion:
assignee: nobody → taoufik ben abdellatif (taoufik-abdellatif)
QF Chen (qifan-chen)
Changed in trafodion:
assignee: taoufik ben abdellatif (taoufik-abdellatif) → QF Chen (qifan-chen)
status: New → In Progress
Revision history for this message
QF Chen (qifan-chen) wrote :

Added the following logic in NJ::createContextForChild() to shut down plan 0, which does not require the left child of the NJ to sorted as the right child.

1. detect that it is a traf fast load query.
2. save the fact into NJ work space
3. shut down the right child of NJ for plan0

Changed in trafodion:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.