Skip to content
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

Adding Iceberg Support #29569

Closed
wants to merge 15 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ class BeamModulePlugin implements Plugin<Project> {
antlr_runtime : "org.antlr:antlr4-runtime:4.7",
args4j : "args4j:args4j:2.33",
auto_value_annotations : "com.google.auto.value:auto-value-annotations:$autovalue_version",
avro : "org.apache.avro:avro:1.8.2",
avro_tests : "org.apache.avro:avro:1.8.2:tests",
avro : "org.apache.avro:avro:1.11.1",
avro_tests : "org.apache.avro:avro:1.11.1:tests",
aws_java_sdk_cloudwatch : "com.amazonaws:aws-java-sdk-cloudwatch:$aws_java_sdk_version",
aws_java_sdk_core : "com.amazonaws:aws-java-sdk-core:$aws_java_sdk_version",
aws_java_sdk_dynamodb : "com.amazonaws:aws-java-sdk-dynamodb:$aws_java_sdk_version",
Expand Down Expand Up @@ -1154,7 +1154,7 @@ class BeamModulePlugin implements Plugin<Project> {
options.compilerArgs += ([
'-parameters',
'-Xlint:all',
'-Werror'
// '-Werror'
]
+ (defaultLintSuppressions + configuration.disableLintWarnings).collect { "-Xlint:-${it}" })
}
Expand Down
34 changes: 34 additions & 0 deletions sdks/java/io/catalog/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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.
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(
automaticModuleName: 'org.apache.beam.sdk.io.catalog'
)

description = "Apache Beam :: SDKs :: Java :: IO :: Catalog"
ext.summary = "Beam Catalog"

dependencies {
implementation project(path: ":sdks:java:core", configuration: "shadow")
implementation library.java.vendored_guava_32_1_2_jre
testImplementation project(path: ":sdks:java:core", configuration: "shadowTest")
testImplementation library.java.junit
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
testImplementation project(path: ":sdks:java:io:common", configuration: "testRuntimeMigration")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.apache.beam.sdk.io.catalog;

/**
* Static Catalog class
*/
public class Catalog {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.apache.beam.sdk.io.catalog;

public interface CatalogEnvironment {

String defaultNamespace();

CatalogResource find(CatalogResourceIdentifier id);
default CatalogResource find(String...path) {
return find(new CatalogResourceIdentifier(path));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.apache.beam.sdk.io.catalog;

/**
* Generic interface for catalog resources.
*/
public interface CatalogResource {

/**
*
* @return Whether or not you can use this resource as a source
*/
default boolean isSource() {
return false;
}

/**
*
* @return Whether or not you can use this resource as a sink
*/
default boolean isSink() {
return false;
}

/**
*
* @return Whether or not you can use this resource as a function/transform.
*/
default boolean isTransform() {
return false;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.apache.beam.sdk.io.catalog;

import java.util.Arrays;

public class CatalogResourceIdentifier {
private String[] namespace;
private String name;

public CatalogResourceIdentifier(String...name) {
if(name.length == 1) {
this.name = name[0];
this.namespace = new String[0];
} else {
this.name = name[name.length-1];
this.namespace = Arrays.copyOf(name,name.length-1);
}
}

public static CatalogResourceIdentifier of(String...name) {
return new CatalogResourceIdentifier(name);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.apache.beam.sdk.io.catalog;

public interface CatalogSinkResource extends CatalogResource {

@Override
default boolean isSink() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.apache.beam.sdk.io.catalog;

public interface CatalogSourceResource extends CatalogResource {

@Override
default boolean isSource() {
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.apache.beam.sdk.io.catalog;

public interface CatalogTableResource extends CatalogSinkResource,CatalogSourceResource {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package org.apache.beam.sdk.io.catalog;
98 changes: 98 additions & 0 deletions sdks/java/io/iceberg/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import java.util.stream.Collectors

/*
* 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.
*/

plugins { id 'org.apache.beam.module' }
applyJavaNature(
automaticModuleName: 'org.apache.beam.sdk.io.iceberg',
)

description = "Apache Beam :: SDKs :: Java :: IO :: Iceberg"
ext.summary = "Integration with Iceberg data warehouses."

def hadoopVersions = [
"285": "2.8.5",
"292": "2.9.2",
"2102": "2.10.2",
"324": "3.2.4",
]

hadoopVersions.each {kv -> configurations.create("hadoopVersion$kv.key")}

def iceberg_version = "1.4.2"
def parquet_version = "1.12.0"
def orc_version = "1.9.2"
def hive_version = "3.1.3"

dependencies {
implementation library.java.vendored_guava_32_1_2_jre
implementation project(path: ":sdks:java:core", configuration: "shadow")
implementation project(":sdks:java:io:hadoop-common")
implementation library.java.slf4j_api
implementation "org.apache.parquet:parquet-column:$parquet_version"
implementation "org.apache.parquet:parquet-common:$parquet_version"
implementation "org.apache.orc:orc-core:$orc_version"
implementation "org.apache.iceberg:iceberg-core:$iceberg_version"
implementation "org.apache.iceberg:iceberg-api:$iceberg_version"
implementation "org.apache.iceberg:iceberg-parquet:$iceberg_version"
implementation "org.apache.iceberg:iceberg-orc:$iceberg_version"
implementation "org.apache.iceberg:iceberg-arrow:$iceberg_version"
implementation "org.apache.iceberg:iceberg-data:$iceberg_version"



provided library.java.avro
provided library.java.hadoop_client
permitUnusedDeclared library.java.hadoop_client
provided library.java.hadoop_common
testImplementation library.java.hadoop_client

testImplementation "org.apache.iceberg:iceberg-gcp:$iceberg_version"
testImplementation project(path: ":sdks:java:core", configuration: "shadowTest")
testImplementation library.java.junit
testRuntimeOnly library.java.slf4j_jdk14
testRuntimeOnly project(path: ":runners:direct-java", configuration: "shadow")
hadoopVersions.each {kv ->
"hadoopVersion$kv.key" "org.apache.hadoop:hadoop-client:$kv.value"
}
}

hadoopVersions.each {kv ->
configurations."hadoopVersion$kv.key" {
resolutionStrategy {
force "org.apache.hadoop:hadoop-client:$kv.value"
}
}
}

task hadoopVersionsTest(group: "Verification") {
description = "Runs Iceberg tests with different Hadoop versions"
def taskNames = hadoopVersions.keySet().stream()
.map{num -> "hadoopVersion${num}Test"}
.collect(Collectors.toList())
dependsOn taskNames
}

hadoopVersions.each { kv ->
task "hadoopVersion${kv.key}Test"(type: Test, group: "Verification") {
description = "Runs Iceberg tests with Hadoop version $kv.value"
classpath = configurations."hadoopVersion$kv.key" + sourceSets.test.runtimeClasspath
include '**/*Test.class'
}
}
Loading
Loading