jineshparakh commented on code in PR #18444:
URL: https://github.com/apache/pinot/pull/18444#discussion_r3279012635
##########
pinot-query-runtime/src/test/resources/queries/MathFuncs.json:
##########
@@ -511,5 +511,285 @@
"sql": "SELECT longCol / 1e20 FROM {numTbl}"
}
]
+ },
+ "unary_minus": {
Review Comment:
Done
##########
pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java:
##########
@@ -1101,6 +1101,236 @@ public void
testPolymorphicArithmeticScalarFunctionsCompile() {
Assert.assertEquals(selectList.get(4).getFunctionCall().getOperator(),
"moduloorzero");
}
+ @Test
+ public void testUnaryMinusSyntaxCompilesAsNegate() {
+ // -col should produce negate(col), not a binary subtraction
+ PinotQuery pinotQuery = compileToPinotQuery("SELECT -col1 FROM myTable");
+ Expression expr = pinotQuery.getSelectList().get(0);
+ Assert.assertEquals(expr.getFunctionCall().getOperator(), "negate");
+
Assert.assertEquals(expr.getFunctionCall().getOperands().get(0).getIdentifier().getName(),
"col1");
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]