-
Notifications
You must be signed in to change notification settings - Fork 594
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
feat(sink): support deltalake sink with rust sdk #13600
Merged
Merged
Changes from 25 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
e6bc0ee
add delta lake sink
xxhZs 013eede
fix
xxhZs f0047ba
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
xxhZs 2ff021f
fmt
xxhZs 7b85ea2
save
xxhZs 6fbbac3
fix cargo lock
xxhZs c6a709c
fmt
xxhZs 1ddf1f9
fix
xxhZs cdecda5
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
xxhZs f521372
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
xxhZs c890167
use separate arrow version for deltalake
wenym1 2a35a5e
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
wenym1 0aa6785
fix timestamptz
xxhZs 9b7b543
use mod path to avoid macro
wenym1 e460901
add license and comment
wenym1 13ff6ed
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
wenym1 c187f72
update test
wenym1 2217f61
add comment
wenym1 4c503fa
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
wenym1 1aaf516
use expect
wenym1 e1a3814
save
xxhZs 76547e4
fix fmt
xxhZs b0b1b87
add ci
xxhZs 50899c0
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
xxhZs 10b1ba6
Empty commit
xxhZs 5a492a6
fix ci
xxhZs 435eb73
fix
xxhZs cf96d64
ut timeout 20 -> 22
xxhZs 4a83b8f
fix region
xxhZs 814dcc9
reduce compile time and binary size
wenym1 f9605ad
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
wenym1 899070a
temp add hakari third party
wenym1 86625ab
use new delta-rs commit
wenym1 5c365a9
Merge branch 'main' into 13152-reimplement-delta-lake-sink-with-rust-sdk
xxhZs a4023e5
fix ci
xxhZs 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exits as soon as any line fails. | ||
set -euo pipefail | ||
|
||
source ci/scripts/common.sh | ||
|
||
# prepare environment | ||
export CONNECTOR_LIBS_PATH="./connector-node/libs" | ||
|
||
while getopts 'p:' opt; do | ||
case ${opt} in | ||
p ) | ||
profile=$OPTARG | ||
;; | ||
\? ) | ||
echo "Invalid Option: -$OPTARG" 1>&2 | ||
exit 1 | ||
;; | ||
: ) | ||
echo "Invalid option: $OPTARG requires an argument" 1>&2 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND -1)) | ||
|
||
download_and_prepare_rw "$profile" source | ||
|
||
echo "--- Download connector node package" | ||
buildkite-agent artifact download risingwave-connector.tar.gz ./ | ||
mkdir ./connector-node | ||
tar xf ./risingwave-connector.tar.gz -C ./connector-node | ||
|
||
echo "--- starting risingwave cluster" | ||
mkdir -p .risingwave/log | ||
cargo make ci-start ci-deltalake-test | ||
sleep 1 | ||
|
||
# prepare minio deltalake sink | ||
echo "--- preparing deltalake" | ||
.risingwave/bin/mcli -C .risingwave/config/mcli mb hummock-minio/deltalake | ||
wget https://ci-deps-dist.s3.amazonaws.com/spark-3.3.1-bin-hadoop3.tgz | ||
tar -xf spark-3.3.1-bin-hadoop3.tgz --no-same-owner | ||
DEPENDENCIES=io.delta:delta-core_2.12:2.2.0,org.apache.hadoop:hadoop-aws:3.3.2 | ||
spark-3.3.1-bin-hadoop3/bin/spark-sql --packages $DEPENDENCIES \ | ||
--conf 'spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension' \ | ||
--conf 'spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog' \ | ||
--conf 'spark.hadoop.fs.s3a.access.key=hummockadmin' \ | ||
--conf 'spark.hadoop.fs.s3a.secret.key=hummockadmin' \ | ||
--conf 'spark.hadoop.fs.s3a.endpoint=http://127.0.0.1:9301' \ | ||
--conf 'spark.hadoop.fs.s3a.path.style.access=true' \ | ||
--S --e 'create table delta.`s3a://deltalake/deltalake-test`(v1 int, v2 short, v3 long, v4 float, v5 double, v6 string, v7 date, v8 Timestamp, v9 boolean) using delta;' | ||
|
||
|
||
echo "--- testing sinks" | ||
sqllogictest -p 4566 -d dev './e2e_test/sink/deltalake_rust_sink.slt' | ||
sleep 1 | ||
|
||
|
||
spark-3.3.1-bin-hadoop3/bin/spark-sql --packages io.delta:delta-core_2.12:2.2.0,org.apache.hadoop:hadoop-aws:3.3.2 \ | ||
--conf 'spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension' \ | ||
--conf 'spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog' \ | ||
--conf 'spark.hadoop.fs.s3a.access.key=hummockadmin' \ | ||
--conf 'spark.hadoop.fs.s3a.secret.key=hummockadmin' \ | ||
--conf 'spark.hadoop.fs.s3a.endpoint=http://localhost:9301' \ | ||
--conf 'spark.hadoop.fs.s3a.path.style.access=true' \ | ||
--S --e 'INSERT OVERWRITE DIRECTORY './spark-output' USING CSV SELECT * FROM delta.`s3a://deltalake/deltalake-test`;' | ||
|
||
# check sink destination using shell | ||
if cat ./spark-output/*.csv | sort | awk -F "," '{ | ||
exit !($1 == 1 && $2 == 1 && $3 == 1 && $4 == 1.1 && $5 == 1.2 && $6 == "test" && $7 == "2013-01-01" && $8 == "2013-01-01T09:01:01.000+08:00" && $9 == false); }'; then | ||
echo "DeltaLake sink check passed" | ||
else | ||
echo "The output is not as expected." | ||
exit 1 | ||
fi | ||
|
||
echo "--- Kill cluster" | ||
cargo make ci-kill |
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
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,33 @@ | ||
statement ok | ||
CREATE TABLE t6 (v1 int primary key, v2 smallint, v3 bigint, v4 real, v5 float, v6 varchar, v7 date, v8 timestamptz, v9 boolean); | ||
|
||
statement ok | ||
CREATE MATERIALIZED VIEW mv6 AS SELECT * FROM t6; | ||
|
||
statement ok | ||
create sink s6 as select * from mv6 | ||
with ( | ||
connector = 'deltalake_rust', | ||
type = 'append-only', | ||
force_append_only = 'true', | ||
path = 's3a://deltalake/deltalake-test', | ||
xxhZs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
s3.access.key = 'hummockadmin', | ||
s3.secret.key = 'hummockadmin', | ||
s3.endpoint = 'http://127.0.0.1:9301', | ||
s3.region='us-east-1' | ||
xxhZs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
); | ||
|
||
statement ok | ||
INSERT INTO t6 VALUES (1, 1, 1, 1.1, 1.2, 'test', '2013-01-01', '2013-01-01 01:01:01+00:00' , false); | ||
|
||
statement ok | ||
FLUSH; | ||
|
||
statement ok | ||
DROP SINK s6; | ||
|
||
statement ok | ||
DROP MATERIALIZED VIEW mv6; | ||
|
||
statement ok | ||
DROP TABLE t6; |
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
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,26 @@ | ||
// Copyright 2023 RisingWave Labs | ||
// | ||
// Licensed 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. | ||
|
||
//! This is for arrow dependency named `arrow-xxx` such as `arrow-array` in the cargo workspace. | ||
//! | ||
//! This should the default arrow version to be used in our system. | ||
//! | ||
//! The corresponding version of arrow is currently used by `udf` and `iceberg` sink. | ||
|
||
pub use arrow_impl::to_record_batch_with_schema; | ||
use {arrow_array, arrow_buffer, arrow_cast, arrow_schema}; | ||
|
||
#[expect(clippy::duplicate_mod)] | ||
#[path = "./arrow_impl.rs"] | ||
mod arrow_impl; |
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,28 @@ | ||
// Copyright 2023 RisingWave Labs | ||
// | ||
// Licensed 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. | ||
|
||
//! This is for arrow dependency named `arrow-xxx-deltalake` such as `arrow-array-deltalake` | ||
//! in the cargo workspace. | ||
//! | ||
//! The corresponding version of arrow is currently used by `deltalake` sink. | ||
|
||
pub use arrow_impl::to_record_batch_with_schema as to_deltalake_record_batch_with_schema; | ||
wenym1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
use { | ||
arrow_array_deltalake as arrow_array, arrow_buffer_deltalake as arrow_buffer, | ||
arrow_cast_deltalake as arrow_cast, arrow_schema_deltalake as arrow_schema, | ||
}; | ||
|
||
#[expect(clippy::duplicate_mod)] | ||
#[path = "./arrow_impl.rs"] | ||
mod arrow_impl; |
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.
Is there a particular reason for downgrading arrow?
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.
Because both Delta.rs and IceLake need to use Arrow, version 48.0.1 is the maximum version they both support.