>From Ali Alsuliman <[email protected]>:

Attention is currently required from: Peeyush Gupta, Ayush Tripathi.
Ali Alsuliman has posted comments on this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064 )

Change subject: [ASTERIXDB-3525][COMP] Fixing issue when trailing % is after 
escaping Method
......................................................................


Patch Set 6:

(17 comments)

File 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/like-expression/like-expression.23.query.sqlpp:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/bb23f290_b6a0f646
PS6, Line 18: */
Include:
x like "abc\\%%" which basically matches abc%(any_char+)
x like "abc\\_%" which basically matches abc_(any_char+)
x like "abc\\%_" which basically matches abc%(any_char)
x like "abc\\__" which basically matches abc_(any_char)


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/4f3c0d4f_3ca06850
PS6, Line 20: {"x":"fvxb%"}
Include another object that does (or does not) match.


File 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/index-selection/like-expression/like-expression.24.query.sqlpp:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/98c4f570_13bcf44d
PS6, Line 22: h\\\\axx\\%
Add few more tests like:
"h\\\\axx\\\\%"
"h\\\\axx\\\\\\%"
"abc\\_%"
"abc\\%%"


File 
asterixdb/asterix-app/src/test/resources/runtimets/results_column/index-selection/like-expression/like-expression.23.adm:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/96794fa3_4481a148
PS6, Line 1: { "p": { "x": "fvxb%" } }
           : { "p": { "x": "fv%%\\bn\\%" } }
           :
           : { "p": { "x": "fv%xbx" } }
           : { "p": { "x": "a\\%bcd" } }
           : { "p": { "x": "abc\n%" } }
           : { "p": { "x": "abc\n%" } }
Why do we need this file? The result should be the same for all: CBO, Columnar, 
and regular


File 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/ConstantUtil.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/8796e0a5_126a1979
PS6, Line 26: likeEscapeChar
Rename to LIKE_ESCAPE


File 
asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/OperatorExpressionVisitor.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/33ceff79_1578c38e
PS6, Line 98: public Triple<Boolean,Boolean, String>
Move this method to the bottom. Make it private static. Make it return an enum. 
Define the enum at the bottom:
    enum LikePattern {
        PREFIX,
        EQUAL
    }


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/31288af4_9e5686ae
PS6, Line 99: if (pattern==null) {
            :             return new Triple<>(false,false,null);
            :         }
            :         StringBuilder tempStringBuilder = new StringBuilder();
            :         tempStringBuilder.setLength(0);
Remove these.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/09bd0c5c_eaa36f9a
PS6, Line 104: Boolean isLastPercentPlaceholder = false;
Change this to: LikePattern likePattern = EQUAL;


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/890ec16b_c9d4e6ab
PS6, Line 110: '%' && nextChar != '_'
Use UNDERSCORE & PERCENT. You can change them from String to char. If you still 
need them as a string define new UNDERSCORE_STR & PERCENT_STR.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/b0216ba1_3683f21c
PS6, Line 112: try {
return null;


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/e3651c07_08a1c08b
PS6, Line 118: if (nextChar =='%' && i == pattern.length() - 1 ) {
Why do we need this?
Also, i == pattern.length() - 1 will never be true since we are bailing out 
just before it.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/0697a9f0_ecb70d61
PS6, Line 124: isLastPercentPlaceholder = true;
likePattern = PREFIX;


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/129b8a4e_b948cb97
PS6, Line 125: && i < pattern.length() - 1
This && i < pattern.length() - 1 can be removed.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/c13b0ac7_f6f137bb
PS6, Line 126: return new Triple<>(false, false, null);
return null;


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/f70669c3_6a65e973
PS6, Line 131: return new Triple<>(true, isLastPercentPlaceholder, 
tempStringBuilder.toString());
return likePattern


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/66a563f5_85cb4d79
PS6, Line 135: CallExpr likeExpr =
Remove these lines. We don't need them.
In case NOT_LIKE: replace "likeExpr" with "createLikeExpression(operatorExpr)"


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064/comment/e00751cf_598eabd5
PS6, Line 144: Triple<Boolean,Boolean, String> processedPattern = 
processPattern(patternStr);
We should change this accordingly now.
if (patternStr != null) {
  StringBuilder likePatternStr = new StringBuilder();
  LikePattern likePattern = processPattern(patternStr, likePatternStr);
  if (likePattern == PREFIX) {}
}



--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/19064
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I88661621467405cf2b37da6dcb81015467d7d759
Gerrit-Change-Number: 19064
Gerrit-PatchSet: 6
Gerrit-Owner: Ayush Tripathi <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Peeyush Gupta <[email protected]>
Gerrit-CC: Murtadha Hubail <[email protected]>
Gerrit-Attention: Peeyush Gupta <[email protected]>
Gerrit-Attention: Ayush Tripathi <[email protected]>
Gerrit-Comment-Date: Wed, 20 Nov 2024 01:03:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Reply via email to