vvivekiyer commented on code in PR #8518: URL: https://github.com/apache/pinot/pull/8518#discussion_r852297879
########## pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java: ########## @@ -191,45 +178,148 @@ public void testQuotedStrings() { @Test public void testFilterClauses() { - PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where a > 1.5"); - Function func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.GREATER_THAN.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "a"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getDoubleValue(), 1.5); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where b < 100"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.LESS_THAN.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "b"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 100L); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where c >= 10"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.GREATER_THAN_OR_EQUAL.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "c"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 10L); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where d <= 50"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.LESS_THAN_OR_EQUAL.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "d"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 50L); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where e BETWEEN 70 AND 80"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.BETWEEN.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "e"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 70L); - Assert.assertEquals(func.getOperands().get(2).getLiteral().getLongValue(), 80L); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where regexp_like(E, '^U.*')"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), "REGEXP_LIKE"); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "E"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getStringValue(), "^U.*"); - pinotQuery = CalciteSqlParser.compileToPinotQuery("select * from vegetables where g IN (12, 13, 15.2, 17)"); - func = pinotQuery.getFilterExpression().getFunctionCall(); - Assert.assertEquals(func.getOperator(), FilterKind.IN.name()); - Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "g"); - Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 12L); - Assert.assertEquals(func.getOperands().get(2).getLiteral().getLongValue(), 13L); - Assert.assertEquals(func.getOperands().get(3).getLiteral().getDoubleValue(), 15.2); - Assert.assertEquals(func.getOperands().get(4).getLiteral().getLongValue(), 17L); + { Review Comment: I'd prefer to keep this change. The test is cleaner this way. -- 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