Fei Wang created SPARK-50991:
--------------------------------

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


[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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to