deltalake-rb 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Cargo.lock +23 -23
- data/ext/deltalake/Cargo.toml +2 -2
- data/ext/deltalake/src/lib.rs +211 -33
- data/lib/deltalake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea5a918bf03fd3ebe4068b9a8b57d789ac6df2d302612f69782ad3b456f46cce
|
|
4
|
+
data.tar.gz: 40ae881f94ea68aa01f4a34eec07f343ea2689254e695714a177c262ee337e11
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c8c4c92f8dddb8650bf97a46f8729525cdfadcad3768e6b791ed88a7531a6f78028afbd6cf7aaf0a1b089003849fe365435d556606953469e60ec17233156a6
|
|
7
|
+
data.tar.gz: 1acdfab5067d69bf657c1acac3cf103424734c5cde928c1ef15fb4825df359bd78c5051688f68e1fe4755ba452ba2c0b5ef57375921497051b9756aa58ad4191
|
data/CHANGELOG.md
CHANGED
data/Cargo.lock
CHANGED
|
@@ -306,9 +306,9 @@ dependencies = [
|
|
|
306
306
|
|
|
307
307
|
[[package]]
|
|
308
308
|
name = "async-compression"
|
|
309
|
-
version = "0.4.
|
|
309
|
+
version = "0.4.42"
|
|
310
310
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
311
|
-
checksum = "
|
|
311
|
+
checksum = "e79b3f8a79cccc2898f31920fc69f304859b3bd567490f75ebf51ae1c792a9ac"
|
|
312
312
|
dependencies = [
|
|
313
313
|
"compression-codecs",
|
|
314
314
|
"compression-core",
|
|
@@ -1101,9 +1101,9 @@ dependencies = [
|
|
|
1101
1101
|
|
|
1102
1102
|
[[package]]
|
|
1103
1103
|
name = "compression-codecs"
|
|
1104
|
-
version = "0.4.
|
|
1104
|
+
version = "0.4.38"
|
|
1105
1105
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1106
|
-
checksum = "
|
|
1106
|
+
checksum = "ce2548391e9c1929c21bf6aa2680af86fe4c1b33e6cea9ac1cfeec0bd11218cf"
|
|
1107
1107
|
dependencies = [
|
|
1108
1108
|
"bzip2",
|
|
1109
1109
|
"compression-core",
|
|
@@ -1116,9 +1116,9 @@ dependencies = [
|
|
|
1116
1116
|
|
|
1117
1117
|
[[package]]
|
|
1118
1118
|
name = "compression-core"
|
|
1119
|
-
version = "0.4.
|
|
1119
|
+
version = "0.4.32"
|
|
1120
1120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1121
|
-
checksum = "
|
|
1121
|
+
checksum = "cc14f565cf027a105f7a44ccf9e5b424348421a1d8952a8fc9d499d313107789"
|
|
1122
1122
|
|
|
1123
1123
|
[[package]]
|
|
1124
1124
|
name = "const-oid"
|
|
@@ -2061,9 +2061,9 @@ dependencies = [
|
|
|
2061
2061
|
|
|
2062
2062
|
[[package]]
|
|
2063
2063
|
name = "deltalake"
|
|
2064
|
-
version = "0.32.
|
|
2064
|
+
version = "0.32.1"
|
|
2065
2065
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2066
|
-
checksum = "
|
|
2066
|
+
checksum = "8268de472e1692b47d4a3016d3443fa7aa1f24d5a92337ee867204951959c293"
|
|
2067
2067
|
dependencies = [
|
|
2068
2068
|
"buoyant_kernel",
|
|
2069
2069
|
"ctor",
|
|
@@ -2116,9 +2116,9 @@ dependencies = [
|
|
|
2116
2116
|
|
|
2117
2117
|
[[package]]
|
|
2118
2118
|
name = "deltalake-core"
|
|
2119
|
-
version = "0.32.
|
|
2119
|
+
version = "0.32.1"
|
|
2120
2120
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2121
|
-
checksum = "
|
|
2121
|
+
checksum = "4b6f1d41164959efaaae6d77fc00f9609ec59159ad4d0278924e79a0738f61b0"
|
|
2122
2122
|
dependencies = [
|
|
2123
2123
|
"arrow",
|
|
2124
2124
|
"arrow-arith",
|
|
@@ -2201,7 +2201,7 @@ dependencies = [
|
|
|
2201
2201
|
|
|
2202
2202
|
[[package]]
|
|
2203
2203
|
name = "deltalake-ruby"
|
|
2204
|
-
version = "0.3.
|
|
2204
|
+
version = "0.3.1"
|
|
2205
2205
|
dependencies = [
|
|
2206
2206
|
"arrow",
|
|
2207
2207
|
"arrow-schema",
|
|
@@ -2268,7 +2268,7 @@ dependencies = [
|
|
|
2268
2268
|
"libc",
|
|
2269
2269
|
"option-ext",
|
|
2270
2270
|
"redox_users",
|
|
2271
|
-
"windows-sys 0.
|
|
2271
|
+
"windows-sys 0.60.2",
|
|
2272
2272
|
]
|
|
2273
2273
|
|
|
2274
2274
|
[[package]]
|
|
@@ -2768,7 +2768,7 @@ dependencies = [
|
|
|
2768
2768
|
"libc",
|
|
2769
2769
|
"percent-encoding",
|
|
2770
2770
|
"pin-project-lite",
|
|
2771
|
-
"socket2 0.
|
|
2771
|
+
"socket2 0.5.10",
|
|
2772
2772
|
"system-configuration",
|
|
2773
2773
|
"tokio",
|
|
2774
2774
|
"tower-service",
|
|
@@ -3183,9 +3183,9 @@ dependencies = [
|
|
|
3183
3183
|
|
|
3184
3184
|
[[package]]
|
|
3185
3185
|
name = "link-section"
|
|
3186
|
-
version = "0.2.
|
|
3186
|
+
version = "0.2.1"
|
|
3187
3187
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3188
|
-
checksum = "
|
|
3188
|
+
checksum = "b685d66585d646efe09fec763d796c291049c8b6bf84e04954bffc8748341f0d"
|
|
3189
3189
|
|
|
3190
3190
|
[[package]]
|
|
3191
3191
|
name = "linux-raw-sys"
|
|
@@ -3724,7 +3724,7 @@ dependencies = [
|
|
|
3724
3724
|
"once_cell",
|
|
3725
3725
|
"socket2 0.5.10",
|
|
3726
3726
|
"tracing",
|
|
3727
|
-
"windows-sys 0.
|
|
3727
|
+
"windows-sys 0.52.0",
|
|
3728
3728
|
]
|
|
3729
3729
|
|
|
3730
3730
|
[[package]]
|
|
@@ -4028,7 +4028,7 @@ dependencies = [
|
|
|
4028
4028
|
"errno",
|
|
4029
4029
|
"libc",
|
|
4030
4030
|
"linux-raw-sys",
|
|
4031
|
-
"windows-sys 0.
|
|
4031
|
+
"windows-sys 0.52.0",
|
|
4032
4032
|
]
|
|
4033
4033
|
|
|
4034
4034
|
[[package]]
|
|
@@ -4086,7 +4086,7 @@ dependencies = [
|
|
|
4086
4086
|
"security-framework",
|
|
4087
4087
|
"security-framework-sys",
|
|
4088
4088
|
"webpki-root-certs",
|
|
4089
|
-
"windows-sys 0.
|
|
4089
|
+
"windows-sys 0.52.0",
|
|
4090
4090
|
]
|
|
4091
4091
|
|
|
4092
4092
|
[[package]]
|
|
@@ -4097,9 +4097,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
|
|
|
4097
4097
|
|
|
4098
4098
|
[[package]]
|
|
4099
4099
|
name = "rustls-webpki"
|
|
4100
|
-
version = "0.103.
|
|
4100
|
+
version = "0.103.13"
|
|
4101
4101
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
4102
|
-
checksum = "
|
|
4102
|
+
checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"
|
|
4103
4103
|
dependencies = [
|
|
4104
4104
|
"aws-lc-rs",
|
|
4105
4105
|
"ring",
|
|
@@ -4369,7 +4369,7 @@ dependencies = [
|
|
|
4369
4369
|
"cfg-if",
|
|
4370
4370
|
"libc",
|
|
4371
4371
|
"psm",
|
|
4372
|
-
"windows-sys 0.
|
|
4372
|
+
"windows-sys 0.52.0",
|
|
4373
4373
|
]
|
|
4374
4374
|
|
|
4375
4375
|
[[package]]
|
|
@@ -4493,7 +4493,7 @@ dependencies = [
|
|
|
4493
4493
|
"getrandom 0.3.3",
|
|
4494
4494
|
"once_cell",
|
|
4495
4495
|
"rustix",
|
|
4496
|
-
"windows-sys 0.
|
|
4496
|
+
"windows-sys 0.52.0",
|
|
4497
4497
|
]
|
|
4498
4498
|
|
|
4499
4499
|
[[package]]
|
|
@@ -5103,7 +5103,7 @@ version = "0.1.9"
|
|
|
5103
5103
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
5104
5104
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
|
5105
5105
|
dependencies = [
|
|
5106
|
-
"windows-sys 0.
|
|
5106
|
+
"windows-sys 0.52.0",
|
|
5107
5107
|
]
|
|
5108
5108
|
|
|
5109
5109
|
[[package]]
|
data/ext/deltalake/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "deltalake-ruby"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.1"
|
|
4
4
|
license = "Apache-2.0"
|
|
5
5
|
authors = ["Andrew Kane <andrew@ankane.org>"]
|
|
6
6
|
edition = "2021"
|
|
@@ -26,7 +26,7 @@ tokio = { version = "1", features = ["rt-multi-thread"] }
|
|
|
26
26
|
uuid = { version = "1", features = ["serde", "v4"] }
|
|
27
27
|
|
|
28
28
|
[dependencies.deltalake]
|
|
29
|
-
version = "=0.32.
|
|
29
|
+
version = "=0.32.1"
|
|
30
30
|
features = [
|
|
31
31
|
"azure",
|
|
32
32
|
"datafusion",
|
data/ext/deltalake/src/lib.rs
CHANGED
|
@@ -6,7 +6,7 @@ mod schema;
|
|
|
6
6
|
mod utils;
|
|
7
7
|
|
|
8
8
|
use chrono::{DateTime, Duration, FixedOffset, Utc};
|
|
9
|
-
use delta_kernel::schema::StructField;
|
|
9
|
+
use delta_kernel::schema::{MetadataValue, StructField};
|
|
10
10
|
use delta_kernel::table_properties::DataSkippingNumIndexedCols;
|
|
11
11
|
use deltalake::arrow::ffi_stream::{ArrowArrayStreamReader, FFI_ArrowArrayStream};
|
|
12
12
|
use deltalake::arrow::record_batch::RecordBatchIterator;
|
|
@@ -22,10 +22,12 @@ use deltalake::logstore::IORuntime;
|
|
|
22
22
|
use deltalake::logstore::LogStoreRef;
|
|
23
23
|
use deltalake::operations::collect_sendable_stream;
|
|
24
24
|
use deltalake::operations::optimize::OptimizeType;
|
|
25
|
+
use deltalake::operations::update_table_metadata::TableMetadataUpdate;
|
|
25
26
|
use deltalake::parquet::basic::Compression;
|
|
26
27
|
use deltalake::parquet::errors::ParquetError;
|
|
27
28
|
use deltalake::parquet::file::properties::WriterProperties;
|
|
28
29
|
use deltalake::partitions::PartitionFilter;
|
|
30
|
+
use deltalake::protocol::log_compaction::compact_logs;
|
|
29
31
|
use deltalake::table::config::TablePropertiesExt;
|
|
30
32
|
use deltalake::table::state::DeltaTableState;
|
|
31
33
|
use deltalake::{DeltaResult, DeltaTable};
|
|
@@ -470,6 +472,49 @@ impl RawDeltaTable {
|
|
|
470
472
|
Ok(metrics.files_deleted)
|
|
471
473
|
}
|
|
472
474
|
|
|
475
|
+
#[allow(clippy::too_many_arguments)]
|
|
476
|
+
pub fn update(
|
|
477
|
+
rb: &Ruby,
|
|
478
|
+
self_: &Self,
|
|
479
|
+
updates: HashMap<String, String>,
|
|
480
|
+
predicate: Option<String>,
|
|
481
|
+
writer_properties: Option<RbWriterProperties>,
|
|
482
|
+
safe_cast: bool,
|
|
483
|
+
commit_properties: Option<RbCommitProperties>,
|
|
484
|
+
post_commithook_properties: Option<RbPostCommitHookProperties>,
|
|
485
|
+
) -> RbResult<String> {
|
|
486
|
+
let (table, metrics) = rb
|
|
487
|
+
.detach(|| {
|
|
488
|
+
let table = self_._table.lock().map_err(to_rt_err2)?.clone();
|
|
489
|
+
let mut cmd = table.update().with_safe_cast(safe_cast);
|
|
490
|
+
|
|
491
|
+
if let Some(writer_props) = writer_properties {
|
|
492
|
+
cmd = cmd.with_writer_properties(
|
|
493
|
+
set_writer_properties(writer_props).map_err(RubyError::from)?,
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
for (col_name, expression) in updates {
|
|
498
|
+
cmd = cmd.with_update(col_name.clone(), expression.clone());
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
if let Some(update_predicate) = predicate {
|
|
502
|
+
cmd = cmd.with_predicate(update_predicate);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
if let Some(commit_properties) =
|
|
506
|
+
maybe_create_commit_properties(commit_properties, post_commithook_properties)
|
|
507
|
+
{
|
|
508
|
+
cmd = cmd.with_commit_properties(commit_properties);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
rt().block_on(cmd.into_future()).map_err(RubyError::from)
|
|
512
|
+
})
|
|
513
|
+
.map_err(RbErr::from)?;
|
|
514
|
+
self_.set_state(table.state)?;
|
|
515
|
+
Ok(serde_json::to_string(&metrics).unwrap())
|
|
516
|
+
}
|
|
517
|
+
|
|
473
518
|
#[allow(clippy::too_many_arguments)]
|
|
474
519
|
pub fn compact_optimize(
|
|
475
520
|
rb: &Ruby,
|
|
@@ -664,8 +709,16 @@ impl RawDeltaTable {
|
|
|
664
709
|
Ok(())
|
|
665
710
|
}
|
|
666
711
|
|
|
712
|
+
pub fn generate(&self) -> RbResult<()> {
|
|
713
|
+
let table = self._table.lock().map_err(to_rt_err)?.clone();
|
|
714
|
+
rt().block_on(async { table.generate().await })
|
|
715
|
+
.map_err(RubyError::from)?;
|
|
716
|
+
Ok(())
|
|
717
|
+
}
|
|
718
|
+
|
|
667
719
|
pub fn load_cdf(
|
|
668
|
-
&
|
|
720
|
+
rb: &Ruby,
|
|
721
|
+
self_: &Self,
|
|
669
722
|
starting_version: Option<Version>,
|
|
670
723
|
ending_version: Option<Version>,
|
|
671
724
|
starting_timestamp: Option<String>,
|
|
@@ -673,7 +726,7 @@ impl RawDeltaTable {
|
|
|
673
726
|
columns: Option<Vec<String>>,
|
|
674
727
|
) -> RbResult<ArrowArrayStream> {
|
|
675
728
|
let ctx = SessionContext::new();
|
|
676
|
-
let table =
|
|
729
|
+
let table = self_._table.lock().map_err(to_rt_err)?.clone();
|
|
677
730
|
let mut cmd = table.scan_cdf();
|
|
678
731
|
|
|
679
732
|
if let Some(sv) = starting_version {
|
|
@@ -698,38 +751,41 @@ impl RawDeltaTable {
|
|
|
698
751
|
let table_provider: Arc<dyn TableProvider> =
|
|
699
752
|
Arc::new(DeltaCdfTableProvider::try_new(cmd).map_err(RubyError::from)?);
|
|
700
753
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
let
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
754
|
+
rb.detach(|| {
|
|
755
|
+
let plan = rt()
|
|
756
|
+
.block_on(async {
|
|
757
|
+
let mut df = ctx.read_table(table_provider)?;
|
|
758
|
+
if let Some(columns) = columns {
|
|
759
|
+
let cols: Vec<_> = columns.iter().map(|c| c.as_ref()).collect();
|
|
760
|
+
df = df.select_columns(&cols)?;
|
|
761
|
+
}
|
|
762
|
+
df.create_physical_plan().await
|
|
763
|
+
})
|
|
764
|
+
.map_err(RubyError::from)?;
|
|
711
765
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
766
|
+
let mut tasks = vec![];
|
|
767
|
+
for p in 0..plan.properties().output_partitioning().partition_count() {
|
|
768
|
+
let inner_plan = plan.clone();
|
|
769
|
+
let partition_batch = inner_plan.execute(p, ctx.task_ctx()).unwrap();
|
|
770
|
+
let handle = rt().spawn(collect_sendable_stream(partition_batch));
|
|
771
|
+
tasks.push(handle);
|
|
772
|
+
}
|
|
719
773
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
774
|
+
// This is unfortunate.
|
|
775
|
+
let batches = rt()
|
|
776
|
+
.block_on(join_all(tasks))
|
|
777
|
+
.into_iter()
|
|
778
|
+
.flatten()
|
|
779
|
+
.collect::<Result<Vec<Vec<_>>, _>>()
|
|
780
|
+
.unwrap()
|
|
781
|
+
.into_iter()
|
|
782
|
+
.flatten()
|
|
783
|
+
.map(Ok);
|
|
784
|
+
let batch_iter = RecordBatchIterator::new(batches, plan.schema());
|
|
785
|
+
let ffi_stream = FFI_ArrowArrayStream::new(Box::new(batch_iter));
|
|
786
|
+
Ok::<_, RubyError>(ArrowArrayStream { stream: ffi_stream })
|
|
787
|
+
})
|
|
788
|
+
.map_err(RbErr::from)
|
|
733
789
|
}
|
|
734
790
|
|
|
735
791
|
#[allow(clippy::too_many_arguments)]
|
|
@@ -903,6 +959,34 @@ impl RawDeltaTable {
|
|
|
903
959
|
.map_err(RbErr::from)
|
|
904
960
|
}
|
|
905
961
|
|
|
962
|
+
pub fn compact_logs(
|
|
963
|
+
rb: &Ruby,
|
|
964
|
+
self_: &Self,
|
|
965
|
+
starting_version: u64,
|
|
966
|
+
ending_version: u64,
|
|
967
|
+
) -> RbResult<()> {
|
|
968
|
+
rb.detach(|| {
|
|
969
|
+
let operation_id = Uuid::new_v4();
|
|
970
|
+
|
|
971
|
+
#[allow(clippy::await_holding_lock)]
|
|
972
|
+
let result = rt().block_on(async {
|
|
973
|
+
match self_._table.lock() {
|
|
974
|
+
Ok(table) => {
|
|
975
|
+
compact_logs(&table, starting_version, ending_version, Some(operation_id))
|
|
976
|
+
.await
|
|
977
|
+
.map_err(RubyError::from)
|
|
978
|
+
}
|
|
979
|
+
Err(e) => Err(RubyError::RuntimeError(e.to_string())),
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
result
|
|
984
|
+
})
|
|
985
|
+
.map_err(RbErr::from)?;
|
|
986
|
+
|
|
987
|
+
Ok(())
|
|
988
|
+
}
|
|
989
|
+
|
|
906
990
|
pub fn cleanup_metadata(rb: &Ruby, self_: &Self) -> RbResult<()> {
|
|
907
991
|
let (_result, new_state) = rb.detach(|| {
|
|
908
992
|
let operation_id = Uuid::new_v4();
|
|
@@ -1009,6 +1093,54 @@ impl RawDeltaTable {
|
|
|
1009
1093
|
Ok(())
|
|
1010
1094
|
}
|
|
1011
1095
|
|
|
1096
|
+
pub fn set_table_name(
|
|
1097
|
+
&self,
|
|
1098
|
+
name: String,
|
|
1099
|
+
commit_properties: Option<RbCommitProperties>,
|
|
1100
|
+
post_commithook_properties: Option<RbPostCommitHookProperties>,
|
|
1101
|
+
) -> RbResult<()> {
|
|
1102
|
+
let update = TableMetadataUpdate {
|
|
1103
|
+
name: Some(name),
|
|
1104
|
+
description: None,
|
|
1105
|
+
};
|
|
1106
|
+
let table = self._table.lock().map_err(to_rt_err)?.clone();
|
|
1107
|
+
let mut cmd = table.update_table_metadata().with_update(update);
|
|
1108
|
+
|
|
1109
|
+
if let Some(commit_properties) =
|
|
1110
|
+
maybe_create_commit_properties(commit_properties, post_commithook_properties)
|
|
1111
|
+
{
|
|
1112
|
+
cmd = cmd.with_commit_properties(commit_properties);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
let table = rt().block_on(cmd.into_future()).map_err(RubyError::from)?;
|
|
1116
|
+
self.set_state(table.state)?;
|
|
1117
|
+
Ok(())
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
pub fn set_table_description(
|
|
1121
|
+
&self,
|
|
1122
|
+
description: String,
|
|
1123
|
+
commit_properties: Option<RbCommitProperties>,
|
|
1124
|
+
post_commithook_properties: Option<RbPostCommitHookProperties>,
|
|
1125
|
+
) -> RbResult<()> {
|
|
1126
|
+
let update = TableMetadataUpdate {
|
|
1127
|
+
name: None,
|
|
1128
|
+
description: Some(description),
|
|
1129
|
+
};
|
|
1130
|
+
let table = self._table.lock().map_err(to_rt_err)?.clone();
|
|
1131
|
+
let mut cmd = table.update_table_metadata().with_update(update);
|
|
1132
|
+
|
|
1133
|
+
if let Some(commit_properties) =
|
|
1134
|
+
maybe_create_commit_properties(commit_properties, post_commithook_properties)
|
|
1135
|
+
{
|
|
1136
|
+
cmd = cmd.with_commit_properties(commit_properties);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
let table = rt().block_on(cmd.into_future()).map_err(RubyError::from)?;
|
|
1140
|
+
self.set_state(table.state)?;
|
|
1141
|
+
Ok(())
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1012
1144
|
pub fn repair(
|
|
1013
1145
|
&self,
|
|
1014
1146
|
dry_run: bool,
|
|
@@ -1038,6 +1170,40 @@ impl RawDeltaTable {
|
|
|
1038
1170
|
.map_err(RubyError::from)?)
|
|
1039
1171
|
}
|
|
1040
1172
|
|
|
1173
|
+
pub fn set_column_metadata(
|
|
1174
|
+
rb: &Ruby,
|
|
1175
|
+
self_: &Self,
|
|
1176
|
+
field_name: String,
|
|
1177
|
+
metadata: HashMap<String, String>,
|
|
1178
|
+
commit_properties: Option<RbCommitProperties>,
|
|
1179
|
+
post_commithook_properties: Option<RbPostCommitHookProperties>,
|
|
1180
|
+
) -> RbResult<()> {
|
|
1181
|
+
let table = rb
|
|
1182
|
+
.detach(|| {
|
|
1183
|
+
let table = self_._table.lock().map_err(to_rt_err2)?.clone();
|
|
1184
|
+
let mut cmd = table
|
|
1185
|
+
.update_field_metadata()
|
|
1186
|
+
.with_field_name(&field_name)
|
|
1187
|
+
.with_metadata(
|
|
1188
|
+
metadata
|
|
1189
|
+
.iter()
|
|
1190
|
+
.map(|(k, v)| (k.clone(), MetadataValue::String(v.clone())))
|
|
1191
|
+
.collect(),
|
|
1192
|
+
);
|
|
1193
|
+
|
|
1194
|
+
if let Some(commit_properties) =
|
|
1195
|
+
maybe_create_commit_properties(commit_properties, post_commithook_properties)
|
|
1196
|
+
{
|
|
1197
|
+
cmd = cmd.with_commit_properties(commit_properties)
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
rt().block_on(cmd.into_future()).map_err(RubyError::from)
|
|
1201
|
+
})
|
|
1202
|
+
.map_err(RbErr::from)?;
|
|
1203
|
+
self_.set_state(table.state)?;
|
|
1204
|
+
Ok(())
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1041
1207
|
#[allow(clippy::too_many_arguments)]
|
|
1042
1208
|
pub fn write(
|
|
1043
1209
|
rb: &Ruby,
|
|
@@ -1511,6 +1677,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1511
1677
|
class.define_method("file_uris", method!(RawDeltaTable::file_uris, 1))?;
|
|
1512
1678
|
class.define_method("schema", method!(RawDeltaTable::schema, 0))?;
|
|
1513
1679
|
class.define_method("vacuum", method!(RawDeltaTable::vacuum, 5))?;
|
|
1680
|
+
class.define_method("update", method!(RawDeltaTable::update, 6))?;
|
|
1514
1681
|
class.define_method(
|
|
1515
1682
|
"compact_optimize",
|
|
1516
1683
|
method!(RawDeltaTable::compact_optimize, 7),
|
|
@@ -1529,6 +1696,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1529
1696
|
"drop_constraints",
|
|
1530
1697
|
method!(RawDeltaTable::drop_constraints, 2),
|
|
1531
1698
|
)?;
|
|
1699
|
+
class.define_method("generate", method!(RawDeltaTable::generate, 0))?;
|
|
1532
1700
|
class.define_method("load_cdf", method!(RawDeltaTable::load_cdf, 5))?;
|
|
1533
1701
|
class.define_method(
|
|
1534
1702
|
"create_merge_builder",
|
|
@@ -1549,6 +1717,7 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1549
1717
|
"create_checkpoint",
|
|
1550
1718
|
method!(RawDeltaTable::create_checkpoint, 0),
|
|
1551
1719
|
)?;
|
|
1720
|
+
class.define_method("compact_logs", method!(RawDeltaTable::compact_logs, 2))?;
|
|
1552
1721
|
class.define_method(
|
|
1553
1722
|
"cleanup_metadata",
|
|
1554
1723
|
method!(RawDeltaTable::cleanup_metadata, 0),
|
|
@@ -1562,11 +1731,20 @@ fn init(ruby: &Ruby) -> RbResult<()> {
|
|
|
1562
1731
|
"set_table_properties",
|
|
1563
1732
|
method!(RawDeltaTable::set_table_properties, 2),
|
|
1564
1733
|
)?;
|
|
1734
|
+
class.define_method("set_table_name", method!(RawDeltaTable::set_table_name, 3))?;
|
|
1735
|
+
class.define_method(
|
|
1736
|
+
"set_table_description",
|
|
1737
|
+
method!(RawDeltaTable::set_table_description, 3),
|
|
1738
|
+
)?;
|
|
1565
1739
|
class.define_method("repair", method!(RawDeltaTable::repair, 3))?;
|
|
1566
1740
|
class.define_method(
|
|
1567
1741
|
"transaction_version",
|
|
1568
1742
|
method!(RawDeltaTable::transaction_version, 1),
|
|
1569
1743
|
)?;
|
|
1744
|
+
class.define_method(
|
|
1745
|
+
"set_column_metadata",
|
|
1746
|
+
method!(RawDeltaTable::set_column_metadata, 4),
|
|
1747
|
+
)?;
|
|
1570
1748
|
class.define_method("write", method!(RawDeltaTable::write, 12))?;
|
|
1571
1749
|
|
|
1572
1750
|
let class = module.define_class("RawDeltaTableMetaData", ruby.class_object())?;
|
data/lib/deltalake/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deltalake-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Kane
|
|
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: '0'
|
|
74
74
|
requirements: []
|
|
75
|
-
rubygems_version: 4.0.
|
|
75
|
+
rubygems_version: 4.0.10
|
|
76
76
|
specification_version: 4
|
|
77
77
|
summary: Delta Lake for Ruby
|
|
78
78
|
test_files: []
|