danny0405 commented on a change in pull request #1066: [CALCITE-2843] Babel 
parser should support PostgreSQL casting operator '::'
URL: https://github.com/apache/calcite/pull/1066#discussion_r300819435
 
 

 ##########
 File path: babel/src/test/java/org/apache/calcite/test/BabelTest.java
 ##########
 @@ -51,6 +57,18 @@ static Connection connect() throws SQLException {
   @Test public void testFoo() {
     assertThat(1 + 1, is(2));
   }
+
+  @Test public void testPostgreSQLCastingOp() throws SQLException {
+    Connection connection = connect();
+    Statement statement = connection.createStatement();
+    assertTrue(statement
+        .execute("SELECT x::integer FROM (VALUES ('1', '2')) as tbl(x,y)"));
+    ResultSet resultSet = statement.getResultSet();
+
+    ResultSetMetaData metaData = resultSet.getMetaData();
+    assertEquals("Invalid column count", 1, metaData.getColumnCount());
+    assertEquals("Invalid column type", Types.INTEGER, 
metaData.getColumnType(1));
+  }
 
 Review comment:
   Add enough test

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to