This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new fec8d76138 add test cases in RequestUtilsTest (#12557)
fec8d76138 is described below

commit fec8d76138c1a7d2702718f61d05385988f28da8
Author: sullis <[email protected]>
AuthorDate: Tue Mar 5 21:50:45 2024 -0800

    add test cases in RequestUtilsTest (#12557)
---
 .../pinot/common/utils/request/RequestUtilsTest.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git 
a/pinot-common/src/test/java/org/apache/pinot/common/utils/request/RequestUtilsTest.java
 
b/pinot-common/src/test/java/org/apache/pinot/common/utils/request/RequestUtilsTest.java
index edd2822751..7b32c46c98 100644
--- 
a/pinot-common/src/test/java/org/apache/pinot/common/utils/request/RequestUtilsTest.java
+++ 
b/pinot-common/src/test/java/org/apache/pinot/common/utils/request/RequestUtilsTest.java
@@ -18,7 +18,10 @@
  */
 package org.apache.pinot.common.utils.request;
 
+import org.apache.calcite.sql.SqlDialect;
 import org.apache.pinot.common.request.Expression;
+import org.apache.pinot.sql.parsers.PinotSqlType;
+import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
@@ -30,4 +33,21 @@ public class RequestUtilsTest {
     Expression literalExpression = 
RequestUtils.getLiteralExpression(Float.valueOf(0.06f));
     Assert.assertEquals((literalExpression.getLiteral().getDoubleValue()), 
0.06);
   }
+
+  @Test
+  public void testGetLiteralExpressionForPrimitiveLong() {
+    Expression literalExpression = RequestUtils.getLiteralExpression(4500L);
+    Assert.assertTrue(literalExpression.getLiteral().isSetLongValue());
+    Assert.assertFalse(literalExpression.getLiteral().isSetDoubleValue());
+    Assert.assertEquals(literalExpression.getLiteral().getLongValue(), 4500L);
+  }
+
+  @Test
+  public void testParseQuery() {
+    SqlNodeAndOptions result = RequestUtils.parseQuery("select foo from 
countries where bar > 1");
+    Assert.assertTrue(result.getParseTimeNs() > 0);
+    Assert.assertEquals(result.getSqlType(), PinotSqlType.DQL);
+    Assert.assertEquals(result.getSqlNode().toSqlString((SqlDialect) 
null).toString(),
+        "SELECT `foo`\n" + "FROM `countries`\n" + "WHERE `bar` > 1");
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to