abstractdog commented on a change in pull request #2225:
URL: https://github.com/apache/hive/pull/2225#discussion_r680923411



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/ValueBoundaryScanner.java
##########
@@ -403,26 +418,13 @@ protected int computeStartPreceding(int rowIdx, 
PTFPartition p) throws HiveExcep
       }
     }
 
-    Object rowVal = sortKey;
     int r = rowIdx;
 
-    // Use Case 4.
-    if ( expressionDef.getOrder() == Order.DESC ) {
-      while (r >= 0 && !isDistanceGreater(rowVal, sortKey, amt) ) {
-        Pair<Integer, Object> stepResult = skipOrStepBack(r, p);
-        r = stepResult.getLeft();
-        rowVal = stepResult.getRight();
-      }
-      return r + 1;
-    }
-    else { // Use Case 5.
-      while (r >= 0 && !isDistanceGreater(sortKey, rowVal, amt) ) {
-        Pair<Integer, Object> stepResult = skipOrStepBack(r, p);
-        r = stepResult.getLeft();
-        rowVal = stepResult.getRight();
-      }
-
-      return r + 1;
+    // Use Case 4,5
+    if (enableBinarySearch) {
+      return binarySearchBack(r, p, sortKey, amt, expressionDef.getOrder());

Review comment:
       sure!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to