You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/06/03 00:05:38 UTC

[GitHub] [incubator-pinot] siddharthteotia commented on a change in pull request #6820: Add ago() scalar transform function

siddharthteotia commented on a change in pull request #6820:
URL: https://github.com/apache/incubator-pinot/pull/6820#discussion_r644394984



##########
File path: pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
##########
@@ -1690,6 +1700,23 @@ public void testCompilationInvokedFunction() {
     greaterThan = pinotQuery.getFilterExpression().getFunctionCall();
     nowTs = greaterThan.getOperands().get(1).getLiteral().getLongValue();
     Assert.assertEquals(nowTs, 1577836800000L);
+
+    query = "SELECT ago('PT1H') FROM foo";
+    lowerBound = System.currentTimeMillis() - ONE_HOUR_IN_MS;
+    pinotQuery = CalciteSqlParser.compileToPinotQuery(query);
+    nowTs = pinotQuery.getSelectList().get(0).getLiteral().getLongValue();
+    upperBound = System.currentTimeMillis() - ONE_HOUR_IN_MS;
+    Assert.assertTrue(nowTs >= lowerBound);
+    Assert.assertTrue(nowTs <= upperBound);
+
+    query = "SELECT a FROM foo where time_col > ago('PT1H')";
+    lowerBound = System.currentTimeMillis() - ONE_HOUR_IN_MS;

Review comment:
       Got it. Due to compile time value substitution, there is no need to rewrite. 




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org