Skip to content

Conversation

@ajantha-bhat
Copy link
Member

@ajantha-bhat ajantha-bhat commented Jul 19, 2023

TestReadProjection.java in iceberg-parquet module is an exact duplicate of iceberg-core module's TestReadProjection.java. iceberg-parquet module can directly extend a test class from iceberg-core as it already depends on test artifacts.

Note: Empty struct is supported for iceberg-core avro readers (#2953).
That time 5 new testcases were added. which won't work for parquet readers.

@ajantha-bhat ajantha-bhat changed the title Remove duplicate testcases from iceberg-parquet Remove duplicate test code from iceberg-parquet Jul 19, 2023
@ajantha-bhat ajantha-bhat changed the title Remove duplicate test code from iceberg-parquet Parquet: Remove duplicate test code Jul 19, 2023
@nastra
Copy link
Contributor

nastra commented Jul 19, 2023

@ajantha-bhat can you rebase please?

@ajantha-bhat
Copy link
Member Author

@ajantha-bhat can you rebase please?

Done. I would have saved some effort on #8056 if I have found it earlier.
Since, this PR removes one of the file it just refactored :)

@coded9
Copy link
Contributor

coded9 commented Jul 20, 2023

@ajantha-bhat I found it the day before merging the PR when I observed package collisions. I wanted to handle it in a separate PR after discussion with @nastra. Thanks for this PR.

protected GenericData.Record writeAndRead(
String desc, Schema writeSchema, Schema readSchema, GenericData.Record record)
throws IOException {
File file = temp.resolve(desc + ".parquet").toFile();
Copy link
Member Author

Choose a reason for hiding this comment

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

This was modified by #8056.
Hence, reverting this line and making it compatible with parent class in iceberg-core

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to first switch TestReadProjection from iceberg-core to JUnit5 and then removing TestReadProjection from iceberg-parquet

Copy link
Member Author

Choose a reason for hiding this comment

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

That may require moving to Junit5 for a whole iceberg-core module. I am afraid I don't have a time to work on that.
@coded9, if you are intersted, please feel free to work on it.

I was doing a POC of partition stats where I had to move all the files of iceberg-parquet into iceberg-core, that time I found this duplicate code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Rebased. Now it is on Junit 5.


// Empty struct read is not supported for Parquet
@Override
public void testEmptyStructProjection() throws Exception {}
Copy link
Member Author

Choose a reason for hiding this comment

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

These tests was added for Avro. When empty struct was supported. But it is not yet supported for parquet. Since both avro and parquet now use the common class. Ignoring the tests for parquet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, This class uses (extends) TestReadProjection from api module now. Instead of duplicated local copy.

@ajantha-bhat
Copy link
Member Author

ajantha-bhat commented Nov 2, 2023

@nastra, @Fokko: I have rebased this PR. I think it is good to go. Please check.

I need to rebase #8500 after this is merged.

@nastra nastra merged commit 94de985 into apache:main Nov 2, 2023
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.

3 participants