virajjasani commented on code in PR #1663:
URL: https://github.com/apache/phoenix/pull/1663#discussion_r1324960871


##########
phoenix-core/src/main/java/org/apache/phoenix/compile/WhereOptimizer.java:
##########
@@ -1691,8 +1691,10 @@ public KeySlots visitLeave(LikeExpression node, 
List<KeySlots> childParts) {
             KeySlots childSlots = childParts.get(0);
             KeySlot childSlot = childSlots.getSlots().get(0);
             final String startsWith = node.getLiteralPrefix();
-            SortOrder sortOrder = node.getChildren().get(0).getSortOrder();
-            byte[] key = PVarchar.INSTANCE.toBytes(startsWith, sortOrder);
+            // TODO: is there a case where we'd need to go through the 
childPart to calculate the key range?
+            PColumn column = childSlot.getKeyPart().getColumn();
+            PDataType type = column.getDataType();
+            byte[] key = PVarchar.INSTANCE.toBytes(startsWith, SortOrder.ASC);

Review Comment:
   interesting! do we support `col1 LIKE ('xy%' || col2)` case? 
   i tried this and saw that we return right here due to empty childParts:
   ```
           @Override
           public KeySlots visitLeave(LikeExpression node, List<KeySlots> 
childParts) {
               // TODO: optimize ILIKE by creating two ranges for the literal 
prefix: one with lower case, one with upper case
               if (childParts.isEmpty()) {
                   return null;
               }
   ...
   ...
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to