[
https://issues.apache.org/jira/browse/TRAFODION-1458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14697130#comment-14697130
]
Suresh Subbiah commented on TRAFODION-1458:
-------------------------------------------
The problem is the compiler, when the upsert is transformed into a merge
characteristic inputs are being set in the top most flow node. This causes root
to to get these inputs in the next phase (transform) and causes this assert. I
have fixed it by adding the inputs to the child of tupleflow instead. Inputs
are needed to be set in the binder because the right side of the flow tree
where IM occurs needs these inputs to be bound correctly.
> UPSERT into table with index through ODB fails
> ----------------------------------------------
>
> Key: TRAFODION-1458
> URL: https://issues.apache.org/jira/browse/TRAFODION-1458
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-cmp
> Affects Versions: 1.1 (pre-incubation)
> Reporter: Suresh Subbiah
> Assignee: Suresh Subbiah
> Fix For: 2.0-incubating
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> The upsert command fails where there is a primary key in the table and with
> an index. It looks like the ODB tool is broken due to this issue.
>
> drop table selva.region ;
> create table selva.region
> ( region_id INT NOT NULL
> , region_sub_id int not null
> , region_name VARCHAR2(25)
> , primary key (region_id))
> salt using 4 partitions on (region_id)
> ;
>
> create index region_idx on selva.region(region_sub_id) ;
> prepare s1 from upsert into selva.region values (?[5000], ?[5000], ?[5000]);
>
>
>
>
> >>create table selva.region
> +>( region_id INT NOT NULL
> +> , region_sub_id int not null
> +> , region_name VARCHAR2(25)
> +> , primary key (region_id))
> +> salt using 4 partitions on (region_id)
> +>;
>
> --- SQL operation complete.
> >>
> >>create index region_idx on selva.region(region_sub_id) ;
>
> --- SQL operation complete.
> >>prepare s1 from upsert into selva.region values (?,?,?) ;
>
> --- SQL command prepared.
> >>explain options 'f' s1 ;
>
> LC RC OP OPERATOR OPT DESCRIPTION CARD
> ---- ---- ---- -------------------- -------- -------------------- ---------
>
> 5 . 6 root o x 1.00E+002
> 1 4 5 nested_join 1.00E+002
> 2 3 4 blocked_union 2.00E+000
> . . 3 trafodion_insert REGION_IDX 1.00E+000
> . . 2 trafodion_delete REGION_IDX 1.00E+000
> . . 1 trafodion_merge REGION 5.00E+001
>
> --- SQL operation complete.
> >>prepare s1 from upsert into selva.region values (?[5000], ?[5000], ?[5000])
> +>;
>
> *** ERROR[2006] Internal error: assertion failure
> ((getGroupAttr()->getCharacteristicInputs().contains
> (child(0)->getGroupAttr()->getCharacteristicInputs())) || (getGroupAttr()->)
> in file ../optimizer/NormRelExpr.cpp at line 7062.
>
> *** ERROR[8822] The statement was not prepared.
> Issue was found and reported by Selva.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)