Skip to content

Core: Deprecate Avro.ReadBuilder.createReaderFunc, ProjectionDatumReader - #17853

Open
kinolaev wants to merge 1 commit into
apache:mainfrom
kinolaev:cleanup-1.12
Open

Core: Deprecate Avro.ReadBuilder.createReaderFunc, ProjectionDatumReader#17853
kinolaev wants to merge 1 commit into
apache:mainfrom
kinolaev:cleanup-1.12

Conversation

@kinolaev

Copy link
Copy Markdown
Contributor

Possibly part of #16445.

It seems like ProjectionDatumReader was only used with DataReader via Avro.ReadBuilder.createReaderFunc. After DataReader removal (#17699) the TestReadDefaultValues.testDefaultDoesNotOverrideExplicitValue test is the only caller. And the test succeed without .createReaderFunc(GenericAvroReader::create) call, because GenericAvroReader is the default reader in Avro.ReadBuilder.

import org.apache.iceberg.mapping.NameMapping;
import org.apache.iceberg.types.TypeUtil;

public class ProjectionDatumReader<D> implements DatumReader<D>, SupportsRowPosition {

@ebyhr ebyhr Aug 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a public class. Wouldn't it be better to deprecate it first?

https://iceberg.apache.org/contribute/#minor-version-deprecations-required

Modules iceberg-common iceberg-core iceberg-data iceberg-orc iceberg-parquet

Changes to public interfaces and classes in the subprojects listed above require a deprecation cycle of one minor release.

These projects contain common and internal code used by other projects and can evolve within a major release. Minor release deprecation will provide other subprojects and external projects notice and opportunity to transition to new implementations.

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.

Sounds right to me, but I don't have a strong opinion about it. Let's wait to hear what other community members prefer.

@manuzhang manuzhang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please mark it @deprecated first.

@kinolaev kinolaev changed the title Core: Remove ProjectionDatumReader Core: Deprecate Avro.ReadBuilder.createReaderFunc, ProjectionDatumReader Aug 28, 2026
@kinolaev
kinolaev force-pushed the cleanup-1.12 branch 2 times, most recently from 61fdec7 to 3daf2b3 Compare August 28, 2026 09:48
@kinolaev

Copy link
Copy Markdown
Contributor Author

Thanks @ebyhr and @manuzhang. I've restored the class and methods, and added deprecation notices.

@kinolaev
kinolaev requested review from ebyhr and manuzhang August 28, 2026 10:32
}

/**
* @deprecated will be removed in 1.13.0; use {@link #createResolvingReader(Function)} instead.

@dramaticlly dramaticlly Aug 28, 2026

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.

thanks @kinolaev for the change, but I think it's better to follow the convention in https://iceberg.apache.org/contribute/#deprecation-notices
to state both deprecated since, target removal version and if there's any replacement to use. There's some inconsistency across 3 deprecation notices.

@kinolaev kinolaev Aug 28, 2026

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.

thanks @dramaticlly, I've updated the notices.

Signed-off-by: Sergei Nikolaev <kinolaev@gmail.com>

@dramaticlly dramaticlly left a comment

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.

LGTM but with some questions for myself

Comment on lines +622 to +623
* @deprecated since 1.12.0, will be removed in 1.13.0; use {@link
* #createResolvingReader(Function)} instead.

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.

This reads like a drop-in replacement but I think new function takes different parameters, as iceberg schema instead of Avro schema, and it rely on caller to call setSchema(avroSchema) first.

@kinolaev kinolaev Aug 28, 2026

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.

Yes, a user that isn't satisfied with GenericAvroReader and PlannedDataReader should convert the passed read schema first:

Avro.read().createResolvingReader(icebergReadSchema -> new MyAvroReader(AvroSchemaUtil.convert(icebergReadSchema)));

As far as I understand, calling setSchema(avroFileSchema) is not required because Avro's DataFileReader will call it automatically.

return this;
}

public ReadBuilder rename(String fullName, String newName) {

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.

this also looks not used, especially after ProjectionDatumReader removal, might worth considering as well.

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.

renames can also be passed to GenericAvroReader via the SupportsCustomRecords interface.

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.

4 participants