Skip to content

Migrate non TestBase related and Data classes in Flink#10130

Merged
nastra merged 2 commits into
apache:mainfrom
tomtongue:mig-junit5-flink-standalone
Apr 15, 2024
Merged

Migrate non TestBase related and Data classes in Flink#10130
nastra merged 2 commits into
apache:mainfrom
tomtongue:mig-junit5-flink-standalone

Conversation

@tomtongue
Copy link
Copy Markdown
Contributor

@tomtongue tomtongue commented Apr 12, 2024

Migrate the following classes in iceberg-flink and iceberg-data to JUnit 5 for #9087

Current Progress

iceberg-flink (v1.18)

  • AvroGenericRecordConverterBase
    • TestAvroGenericRecordToRowDataMapper
    • TestRowDataToAvroGenericRecordConverter
  • TestDataFileSerialization
  • TestFlinkCatalogFactory
  • TestFlinkFilters
  • TestFlinkSchemaUtil
  • TestManifestFileSerialization
  • TestRowDataWrapper (< RecordWrapperTest)
  • TestTableSerialization
  • util/
    • TestFlinkPackage
  • data/
    • TestFlinkAvroReaderWriter (< DataTest) (including v1.16 and v1.17)
    • TestFlinkOrcReaderWriter (< DataTest) (including v1.16 and v1.17)
    • TestFlinkParquetReader (< DataTest) (including v1.16 and v1.17)
    • TestFlinkParquetWriter (< DataTest) (including v1.16 and v1.17)
    • TestRowProjection
    • TestStructRowData

DataTest related classes in iceberg-data:

  • avro/TestGenericData
  • orc/TestGenericData
  • parquet/TestGenericData
  • TestParquetEncryptionWithWriteSupport

required(117, "time", Types.TimeType.get()));

@Rule public TemporaryFolder temp = new TemporaryFolder();
@TempDir public Path temp;
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.

can be set to protected

.build()) {
CloseableIterator it = reader.iterator();
Assert.assertTrue("Should have at least one row", it.hasNext());
assertThat(it.hasNext()).isTrue();
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.

Suggested change
assertThat(it.hasNext()).isTrue();
assertThat(it).hasNext();

Assert.assertFalse("Should not have more than one row", it.hasNext());
assertThat(actualRecord.get(0, ArrayList.class)).first().isEqualTo(expectedBinary);
assertThat(actualRecord.get(1, ByteBuffer.class)).isEqualTo(expectedBinary);
assertThat(it.hasNext()).isFalse();
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.

same as above

fileSchema -> GenericParquetReaders.buildReader(schema, fileSchema))
.build()
.iterator())
.as("Decrypted without keys")
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.

.as() isn't needed. It should rather have a .hasMessage check

Assert.assertFalse("Should not have more than one row", it.hasNext());
assertThat(actualRecord.get(0, ArrayList.class)).first().isEqualTo(expectedBinary);
assertThat(actualRecord.get(1, ByteBuffer.class)).isEqualTo(expectedBinary);
assertThat(it.hasNext()).isFalse();
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.

same as above

Iterator<RowData> rows = reader.iterator();
for (int i = 0; i < numRecord; i++) {
Assert.assertTrue("Should have expected number of records", rows.hasNext());
assertThat(rows.hasNext()).isTrue();
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.

same as previously mentioned. please also update all other places

@tomtongue tomtongue changed the title [WIP] Migrate non TestBase related and Data classes in Flink Migrate non TestBase related and Data classes in Flink Apr 14, 2024
@tomtongue
Copy link
Copy Markdown
Contributor Author

@nastra thanks for the review. Reflected your feedback and migrate other classes. Could you review?

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

public class TestRowProjection {
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.

In the Flink codebase we need to make sure that the same code changes are being applied across all 3 versions. So if you're touching this file here, you would also need to make sure to apply the same changes for the other Flink versions.

This can be either done within the same PR or in an immediate follow-up that backports the same changes to earlier versions

@nastra
Copy link
Copy Markdown
Contributor

nastra commented Apr 15, 2024

changes LGTM, can you please backport these changes to earlier Flink versions?

@nastra nastra merged commit 943321e into apache:main Apr 15, 2024
@tomtongue
Copy link
Copy Markdown
Contributor Author

Sure. Will submit a PR for backporting. Thank you.

@tomtongue tomtongue deleted the mig-junit5-flink-standalone branch April 15, 2024 13:13
sasankpagolu pushed a commit to sasankpagolu/iceberg that referenced this pull request Oct 27, 2024
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
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