siddharthteotia commented on code in PR #8518: URL: https://github.com/apache/pinot/pull/8518#discussion_r849076687
########## pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java: ########## @@ -2246,6 +2246,19 @@ public void testFlattenAndOr() { } } + { + String query = "SELECT * FROM foo WHERE col1 > 0 AND (col2 AND col3 > 0) AND startsWith(col4, 'myStr')"; + PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(query); + Function functionCall = pinotQuery.getFilterExpression().getFunctionCall(); + Assert.assertEquals(functionCall.getOperator(), FilterKind.AND.name()); + List<Expression> operands = functionCall.getOperands(); + Assert.assertEquals(operands.size(), 4); + Assert.assertEquals(operands.get(0).getFunctionCall().getOperator(), FilterKind.GREATER_THAN.name()); + Assert.assertEquals(operands.get(1).getFunctionCall().getOperator(), FilterKind.EQUALS.name()); + Assert.assertEquals(operands.get(2).getFunctionCall().getOperator(), FilterKind.GREATER_THAN.name()); + Assert.assertEquals(operands.get(3).getFunctionCall().getOperator(), FilterKind.EQUALS.name()); Review Comment: (nit) for the part that is being rewritten `startsWith(col4, 'myStr')`, we may want to assert for both LHS and RHS (esp RHS) So in above test, for the 4th operand we are only checking for operator EQUALS. Would be good to check LHS is startsWith and RHS is true -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org