juliuszsompolski commented on a change in pull request #25694: 
[SPARK-28982][SQL] Implementation Spark's own GetTypeInfoOperation
URL: https://github.com/apache/spark/pull/25694#discussion_r322267021
 
 

 ##########
 File path: 
sql/hive-thriftserver/v2.3.5/src/main/scala/org/apache/spark/sql/hive/thriftserver/ThriftserverShimUtils.scala
 ##########
 @@ -56,6 +56,12 @@ private[thriftserver] object ThriftserverShimUtils {
 
   private[thriftserver] def toJavaSQLType(s: String): Int = 
Type.getType(s).toJavaSQLType
 
+  private[thriftserver] def supportedType(): Seq[Type] = {
+    Array(Type.NULL_TYPE, Type.BOOLEAN_TYPE, Type.TINYINT_TYPE, 
Type.SMALLINT_TYPE, Type.INT_TYPE,
+      Type.BIGINT_TYPE, Type.FLOAT_TYPE, Type.DOUBLE_TYPE, Type.STRING_TYPE, 
Type.DATE_TYPE,
+      Type.TIMESTAMP_TYPE, Type.DECIMAL_TYPE, Type.BINARY_TYPE)
+  }
 
 Review comment:
   So if I run this:
   ```
   Class.forName("org.apache.hive.jdbc.HiveDriver")
   val jdbc_url = "jdbc:hive2://localhost:10000/default;httpPath=cliservice"
   val conn = DriverManager.getConnection(jdbc_url)
   val stmt = conn.prepareStatement("select collect_list(id) as arr from 
range(10)")
   val rs = stmt.executeQuery()
   val md = rs.getMetaData()
   ```
   and then:
   ```
   scala> md.getColumnType(1)
   res2: Int = 2003
   
   scala> java.sql.Types.ARRAY
   res3: Int = 2003
   
   scala> rs.next()
   res4: Boolean = true
   
   scala> rs.getArray(1)
   java.sql.SQLException: Method not supported
     at 
org.apache.hive.jdbc.HiveBaseResultSet.getArray(HiveBaseResultSet.java:113)
     ... 33 elided
   
   scala> rs.getString(1)
   res6: String = [0,1,2,3,4,5,6,7,8,9]
   ```
   Assuming that it's a generic JDBC application, not specific to Hive quirks, 
how is that application supposed to know that after getting a `getColumnType` 
of `Types.Array`, it needs to retrieve it with `getString`, and not with 
`getArray`?

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

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

Reply via email to