juliuszsompolski commented on a change in pull request #29539:
URL: https://github.com/apache/spark/pull/29539#discussion_r478214772



##########
File path: 
sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2Suites.scala
##########
@@ -686,6 +686,23 @@ class HiveThriftBinaryServerSuite extends 
HiveThriftJdbcTest {
     }
   }
 
+  test("Query Intervals in VIEWs through thrift server") {
+    val viewName1 = "view_interval_1"
+    val viewName2 = "view_interval_2"
+    val ddl1 = s"CREATE GLOBAL TEMP VIEW $viewName1 AS SELECT INTERVAL 1 DAY 
AS i"
+    val ddl2 = s"CREATE TEMP VIEW $viewName2 as select * from 
global_temp.$viewName1"
+    withJdbcStatement(viewName1, viewName2) { statement =>
+      statement.executeQuery(ddl1)
+      statement.executeQuery(ddl2)
+      val rs = statement.executeQuery(s"SELECT v1.i as a, v2.i as b FROM 
global_temp.$viewName1" +

Review comment:
       What will be returned by rs.getMetadata.getColumnType for the interval 
column?
   I believe that will be a string, because of how we just make it a string in 
the output schema in 
https://github.com/apache/spark/blob/master/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala#L362
   
   There was a discussion last year in 
https://github.com/apache/spark/pull/25694#discussion_r321972811, that because 
the interval is just returned as string in the query output schema, and not 
compliant to standard SQL interval types, it should not be listed by 
SparkGetTypeInfoOperation, and be treated just as strings.
   
   If we want to make it be returned as a java.sql.Types.OTHER, to make this 
complete, it should be returned as such in result set metadata as well, and 
listed in SparkGetTypeInfoOperation.
   Or we could map it to string.




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

Reply via email to