Skip to content

Conversation

@ahmedabu98
Copy link
Contributor

@ahmedabu98 ahmedabu98 commented Nov 23, 2022

TypedSchemaTransformProvider::configurationSchema returns an inconsistently ordered Schema object. A consistent Schema is needed to use configuration Row objects to instantiate and build SchemaTransforms. The solution in this PR is to sort the fields by name.

Fixes #24361

@github-actions github-actions bot added the java label Nov 23, 2022
@ahmedabu98 ahmedabu98 marked this pull request as ready for review November 23, 2022 23:09
@ahmedabu98
Copy link
Contributor Author

R: @chamikaramj

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks.

@chamikaramj
Copy link
Contributor

Let's also create a Github issue to track this.

@ahmedabu98
Copy link
Contributor Author

R: @chamikaramj
Thanks for the feedback, PTAL. I thought the sort code belongs in the Schema class, lmk what you think.

@ahmedabu98
Copy link
Contributor Author

Fixes #24361

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks.

@Internal
@Experimental(Kind.SCHEMAS)
@SuppressWarnings({
"nullness" // TODO(https://github.com/apache/beam/issues/20506)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the error you got here ? We should try to fix checker-framework warnings in new code instead of surpassing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer running into this now that sorting method is in Schema.java, will remove


/** Returns an identical Schema with sorted fields. */
public Schema sorted() {
Schema sortedSchema =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add an assertion or a unit test that will break if any new properties are added to the Schema object that are not copied over here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, PTAL

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@chamikaramj
Copy link
Contributor

@ahmedabu98
Copy link
Contributor Author

Jacoco creates synthetic fields when it runs, which get picked up by Class::getDeclaredFields.

@ahmedabu98
Copy link
Contributor Author

Run Java PreCommit

2 similar comments
@chamikaramj
Copy link
Contributor

Run Java PreCommit

@ahmedabu98
Copy link
Contributor Author

Run Java PreCommit

@chamikaramj chamikaramj merged commit 4718cdf into apache:master Dec 1, 2022
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.

TypedSchemaTransformProvider returns an inconsistent configuration Schema object

2 participants