Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-50991] Align the table schema column position beginning index #49671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

turboFei
Copy link
Member

@turboFei turboFei commented Jan 25, 2025

What changes were proposed in this pull request?

Align the column start position.

Why are the changes needed?

Here the column start position is 1.

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++));
}
}

Here the column start position is 0.

def toTTableSchema(schema: StructType): TTableSchema = {
val tTableSchema = new TTableSchema()
CharVarcharUtils.getRawSchema(schema).zipWithIndex.foreach { case (f, i) =>
tTableSchema.addToColumns(toTColumnDesc(f, i))
}
tTableSchema
}

Does this PR introduce any user-facing change?

No.

How was this patch tested?

GA.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Jan 25, 2025
@turboFei turboFei changed the title align the column index start [SPARK-XXX] Align the column index start Jan 25, 2025
@turboFei turboFei changed the title [SPARK-XXX] Align the column index start [SPARK-XXX] Align the table schema column position beginning index Jan 25, 2025
@turboFei turboFei changed the title [SPARK-XXX] Align the table schema column position beginning index [SPARK-50991] Align the table schema column position beginning index Jan 25, 2025
Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants