wangyum commented on a change in pull request #25277: [SPARK-28637][SQL]
Thriftserver support interval type
URL: https://github.com/apache/spark/pull/25277#discussion_r317861601
##########
File path:
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala
##########
@@ -308,7 +311,11 @@ private[hive] class SparkExecuteStatementOperation(
object SparkExecuteStatementOperation {
def getTableSchema(structType: StructType): TableSchema = {
val schema = structType.map { field =>
- val attrTypeString = if (field.dataType == NullType) "void" else
field.dataType.catalogString
+ val attrTypeString = field.dataType match {
+ case NullType => "void"
+ case CalendarIntervalType => "string"
+ case other => other.catalogString
Review comment:
This is because `Type` does not have a type mapping to our
`CalendarIntervalType`:
https://github.com/apache/spark/blob/02c33694c8254f69cb36c71c0876194dccdbc014/sql/hive-thriftserver/v1.2.1/src/main/java/org/apache/hive/service/cli/Type.java#L31-L105
Otherwise:
```java
Caused by: java.lang.IllegalArgumentException: Unrecognized type name:
interval
at org.apache.hive.service.cli.Type.getType(Type.java:169)
at
org.apache.hive.service.cli.TypeDescriptor.<init>(TypeDescriptor.java:53)
at
org.apache.hive.service.cli.ColumnDescriptor.<init>(ColumnDescriptor.java:53)
at org.apache.hive.service.cli.TableSchema.<init>(TableSchema.java:52)
at
org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation$.getTableSchema(SparkExecuteStatementOperation.scala:321)
at
org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation.resultSchema$lzycompute(SparkExecuteStatementOperation.scala:70)
at
org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation.resultSchema(SparkExecuteStatementOperation.scala:65)
at
org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation.getResultSetSchema(SparkExecuteStatementOperation.scala:161)
at
org.apache.hive.service.cli.operation.OperationManager.getOperationResultSetSchema(OperationManager.java:209)
at
org.apache.hive.service.cli.session.HiveSessionImpl.getResultSetMetadata(HiveSessionImpl.java:773)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:78)
```
----------------------------------------------------------------
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]