yaooqinn commented on code in PR #36373: URL: https://github.com/apache/spark/pull/36373#discussion_r871496811
########## sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala: ########## @@ -373,17 +306,69 @@ private[hive] class SparkExecuteStatementOperation( } object SparkExecuteStatementOperation { - def getTableSchema(structType: StructType): TableSchema = { - val schema = structType.map { field => - val attrTypeString = field.dataType match { - case CalendarIntervalType => StringType.catalogString - case _: YearMonthIntervalType => "interval_year_month" - case _: DayTimeIntervalType => "interval_day_time" - case _: TimestampNTZType => "timestamp" - case other => other.catalogString - } - new FieldSchema(field.name, attrTypeString, field.getComment.getOrElse("")) + + def toTTypeId(typ: DataType): TTypeId = typ match { + case NullType => TTypeId.NULL_TYPE + case BooleanType => TTypeId.BOOLEAN_TYPE + case ByteType => TTypeId.TINYINT_TYPE + case ShortType => TTypeId.SMALLINT_TYPE + case IntegerType => TTypeId.INT_TYPE + case LongType => TTypeId.BIGINT_TYPE + case FloatType => TTypeId.FLOAT_TYPE + case DoubleType => TTypeId.DOUBLE_TYPE + case StringType => TTypeId.STRING_TYPE + case _: DecimalType => TTypeId.DECIMAL_TYPE + case DateType => TTypeId.DATE_TYPE + // TODO: Shall use TIMESTAMPLOCALTZ_TYPE, keep AS-IS now for + // unnecessary behavior change + case TimestampType => TTypeId.TIMESTAMP_TYPE + case TimestampNTZType => TTypeId.TIMESTAMP_TYPE Review Comment: this is for rowset schema. jdbc client side can call getString to get the raw string or getObject to get an java object where it is used -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org