Hi, all!
          I am an engineering working in alibaba, could i ask you a question?
          One of my sqls runs failed during the phase of getPlan, because it is 
regarded as containing an inequality join, but in fact it is'nt.
          I found that there is a condition "!remaining.isAlwaysTrue()" in line 
253 of JoinUtils.java, and there is a line of comment "for practical purposes 
these cases could be treated as inequality" in line 254 .
          If i remove the condition "!remaining.isAlwaysTrue()",then my sql 
runs well in drill.
          So my question is "Why remaining.isAlwaysTrue() is necessary in 
JoinUtils.getJoinCategory?", could you show me a sql?

Thank you!

Jianqing Fu



JoinUtils.getJoinCategory in Drill:

public static JoinCategory getJoinCategory(RelNode left, RelNode right, RexNode 
condition,
         List<Integer> leftKeys, List<Integer> rightKeys, List<Boolean> 
filterNulls) {
         if (condition.isAlwaysTrue()) {
                  return JoinCategory.CARTESIAN;
         }
         leftKeys.clear();
         rightKeys.clear();
         filterNulls.clear();
         RexNode remaining = RelOptUtil.splitJoinCondition(left, right, 
condition, leftKeys, rightKeys, filterNulls);

         if (!remaining.isAlwaysTrue() || (leftKeys.size() == 0 || 
rightKeys.size() == 0) ) {
                  // for practical purposes these cases could be treated as 
inequality
                  return JoinCategory.INEQUALITY;
         }
         return JoinCategory.EQUALITY;
} 


My SQL:

select * from
odps.tbbi.dim_tm_fans_brand_info a
left join (select * from odps.tbcdm.dim_tb_cate where ds='20180514')b
on a.ds = b.ds
and a.brand_id = '20021'
where a.ds='20180514'
limit 1

Reply via email to