Skip to content

Core: ensure sort order and specs exist in v2 when parsing table metadata - #1614

Merged
rdblue merged 2 commits into
apache:masterfrom
yyanyy:tablemetadataparser_validation
Nov 1, 2020
Merged

rdblue merged 2 commits into
apache:masterfrom
yyanyy:tablemetadataparser_validation

Conversation

@yyanyy

@yyanyy yyanyy commented Oct 14, 2020 •

Copy link
Copy Markdown
Contributor

For tests, created a new folder testfiles to store json strings used for testing TableMetadataParser.fromJson.
This should fix #1419

@yyanyy yyanyy changed the title Core: ensure sort order and specs exist in v2 when parsing table metadata (#1419) Core: ensure sort order and specs exist in v2 when parsing table metadata Oct 26, 2020
}
return writer.toString();
private String readTableMetadataInputFile(String fileName) throws IOException {
Path path = Paths.get(new File("").getAbsolutePath(), "src/test/testfiles", fileName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the test files should be in src/test/resources so that ClassLoader.getResource can be used to read. That is usually a better way to find fixtures because it avoids assuming the current working directory of the build.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review! Using ClassLoader.getResource is definitely cleaner. Updated.

@rdblue

rdblue commented Oct 28, 2020

Copy link
Copy Markdown
Contributor

Looks good to me, other than assuming the working directory for the build. Could you update the test to find files in src/test/resources instead?

@rdblue
rdblue merged commit 330f152 into apache:master Nov 1, 2020
@rdblue

rdblue commented Nov 1, 2020

Copy link
Copy Markdown
Contributor

Thanks, @yyanyy! I merged this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add checks to TableMetadataParser to ensure sort order and spec lists are present in v2

2 participants