> On Nov. 7, 2018, 2:09 a.m., Jesús Camacho Rodríguez wrote: > > ql/src/test/queries/clientpositive/constraints_optimization.q > > Lines 355 (patched) > > <https://reviews.apache.org/r/69202/diff/4/?file=2104588#file2104588line355> > > > > Can we add two more tests: > > - One with column swapping before GroupBy (probably if you use group by > > b,c,a and table contains a,b,c, it should work and add the Project in > > between the TS and the GroupBy). > > - One with a join and a group by on one column for other table that is > > also the join key of the table where all columns are coming from (as in the > > whiteboard). > > Vineet Garg wrote: > I have added the first test, but the one with join doesn't work > e.g. > -- transitive equivalence on pk column, therefore all other columns > shoule be removed > EXPLAIN CBO > SELECT > C_FIRST_NAME > FROM > CUSTOMER > , STORE_SALES > WHERE > C_CUSTOMER_SK = SS_CUSTOMER_SK > GROUP BY > SS_CUSTOMER_SK > , C_FIRST_NAME > , C_LAST_NAME > , C_PREFERRED_CUST_FLAG > , C_BIRTH_COUNTRY > , C_LOGIN > , C_EMAIL_ADDRESS > ; > C_CUSTOMER_SK here is key so ideally we should remove all columns from > group by except SS_CUSTOMER_EX and C_FISRT_NAME but getExpressionLineage > returs only STOERS_SALES as ref for SS_CUSTOMER_SK column. > I looked at the RelMdExpressionLineage logic for join and it doesn't look > like it take join condition into account while determining lineage.
You are right, it will need additional logic :( We can create a follow-up for that. - Jesús ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/69202/#review210362 ----------------------------------------------------------- On Nov. 7, 2018, 7:39 p.m., Vineet Garg wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/69202/ > ----------------------------------------------------------- > > (Updated Nov. 7, 2018, 7:39 p.m.) > > > Review request for hive and Jesús Camacho Rodríguez. > > > Bugs: HIVE-20804 > https://issues.apache.org/jira/browse/HIVE-20804 > > > Repository: hive-git > > > Description > ------- > > See Jira > > > Diffs > ----- > > ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java > 9aa30129b6 > > ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveRelFieldTrimmer.java > b7c31bdfca > ql/src/test/queries/clientpositive/constraints_optimization.q 70ab8509c5 > ql/src/test/results/clientpositive/llap/constraints_optimization.q.out > 96caa4d6dd > > > Diff: https://reviews.apache.org/r/69202/diff/5/ > > > Testing > ------- > > > Thanks, > > Vineet Garg > >