-
Notifications
You must be signed in to change notification settings - Fork 276
docs: add Iceberg public API documentation to contributor guide #3237
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
Open
andygrove
wants to merge
7
commits into
apache:main
Choose a base branch
from
andygrove:docs-iceberg-public-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cfef6c8
docs: add Iceberg public API documentation to contributor guide
andygrove 2a0e7d1
feat: add @IcebergApi annotation to mark public API used by Iceberg
andygrove 6b4a47d
fix: add missing @IcebergApi annotations
andygrove 7b58965
format
andygrove 8798b1d
test: add iceberg-public-api module with API stability tests
andygrove 640dd03
trigger CI
andygrove a4ca885
Address review comments
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.comet; | ||
|
|
||
| import java.lang.annotation.Documented; | ||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Indicates that the annotated element is part of the public API used by Apache Iceberg. | ||
| * | ||
| * <p>This annotation marks classes, methods, constructors, and fields that form the contract | ||
| * between Comet and Iceberg. Changes to these APIs may break Iceberg's Comet integration, so | ||
| * contributors should exercise caution and consider backward compatibility when modifying annotated | ||
| * elements. | ||
| * | ||
| * <p>The Iceberg integration uses Comet's native Parquet reader for accelerated vectorized reads. | ||
| * See the contributor guide documentation for details on how Iceberg uses these APIs. | ||
| * | ||
| * @see <a href="https://iceberg.apache.org/">Apache Iceberg</a> | ||
| */ | ||
| @Documented | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) | ||
| public @interface IcebergApi {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,6 +65,7 @@ | |
|
|
||
| import org.apache.comet.CometConf; | ||
| import org.apache.comet.CometSchemaImporter; | ||
| import org.apache.comet.IcebergApi; | ||
| import org.apache.comet.shims.ShimBatchReader; | ||
| import org.apache.comet.shims.ShimFileFormat; | ||
| import org.apache.comet.vector.CometVector; | ||
|
|
@@ -87,6 +88,7 @@ | |
| * } | ||
| * </pre> | ||
| */ | ||
| @IcebergApi | ||
| public class BatchReader extends RecordReader<Void, ColumnarBatch> implements Closeable { | ||
| private static final Logger LOG = LoggerFactory.getLogger(FileReader.class); | ||
| protected static final BufferAllocator ALLOCATOR = new RootAllocator(); | ||
|
|
@@ -189,6 +191,7 @@ public BatchReader( | |
| * @deprecated since 0.10.0, will be removed in 0.11.0. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it should be undeprecated ?! |
||
| * @see <a href="https://github.com/apache/datafusion-comet/issues/2079">Comet Issue #2079</a> | ||
| */ | ||
| @IcebergApi | ||
| public BatchReader(AbstractColumnReader[] columnReaders) { | ||
| // Todo: set useDecimal128 and useLazyMaterialization | ||
| int numColumns = columnReaders.length; | ||
|
|
@@ -387,6 +390,7 @@ public void init() throws URISyntaxException, IOException { | |
| * @deprecated since 0.10.0, will be removed in 0.11.0. | ||
| * @see <a href="https://github.com/apache/datafusion-comet/issues/2079">Comet Issue #2079</a> | ||
| */ | ||
| @IcebergApi | ||
| public void setSparkSchema(StructType schema) { | ||
| this.sparkSchema = schema; | ||
| } | ||
|
|
@@ -395,6 +399,7 @@ public void setSparkSchema(StructType schema) { | |
| * @deprecated since 0.10.0, will be removed in 0.11.0. | ||
| * @see <a href="https://github.com/apache/datafusion-comet/issues/2079">Comet Issue #2079</a> | ||
| */ | ||
| @IcebergApi | ||
| public AbstractColumnReader[] getColumnReaders() { | ||
| return columnReaders; | ||
| } | ||
|
|
@@ -498,6 +503,7 @@ public boolean nextBatch() throws IOException { | |
| return nextBatch(batchSize); | ||
| } | ||
|
|
||
| @IcebergApi | ||
| public boolean nextBatch(int batchSize) { | ||
| long totalDecodeTime = 0, totalLoadTime = 0; | ||
| for (int i = 0; i < columnReaders.length; i++) { | ||
|
|
@@ -524,6 +530,7 @@ public boolean nextBatch(int batchSize) { | |
| return true; | ||
| } | ||
|
|
||
| @IcebergApi | ||
| @Override | ||
| public void close() throws IOException { | ||
| if (columnReaders != null) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we annotate the class with
@IcebergApi, do we still need@IcebergApiin L66, L101 and L119?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing this @huaxingao. My plan was to annotate every class, method, and field referenced from Iceberg. Some methods are not referenced, so it would be safe to modify them without affecting Iceberg compatibility. The idea is that we know not to modify anything with the
@IcebergApiannotation without careful consideration.