Skip to content

Commit 6a52b00

Browse files
committed
Implements the Delta Lake source with support for splitting
1 parent eb29f86 commit 6a52b00

12 files changed

Lines changed: 3055 additions & 4 deletions

File tree

sdks/java/io/delta/build.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,17 @@ applyJavaNature(
2323
requireJavaVersion: JavaVersion.VERSION_17,
2424
)
2525

26+
tasks.withType(JavaCompile) {
27+
options.errorprone.enabled = false
28+
}
29+
2630
description = "Apache Beam :: SDKs :: Java :: IO :: Delta Lake"
2731
ext.summary = "Integration with Delta Lake."
2832

33+
// We need to override the GCS bigdataos connector version to prevent conflicts.
34+
def bigdataoss_gcs_connector_version = "4.0.4"
35+
36+
def parquet_version = "1.16.0"
2937

3038
dependencies {
3139
implementation project(path: ":sdks:java:core", configuration: "shadow")
@@ -35,5 +43,45 @@ dependencies {
3543
permitUnusedDeclared library.java.delta_kernel_api
3644
permitUnusedDeclared library.java.delta_kernel_defaults
3745

46+
implementation library.java.hadoop_common
47+
implementation library.java.joda_time
48+
implementation library.java.slf4j_api
49+
implementation "org.apache.parquet:parquet-column:$parquet_version"
50+
implementation "org.apache.parquet:parquet-hadoop:$parquet_version"
51+
52+
// We need to override the GCS connector version to prevent conflicts with
53+
// latest Hadoop.
54+
implementation "com.google.cloud.bigdataoss:gcs-connector:$bigdataoss_gcs_connector_version"
55+
implementation "com.google.cloud.bigdataoss:util-hadoop:$bigdataoss_gcs_connector_version"
56+
implementation "com.google.cloud.bigdataoss:gcsio:$bigdataoss_gcs_connector_version"
57+
implementation "com.google.cloud.bigdataoss:util:$bigdataoss_gcs_connector_version"
58+
permitUnusedDeclared "com.google.cloud.bigdataoss:gcs-connector:$bigdataoss_gcs_connector_version"
59+
permitUnusedDeclared "com.google.cloud.bigdataoss:util-hadoop:$bigdataoss_gcs_connector_version"
60+
permitUnusedDeclared "com.google.cloud.bigdataoss:gcsio:$bigdataoss_gcs_connector_version"
61+
permitUnusedDeclared "com.google.cloud.bigdataoss:util:$bigdataoss_gcs_connector_version"
62+
63+
// For Avro conversions
64+
testImplementation project(":sdks:java:extensions:avro")
65+
66+
testImplementation library.java.avro
3867
testImplementation library.java.junit
68+
testImplementation library.java.hamcrest
69+
testImplementation "org.apache.parquet:parquet-avro:$parquet_version"
70+
testImplementation project(":sdks:java:io:parquet")
71+
testImplementation project(":sdks:java:managed")
72+
testRuntimeOnly "org.yaml:snakeyaml:2.0"
73+
testImplementation project(path: ":runners:direct-java", configuration: "shadow")
74+
}
75+
76+
configurations.all {
77+
// Exclude conflicting logging frameworks
78+
exclude group: "org.apache.logging.log4j", module: "log4j-slf4j2-impl"
79+
exclude group: "org.apache.logging.log4j", module: "log4j-slf4j-impl"
80+
exclude group: "org.slf4j", module: "slf4j-reload4j"
81+
82+
// Force overriding for all configurations
83+
resolutionStrategy.force "com.google.cloud.bigdataoss:gcs-connector:$bigdataoss_gcs_connector_version"
84+
resolutionStrategy.force "com.google.cloud.bigdataoss:util-hadoop:$bigdataoss_gcs_connector_version"
85+
resolutionStrategy.force "com.google.cloud.bigdataoss:gcsio:$bigdataoss_gcs_connector_version"
86+
resolutionStrategy.force "com.google.cloud.bigdataoss:util:$bigdataoss_gcs_connector_version"
3987
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package org.apache.beam.sdk.io.delta;
19+
20+
import io.delta.kernel.engine.Engine;
21+
import io.delta.kernel.engine.ExpressionHandler;
22+
import io.delta.kernel.engine.FileSystemClient;
23+
import io.delta.kernel.engine.JsonHandler;
24+
import io.delta.kernel.engine.ParquetHandler;
25+
26+
/** A Beam specific {@link Engine} wrapper that provides a custom {@link ParquetHandler}. */
27+
public class BeamEngine implements Engine {
28+
private final Engine delegate;
29+
private final ParquetHandler parquetHandler;
30+
31+
public BeamEngine(Engine delegate, ParquetHandler parquetHandler) {
32+
this.delegate = delegate;
33+
this.parquetHandler = parquetHandler;
34+
}
35+
36+
@Override
37+
public ExpressionHandler getExpressionHandler() {
38+
return delegate.getExpressionHandler();
39+
}
40+
41+
@Override
42+
public JsonHandler getJsonHandler() {
43+
return delegate.getJsonHandler();
44+
}
45+
46+
@Override
47+
public FileSystemClient getFileSystemClient() {
48+
return delegate.getFileSystemClient();
49+
}
50+
51+
@Override
52+
public ParquetHandler getParquetHandler() {
53+
return parquetHandler;
54+
}
55+
}

0 commit comments

Comments
 (0)