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

Use ArrayListMultimap when values are ColumnValue #5855

Merged
merged 3 commits into from
Jan 21, 2022

Conversation

pkoenig10
Copy link
Member

ColumnValue values do not override equals and are compared using reference equality. When creating multimaps with ColumnValue values we can just use ArrayListMultimap to avoid the comparison overhead (and we shouldn't be using reference equality anyways).

This matches the behavior of getAffectedCells, which also uses an ArrayListMultimap to store a multimap with ColumnValue values.

.map(entry -> entry.getTableName() + "Table")
.collect(Collectors.toList());
String schemaName = ApiTestSchema.getSchema().getName();
checkIfFilesAreTheSame(schemaName + "TableFactory");
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously this test was not testing the generated table factory. This explains why tests didn't break in #5843.

I've updated this test to ensure we're testing all generated files.


private String readFileIntoString(File baseDir, String path) throws IOException {
return new String(Files.toByteArray(new File(baseDir, path)), StandardCharsets.UTF_8);
assertThat(expectedFile).hasSameTextualContentAs(actualFile);
Copy link
Member Author

Choose a reason for hiding this comment

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

Simplified tests to use AssertJ's AbstractFileAssert instead of our hand-rolled line-based comparison.

Copy link
Contributor

Choose a reason for hiding this comment

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

nice, thanks! yeah that makes sense :)

@@ -110,6 +110,7 @@ public TableClassRendererV2(String packageName, Namespace namespace, String rawT

public String render() {
JavaFile javaFile = JavaFile.builder(packageName, this.buildTypeSpec())
.skipJavaLangImports(true)
Copy link
Member Author

Choose a reason for hiding this comment

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

return Renderers.CamelCase(index.getIndexName());
} else {
public static String getIndexTableName(IndexMetadata index) {
if (index.getJavaIndexName() != null) {
Copy link
Member Author

@pkoenig10 pkoenig10 Jan 13, 2022

Choose a reason for hiding this comment

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

Small refactor for consistency with getClassTableName

Copy link
Contributor

@jeremyk-91 jeremyk-91 left a comment

Choose a reason for hiding this comment

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

👍 this looks good. Thanks for the contribution!


private String readFileIntoString(File baseDir, String path) throws IOException {
return new String(Files.toByteArray(new File(baseDir, path)), StandardCharsets.UTF_8);
assertThat(expectedFile).hasSameTextualContentAs(actualFile);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, thanks! yeah that makes sense :)

@bulldozer-bot bulldozer-bot bot merged commit cb0c5b1 into develop Jan 21, 2022
@bulldozer-bot bulldozer-bot bot deleted the pkoenig10/columnValue branch January 21, 2022 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants