You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/05/08 00:29:00 UTC
[jira] [Updated] (SPARK-50991) Align the table schema column position beginning index
[ https://issues.apache.org/jira/browse/SPARK-50991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated SPARK-50991:
-----------------------------------
Labels: pull-request-available (was: )
> Align the table schema column position beginning index
> ------------------------------------------------------
>
> Key: SPARK-50991
> URL: https://issues.apache.org/jira/browse/SPARK-50991
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.5.4
> Reporter: Fei Wang
> Priority: Major
> Labels: pull-request-available
>
> [https://github.com/apache/spark/blob/master/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/TableSchema.java#L50]
>
> Here the column start position is 1.
> {code:java}
> public TableSchema(List<FieldSchema> fieldSchemas) {
> int pos = 1;
> for (FieldSchema field : fieldSchemas) {
> columns.add(new ColumnDescriptor(field.getName(), field.getComment(),
> new TypeDescriptor(field.getType()), pos++));
> }
> }
> {code}
> [https://github.com/apache/spark/blob/master/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkExecuteStatementOperation.scala#L398]
>
> Here, the column start position is 0.
> {code:java}
> def toTTableSchema(schema: StructType): TTableSchema = {
> val tTableSchema = new TTableSchema()
> CharVarcharUtils.getRawSchema(schema).zipWithIndex.foreach { case (f, i) =>
> tTableSchema.addToColumns(toTColumnDesc(f, i))
> }
> tTableSchema
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org