Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@
<artifactId>RoaringBitmap</artifactId>
<version>0.9.22</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-runtime</artifactId>
<version>${hadoop.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ String format(String pattern) {
COMPLEX(ComplexChecker.class) {
@Override
String format(String pattern) {
return "^" + UDFLike.likePatternToRegExp(pattern) + "$";
return "^(?s:" + UDFLike.likePatternToRegExp(pattern) + ")$";
}
},
// Accepts chained LIKE patterns without escaping like "abc%def%ghi%" and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4540,6 +4540,37 @@ public void testStringLikeRandomized() throws HiveException {
positive, negative));
}

@Test
public void testStringLikeComplexAcrossNewline() throws HiveException {
VectorizedRowBatch vrb = VectorizedRowGroupGenUtil.getVectorizedRowBatch(1, 1, 1);
vrb.cols[0] = new BytesColumnVector(1);
BytesColumnVector bcv = (BytesColumnVector) vrb.cols[0];

String content = "header line\n" +
"review: \"I_112fc80c-a4b0-4a00-a0b5-8e4ce06bd8a8t down\"";

byte[] bytes = content.getBytes(StandardCharsets.UTF_8);

bcv.vector[0] = bytes;
bcv.start[0] = 0;
bcv.length[0] = bytes.length;

vrb.size = 1;
vrb.selectedInUse = false;
bcv.noNulls = true;
bcv.isRepeating = false;
bcv.isNull[0] = false;

byte[] pattern = "%I_112fc80c-a4b0-4a00-a0b5-8e4ce06bd8a8%"
.getBytes(StandardCharsets.UTF_8);

FilterStringColLikeStringScalar expr = new FilterStringColLikeStringScalar(0, pattern);
expr.transientInit(hiveConf);
expr.evaluate(vrb);

Assert.assertEquals(1, vrb.size);
}

@Test
public void testColConcatStringScalar() throws HiveException {

Expand Down
Loading