AngersZhuuuu 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_r322276355
##########
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:
@juliuszsompolski
In hive jdbc method. It will final treat ARRAY, MAP, STRUCT ..etc as String
Type:
```
static String columnClassName(Type hiveType, JdbcColumnAttributes
columnAttributes)
throws SQLException {
int columnType = hiveTypeToSqlType(hiveType);
switch(columnType) {
case Types.NULL:
return "null";
case Types.BOOLEAN:
return Boolean.class.getName();
case Types.CHAR:
case Types.VARCHAR:
return String.class.getName();
case Types.TINYINT:
return Byte.class.getName();
case Types.SMALLINT:
return Short.class.getName();
case Types.INTEGER:
return Integer.class.getName();
case Types.BIGINT:
return Long.class.getName();
case Types.DATE:
return Date.class.getName();
case Types.FLOAT:
return Float.class.getName();
case Types.DOUBLE:
return Double.class.getName();
case Types.TIMESTAMP:
return Timestamp.class.getName();
case Types.DECIMAL:
return BigInteger.class.getName();
case Types.BINARY:
return byte[].class.getName();
case Types.OTHER:
case Types.JAVA_OBJECT: {
switch (hiveType) {
case INTERVAL_YEAR_MONTH_TYPE:
return HiveIntervalYearMonth.class.getName();
case INTERVAL_DAY_TIME_TYPE:
return HiveIntervalDayTime.class.getName();
default:
return String.class.getName();
}
}
case Types.ARRAY:
case Types.STRUCT:
return String.class.getName();
default:
throw new SQLException("Invalid column type: " + columnType);
}
}
```
----------------------------------------------------------------
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]