siddharthteotia commented on a change in pull request #6820:
URL: https://github.com/apache/incubator-pinot/pull/6820#discussion_r636275572
##########
File path:
pinot-broker/src/test/java/org/apache/pinot/broker/requesthandler/LiteralOnlyBrokerRequestTest.java
##########
@@ -76,18 +77,28 @@ public void testNumberLiteralBrokerRequestFromSQL() {
public void testLiteralOnlyTransformBrokerRequestFromSQL() {
Assert
.assertTrue(BaseBrokerRequestHandler.isLiteralOnlyQuery(CalciteSqlParser.compileToPinotQuery("SELECT
now()")));
+ Assert.assertTrue(
+
BaseBrokerRequestHandler.isLiteralOnlyQuery(CalciteSqlParser.compileToPinotQuery("SELECT
ago('PT1H')")));
Assert.assertTrue(BaseBrokerRequestHandler.isLiteralOnlyQuery(
CalciteSqlParser.compileToPinotQuery("SELECT now(),
fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z')")));
+ Assert.assertTrue(BaseBrokerRequestHandler.isLiteralOnlyQuery(
+ CalciteSqlParser.compileToPinotQuery("SELECT ago('PT1H'),
fromDateTime('2020-01-01 UTC', 'yyyy-MM-dd z')")));
Assert.assertTrue(
BaseBrokerRequestHandler.isLiteralOnlyQuery(CalciteSqlParser.compileToPinotQuery("SELECT
now() FROM myTable")));
+ Assert.assertTrue(BaseBrokerRequestHandler
+ .isLiteralOnlyQuery(CalciteSqlParser.compileToPinotQuery("SELECT
ago('PT1H') FROM myTable")));
Assert.assertTrue(BaseBrokerRequestHandler.isLiteralOnlyQuery(CalciteSqlParser
.compileToPinotQuery("SELECT now(), fromDateTime('2020-01-01 UTC',
'yyyy-MM-dd z') FROM myTable")));
+
Assert.assertTrue(BaseBrokerRequestHandler.isLiteralOnlyQuery(CalciteSqlParser
+ .compileToPinotQuery("SELECT ago('PT1H'), fromDateTime('2020-01-01
UTC', 'yyyy-MM-dd z') FROM myTable")));
Review comment:
Basically if ago() is used in selects along with other scalar functions,
then the result can be computed at compile time and returned. So
isLiteralOnlyQuery will return true. However, if it is used in filters then the
ago() result can be computed at compile time but the query result can't be
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]