Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/src/main/java/org/apache/iceberg/avro/Avro.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,11 @@ public ReadBuilder createResolvingReader(
return this;
}

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

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.

*/
@Deprecated
public ReadBuilder createReaderFunc(Function<Schema, DatumReader<?>> readerFunction) {
Preconditions.checkState(
createReaderBiFunc == null && createResolvingReaderFunc == null,
Expand All @@ -626,6 +631,11 @@ public ReadBuilder createReaderFunc(Function<Schema, DatumReader<?>> readerFunct
return this;
}

/**
* @deprecated since 1.12.0, will be removed in 1.13.0; use {@link
* #createResolvingReader(Function)} instead.
*/
@Deprecated
public ReadBuilder createReaderFunc(
BiFunction<org.apache.iceberg.Schema, Schema, DatumReader<?>> readerFunction) {
Preconditions.checkState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
import org.apache.iceberg.mapping.NameMapping;
import org.apache.iceberg.types.TypeUtil;

/**
* @deprecated since 1.12.0, will be removed in 1.13.0; use {@link
* org.apache.iceberg.data.avro.PlannedDataReader} instead.
*/
@Deprecated
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.

private final Function<Schema, DatumReader<?>> getReader;
private final org.apache.iceberg.Schema expectedSchema;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,7 @@ public void testDefaultDoesNotOverrideExplicitValue() throws IOException {

List<Record> rows;
try (AvroIterable<Record> reader =
Avro.read(Files.localInput(testFile))
.project(readerSchema)
.createReaderFunc(GenericAvroReader::create)
.build()) {
Avro.read(Files.localInput(testFile)).project(readerSchema).build()) {
rows = Lists.newArrayList(reader);
}

Expand Down
Loading