[
https://issues.apache.org/jira/browse/TRAFODION-2736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16163525#comment-16163525
]
Hans Zeller commented on TRAFODION-2736:
----------------------------------------
For regular predicates, Scan::addIndexInfo will generate a list of index-only
scans and of index joins, including the predicates to evaluate on the index and
the base table. Computed predicates don't follow that model. Those get
calculated in Scan::addIndexInfo and then they get stored in the Scan and
FileScan nodes.
For a regular transformation of Scan to FileScan, that's ok. However, when we
transform the scan into a join between an index scan and a base table, there is
a bug. In this case we create two new scans in method
IndexJoinRule1::makeSubstituteFromIndexInfo() in file TransRule.cpp. I don't
see code in that method that transfers the computed predicate from the original
scan to the new scan of the left side of the join. We also won't re-create the
computed predicates on this new scan, since we force an index-only scan for
this node, so Scan::addIndexInfo() will return immediately and do nothing.
> Missing predicates on salt columns when using an index join
> -----------------------------------------------------------
>
> Key: TRAFODION-2736
> URL: https://issues.apache.org/jira/browse/TRAFODION-2736
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-cmp
> Affects Versions: 2.0-incubating
> Environment: Any
> Reporter: Hans Zeller
> Assignee: Hans Zeller
>
> When we have salted tables, the compiler is supposed to generate predicates
> on the salt column automatically, based on predicates on the columns used for
> salting.
> Suresh and Benny found a case where we don't do that, related to index joins
> (a join between an index and its base table). Here is an example:
> {code}
> create table tdi(service_id int not null,
> user_number int not null,
> start_time timestamp not null,
> b int,
> primary key(service_id, user_number, start_time))
> division by (date_trunc('day', start_time))
> salt using 4 partitions on (user_number);
> create index tdix on tdi(user_number, start_time) salt like table;
> control query shape join(cut,cut);
> prepare s from
> select * from tdi where user_number = 1234 and start_time between timestamp
> '2017-01-01 00:00:00' and timestamp '2017-01-15 00:00:00';
> explain s;
> {code}
> In the explain, we would expect a predicate on the salt column but there is
> none.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)