Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/255#discussion_r49487630
  
    --- Diff: core/sql/generator/GenPreCode.cpp ---
    @@ -11274,6 +11274,485 @@ short 
HbaseAccess::extractHbaseFilterPreds(Generator * generator,
       return 0;
     }
     
    
+////////////////////////////////////////////////////////////////////////////
    +// To push down, the predicate must have the following form:
    +//  xp:=  <column>  <op>  <value-expr>
    +//  xp:=  <column> is not null (no support for hbase lookup)
    +//  xp:=  <column> is null (no support for hbase lookup)
    +//           (xp:=<column> like <value-expr> not yet implemented)
    +//  xp:=<xp> OR <xp> (not evaluated in isHbaseFilterPredV2, but by 
extractHbaseFilterPredV2)
    +//  xp:=<xp> AND <xp>(not evaluated in isHbaseFilterPredV2, but by 
extractHbaseFilterPredV2)
    +//
    +// and all of the following conditions must be met:
    +//
    +//      <column>:       a base table or index column which can be 
serialized and belong to the table being scanned.
    +//                            serialized: either the column doesn't need 
encoding, like
    +//                                            an unsigned integer,  or the 
column
    +//                                            was declared with the 
SERIALIZED option.
    +//                                         it also must not be an added 
column with default non null.
    +//      <op>:              eq, ne, gt, ge, lt, le
    +//      <value-expr>:  an expression that only contains const or param 
values, and
    +//                     <value-expr>'s datatype is not a superset of 
<column>'s datatype.
    +//
    
+/////////////////////////////////////////////////////////////////////////////
    +NABoolean HbaseAccess::isHbaseFilterPredV2(Generator * generator, ItemExpr 
* ie,
    +                                    ValueId &colVID, ValueId &valueVID,
    +                                    NAString &op)
    +{
    +  NABoolean foundBinary = FALSE;
    +  NABoolean foundUnary = FALSE;
    +  NABoolean hbaseLookupPred = FALSE;
    +  NABoolean flipOp = FALSE;  // set to TRUE when column is child(1)
    +
    +  if (ie &&
    +      ((ie->getOperatorType() >= ITM_EQUAL) &&
    +       (ie->getOperatorType() <= ITM_GREATER_EQ))) //binary operator case
    +    {//begin expression
    +      ItemExpr * child0 = ie->child(0)->castToItemExpr();
    +      ItemExpr * child1 = ie->child(1)->castToItemExpr();
    +
    +      if ((ie->child(0)->getOperatorType() == ITM_BASECOLUMN) &&
    +     (NOT hasColReference(ie->child(1))))
    --- End diff --
    
    hasColReference() does not filter out functions. I think it would return 
FALSE for expressions like sin(0.5) or ? + 3 > 10. If we generate an expression 
to compute this value before passing it to the filter then that's ok. I didn't 
see that code generation in your change, probably it is already done in the 
existing V1 logic.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to