-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Re-add iceberg bounded source; test splitting #30805
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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
166 changes: 166 additions & 0 deletions
166
sdks/java/io/iceberg/src/main/java/org/apache/beam/io/iceberg/IcebergScanConfig.java
This file contains 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,166 @@ | ||
/* | ||
* 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.beam.io.iceberg; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import java.io.Serializable; | ||
import org.apache.beam.sdk.schemas.Schema; | ||
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap; | ||
import org.apache.iceberg.Table; | ||
import org.apache.iceberg.catalog.TableIdentifier; | ||
import org.apache.iceberg.expressions.Expression; | ||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.checkerframework.dataflow.qual.Pure; | ||
|
||
@AutoValue | ||
public abstract class IcebergScanConfig implements Serializable { | ||
|
||
private transient @MonotonicNonNull Table cachedTable; | ||
|
||
public enum ScanType { | ||
TABLE, | ||
BATCH | ||
} | ||
|
||
@Pure | ||
public abstract ScanType getScanType(); | ||
|
||
@Pure | ||
public abstract IcebergCatalogConfig getCatalogConfig(); | ||
|
||
@Pure | ||
public abstract String getTableIdentifier(); | ||
|
||
@Pure | ||
public Table getTable() { | ||
if (cachedTable == null) { | ||
cachedTable = | ||
getCatalogConfig().catalog().loadTable(TableIdentifier.parse(getTableIdentifier())); | ||
} | ||
return cachedTable; | ||
} | ||
|
||
@Pure | ||
public abstract Schema getSchema(); | ||
|
||
@Pure | ||
public abstract @Nullable Expression getFilter(); | ||
|
||
@Pure | ||
public abstract @Nullable Boolean getCaseSensitive(); | ||
|
||
@Pure | ||
public abstract ImmutableMap<String, String> getOptions(); | ||
|
||
@Pure | ||
public abstract @Nullable Long getSnapshot(); | ||
|
||
@Pure | ||
public abstract @Nullable Long getTimestamp(); | ||
|
||
@Pure | ||
public abstract @Nullable Long getFromSnapshotInclusive(); | ||
|
||
@Pure | ||
public abstract @Nullable String getFromSnapshotRefInclusive(); | ||
|
||
@Pure | ||
public abstract @Nullable Long getFromSnapshotExclusive(); | ||
|
||
@Pure | ||
public abstract @Nullable String getFromSnapshotRefExclusive(); | ||
|
||
@Pure | ||
public abstract @Nullable Long getToSnapshot(); | ||
|
||
@Pure | ||
public abstract @Nullable String getToSnapshotRef(); | ||
|
||
@Pure | ||
public abstract @Nullable String getTag(); | ||
|
||
@Pure | ||
public abstract @Nullable String getBranch(); | ||
|
||
@Pure | ||
public static Builder builder() { | ||
return new AutoValue_IcebergScanConfig.Builder() | ||
.setScanType(ScanType.TABLE) | ||
.setFilter(null) | ||
.setCaseSensitive(null) | ||
.setOptions(ImmutableMap.of()) | ||
.setSnapshot(null) | ||
.setTimestamp(null) | ||
.setFromSnapshotInclusive(null) | ||
.setFromSnapshotRefInclusive(null) | ||
.setFromSnapshotExclusive(null) | ||
.setFromSnapshotRefExclusive(null) | ||
.setToSnapshot(null) | ||
.setToSnapshotRef(null) | ||
.setTag(null) | ||
.setBranch(null); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
public abstract Builder setScanType(ScanType type); | ||
|
||
public abstract Builder setCatalogConfig(IcebergCatalogConfig catalog); | ||
|
||
public abstract Builder setTableIdentifier(String tableIdentifier); | ||
|
||
public Builder setTableIdentifier(TableIdentifier tableIdentifier) { | ||
return this.setTableIdentifier(tableIdentifier.toString()); | ||
} | ||
|
||
public Builder setTableIdentifier(String... names) { | ||
return setTableIdentifier(TableIdentifier.of(names)); | ||
} | ||
|
||
public abstract Builder setSchema(Schema schema); | ||
|
||
public abstract Builder setFilter(@Nullable Expression filter); | ||
|
||
public abstract Builder setCaseSensitive(@Nullable Boolean caseSensitive); | ||
|
||
public abstract Builder setOptions(ImmutableMap<String, String> options); | ||
|
||
public abstract Builder setSnapshot(@Nullable Long snapshot); | ||
|
||
public abstract Builder setTimestamp(@Nullable Long timestamp); | ||
|
||
public abstract Builder setFromSnapshotInclusive(@Nullable Long fromInclusive); | ||
|
||
public abstract Builder setFromSnapshotRefInclusive(@Nullable String ref); | ||
|
||
public abstract Builder setFromSnapshotExclusive(@Nullable Long fromExclusive); | ||
|
||
public abstract Builder setFromSnapshotRefExclusive(@Nullable String ref); | ||
|
||
public abstract Builder setToSnapshot(@Nullable Long snapshot); | ||
|
||
public abstract Builder setToSnapshotRef(@Nullable String ref); | ||
|
||
public abstract Builder setTag(@Nullable String tag); | ||
|
||
public abstract Builder setBranch(@Nullable String branch); | ||
|
||
public abstract IcebergScanConfig build(); | ||
} | ||
} |
This file contains 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
100 changes: 0 additions & 100 deletions
100
sdks/java/io/iceberg/src/main/java/org/apache/beam/io/iceberg/RowHelper.java
This file was deleted.
Oops, something went wrong.
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.
Seems like we are missing the
Read
transform ?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.
Will do soon. I realize all the tests are a vanilla
Read.from(IcebergBoundedSource)
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.
done