Skip to content

Commit 5ed5d3a

Browse files
committed
fix ut
Signed-off-by: Lantao Jin <ltjin@amazon.com>
1 parent 6b13033 commit 5ed5d3a

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

ppl/src/test/java/org/opensearch/sql/ppl/calcite/CalcitePPLStringFunctionTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,27 @@ public void testToStringDuration() {
283283
public void testLike() {
284284
String ppl = "source=EMP | where like(JOB, 'SALE%') | stats count() as cnt";
285285
RelNode root = getRelNode(ppl);
286+
String expectedLogical =
287+
""
288+
+ "LogicalAggregate(group=[{}], cnt=[COUNT()])\n"
289+
+ " LogicalFilter(condition=[LIKE($2, 'SALE%', '\\')])\n"
290+
+ " LogicalTableScan(table=[[scott, EMP]])\n";
291+
verifyLogical(root, expectedLogical);
292+
String expectedResult = "cnt=4\n";
293+
verifyResult(root, expectedResult);
294+
295+
String expectedSparkSql =
296+
""
297+
+ "SELECT COUNT(*) `cnt`\n"
298+
+ "FROM `scott`.`EMP`\n"
299+
+ "WHERE `JOB` LIKE 'SALE%' ESCAPE '\\'";
300+
verifyPPLToSparkSQL(root, expectedSparkSql);
301+
}
302+
303+
@Test
304+
public void testILike() {
305+
String ppl = "source=EMP | where ilike(JOB, 'SALE%') | stats count() as cnt";
306+
RelNode root = getRelNode(ppl);
286307
String expectedLogical =
287308
""
288309
+ "LogicalAggregate(group=[{}], cnt=[COUNT()])\n"

0 commit comments

Comments
 (0)