Github user nonstop-qfchen commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/255#discussion_r49478560
--- Diff: core/sql/src/main/java/org/trafodion/sql/HTableClient.java ---
@@ -358,6 +365,417 @@ void resetAutoFlush() {
table.setAutoFlush(true, true);
}
+ private enum Op {
+ EQUAL, EQUAL_NULL, NOT_EQUAL, NOT_EQUAL_NULL, LESS, LESS_NULL,
LESS_OR_EQUAL, LESS_OR_EQUAL_NULL, GREATER, GREATER_NULL,
+ GREATER_OR_EQUAL, GREATER_OR_EQUAL_NULL, NO_OP,
NO_OP_NULL,IS_NULL, IS_NULL_NULL, IS_NOT_NULL, IS_NOT_NULL_NULL, AND, OR};
+
+ private Filter SingleColumnValueExcludeOrNotFilter(byte[]
columnToFilter,
+
CompareOp op,
+
ByteArrayComparable comparator,
+
HashMap<String,Object> columnsToRemove,
+
Boolean... filterIfMissing){
+ Filter result;
+ boolean fMissing =
filterIfMissing.length>0?filterIfMissing[0]:false;//default to false
+ if ((columnsToRemove == null) ||
!columnsToRemove.containsKey(new String(columnToFilter))){
+ result = new
SingleColumnValueFilter(getFamily(columnToFilter), getName(columnToFilter), op,
comparator);
+
((SingleColumnValueFilter)result).setFilterIfMissing(fMissing);
+ }
+ else{
+ result= new
SingleColumnValueExcludeFilter(getFamily(columnToFilter),
getName(columnToFilter), op, comparator);
+
((SingleColumnValueExcludeFilter)result).setFilterIfMissing(fMissing);
+ }
+ return result;
+ }
+
+ // construct the hbase filter
+ // optimizes for OR and AND associativity
+ // optimizes for detection of a<? and a>? on nullable and non nullable
column equivalent to a<>?
+ // optimize for null check factorization (A not null and (A <op> ?)) or
(A not null and A <op2> ?) -> A not null and (A <op> ? or A <op2> ?)
+ // this is an important optimzation for IN statement on
non null column
+ // uses the columnToRemove parametter to know if we need to use the
SingleColumnValue Exclude or not method to limit returned columns
+
+ private Filter constructV2Filter(Object[] colNamesToFilter,
+ Object[] compareOpList,
+ Object[] colValuesToCompare,
+ HashMap<String,Object> columnsToRemove){
+ LinkedList linkedList = new LinkedList();
+ //populate the list with nodes in reverse polish notation order.
+ int k=0;//column index
+ int kk=0;//value index
--- End diff --
Better name these variables more precisely such as colIndex, valIndex.
---
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.
---