File tree Expand file tree Collapse file tree
ppl/src/test/java/org/opensearch/sql/ppl/calcite Expand file tree Collapse file tree Original file line number Diff line number Diff 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 "
You can’t perform that action at this time.
0 commit comments