-
Notifications
You must be signed in to change notification settings - Fork 58
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: introduce feature flags to select major arrow versions #654
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
integration-test,default-engine,default-engine-rustls,cloud,arrow,sync-engine |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,15 +1,18 @@ | ||||||||||||||||||
use std::{path::Path, sync::Arc}; | ||||||||||||||||||
|
||||||||||||||||||
use arrow_array::{Array, RecordBatch}; | ||||||||||||||||||
use arrow_ord::sort::{lexsort_to_indices, SortColumn}; | ||||||||||||||||||
use arrow_schema::{DataType, Schema}; | ||||||||||||||||||
use arrow_select::{concat::concat_batches, filter::filter_record_batch, take::take}; | ||||||||||||||||||
use delta_kernel::arrow::array::{Array, RecordBatch}; | ||||||||||||||||||
use delta_kernel::arrow::compute::{ | ||||||||||||||||||
concat_batches, filter_record_batch, lexsort_to_indices, take, SortColumn, | ||||||||||||||||||
}; | ||||||||||||||||||
use delta_kernel::arrow::datatypes::{DataType, Schema}; | ||||||||||||||||||
|
||||||||||||||||||
use delta_kernel::parquet::arrow::async_reader::{ | ||||||||||||||||||
ParquetObjectReader, ParquetRecordBatchStreamBuilder, | ||||||||||||||||||
}; | ||||||||||||||||||
use delta_kernel::{engine::arrow_data::ArrowEngineData, DeltaResult, Engine, Error, Table}; | ||||||||||||||||||
use futures::{stream::TryStreamExt, StreamExt}; | ||||||||||||||||||
use itertools::Itertools; | ||||||||||||||||||
use object_store::{local::LocalFileSystem, ObjectStore}; | ||||||||||||||||||
use parquet::arrow::async_reader::{ParquetObjectReader, ParquetRecordBatchStreamBuilder}; | ||||||||||||||||||
|
||||||||||||||||||
use crate::{TestCaseInfo, TestResult}; | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -83,8 +86,11 @@ fn assert_schema_fields_match(schema: &Schema, golden: &Schema) { | |||||||||||||||||
fn normalize_col(col: Arc<dyn Array>) -> Arc<dyn Array> { | ||||||||||||||||||
if let DataType::Timestamp(unit, Some(zone)) = col.data_type() { | ||||||||||||||||||
if **zone == *"+00:00" { | ||||||||||||||||||
arrow_cast::cast::cast(&col, &DataType::Timestamp(*unit, Some("UTC".into()))) | ||||||||||||||||||
.expect("Could not cast to UTC") | ||||||||||||||||||
delta_kernel::arrow::compute::cast( | ||||||||||||||||||
&col, | ||||||||||||||||||
&DataType::Timestamp(*unit, Some("UTC".into())), | ||||||||||||||||||
) | ||||||||||||||||||
.expect("Could not cast to UTC") | ||||||||||||||||||
Comment on lines
+89
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||||||||||
} else { | ||||||||||||||||||
col | ||||||||||||||||||
} | ||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,7 +24,7 @@ url = "2" | |||||
delta_kernel = { path = "../kernel", default-features = false, features = [ | ||||||
"developer-visibility", | ||||||
] } | ||||||
delta_kernel_ffi_macros = { path = "../ffi-proc-macros", version = "0.6.1" } | ||||||
delta_kernel_ffi_macros = { path = "../ffi-proc-macros", version = "0.7.0" } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
# used if we use the default engine to be able to move arrow data into the c-ffi format | ||||||
arrow-schema = { version = ">=53, <55", default-features = false, features = [ | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -39,27 +39,29 @@ uuid = "1.10.0" | |||||
z85 = "3.0.5" | ||||||
|
||||||
# bring in our derive macros | ||||||
delta_kernel_derive = { path = "../derive-macros", version = "0.6.1" } | ||||||
delta_kernel_derive = { path = "../derive-macros", version = "0.7.0" } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
# used for developer-visibility | ||||||
visibility = "0.1.1" | ||||||
|
||||||
# Used in the sync engine | ||||||
tempfile = { version = "3", optional = true } | ||||||
|
||||||
# Arrow supported versions | ||||||
## 53 | ||||||
# Used in default engine | ||||||
arrow-buffer = { workspace = true, optional = true } | ||||||
arrow-array = { workspace = true, optional = true, features = ["chrono-tz"] } | ||||||
arrow-select = { workspace = true, optional = true } | ||||||
arrow-arith = { workspace = true, optional = true } | ||||||
arrow-cast = { workspace = true, optional = true } | ||||||
arrow-json = { workspace = true, optional = true } | ||||||
arrow-ord = { workspace = true, optional = true } | ||||||
arrow-schema = { workspace = true, optional = true } | ||||||
arrow_53 = { package = "arrow", version = "53", features = ["chrono-tz", "json", "prettyprint"], optional = true } | ||||||
# Used in default and sync engine | ||||||
parquet_53 = { package = "parquet", version = "53", features = ["async", "object_store"] , optional = true } | ||||||
###### | ||||||
## 54 | ||||||
arrow_54 = { package = "arrow", version = "54", features = ["chrono-tz", "json", "prettyprint"], optional = true } | ||||||
parquet_54 = { package = "parquet", version = "54", features = ["async", "object_store"] , optional = true } | ||||||
###### | ||||||
Comment on lines
+50
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Crazy idea... what if we defined the features as lower bounds instead of equality matches? So if e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a nice idea, but I don't think cargo can support it. That is, you do have to specify something like: arrow_53 = { package = "arrow", version = "53", features = ["chrono-tz", "json", "prettyprint"], optional = true }
arrow_54 = { package = "arrow", version = "54", features = ["chrono-tz", "json", "prettyprint"], optional = true } Somewhere to specify the optional dependencies. So now if we want a feature like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are two parts to this trick:
But in retrospect, you're probably right... we can't use the original names to make decisions for the extern crate decl, and if we want e.g. Maybe it still works, tho? Technically both arrow versions would be dependencies, but only the one mapped in as an extern crate would actually get used by any kernel code? (ugh, cargo... this shouldn't be so difficult!) |
||||||
|
||||||
futures = { version = "0.3", optional = true } | ||||||
object_store = { workspace = true, optional = true } | ||||||
hdfs-native-object-store = { workspace = true, optional = true } | ||||||
# Used in default and sync engine | ||||||
parquet = { workspace = true, optional = true } | ||||||
# Used for fetching direct urls (like pre-signed urls) | ||||||
reqwest = { version = "0.12.8", default-features = false, optional = true } | ||||||
strum = { version = "0.26", features = ["derive"] } | ||||||
|
@@ -73,8 +75,20 @@ hdfs-native = { workspace = true, optional = true } | |||||
walkdir = { workspace = true, optional = true } | ||||||
|
||||||
[features] | ||||||
arrow-conversion = ["arrow-schema"] | ||||||
arrow-expression = ["arrow-arith", "arrow-array", "arrow-buffer", "arrow-ord", "arrow-schema"] | ||||||
# The default version to be expected | ||||||
arrow = ["arrow_53"] | ||||||
# The default version to be expected | ||||||
parquet = ["parquet_53"] | ||||||
|
||||||
arrow_53 = ["dep:arrow_53", "parquet_53"] | ||||||
parquet_53 = ["dep:parquet_53"] | ||||||
|
||||||
arrow_54 = ["dep:arrow_54", "parquet_54"] | ||||||
parquet_54 = ["dep:parquet_54"] | ||||||
|
||||||
arrow-conversion = [] | ||||||
arrow-expression = [] | ||||||
|
||||||
cloud = [ | ||||||
"object_store/aws", | ||||||
"object_store/azure", | ||||||
|
@@ -89,16 +103,8 @@ default = [] | |||||
default-engine-base = [ | ||||||
"arrow-conversion", | ||||||
"arrow-expression", | ||||||
"arrow-array", | ||||||
"arrow-buffer", | ||||||
"arrow-cast", | ||||||
"arrow-json", | ||||||
"arrow-schema", | ||||||
"arrow-select", | ||||||
"futures", | ||||||
"object_store", | ||||||
"parquet/async", | ||||||
"parquet/object_store", | ||||||
"tokio", | ||||||
"uuid/v4", | ||||||
"uuid/fast-rng", | ||||||
|
@@ -119,13 +125,6 @@ default-engine-rustls = [ | |||||
|
||||||
developer-visibility = [] | ||||||
sync-engine = [ | ||||||
"arrow-cast", | ||||||
"arrow-conversion", | ||||||
"arrow-expression", | ||||||
"arrow-array", | ||||||
"arrow-json", | ||||||
"arrow-select", | ||||||
"parquet", | ||||||
"tempfile", | ||||||
] | ||||||
integration-test = [ | ||||||
|
@@ -141,7 +140,6 @@ version = "=0.5.9" | |||||
rustc_version = "0.4.1" | ||||||
|
||||||
[dev-dependencies] | ||||||
arrow = { workspace = true, features = ["json", "prettyprint"] } | ||||||
delta_kernel = { path = ".", features = ["default-engine", "sync-engine"] } | ||||||
test_utils = { path = "../test-utils" } | ||||||
paste = "1.0" | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,11 @@ | ||||||||||
//! This module exists to help re-export the version of arrow used by default-gengine and other | ||||||||||
//! parts of kernel that need arrow | ||||||||||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
#[cfg(all(feature = "arrow_53", feature = "arrow_54"))] | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oof, this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought the plan was to only support 2-3 versions max at a time? Tho even 3 already makes this pretty ugly... and agree we'd need to split it into multiple checks, e.g. all(v1, v2); all(v1, v3); all(v2, v3). |
||||||||||
compile_error!("Multiple versions of the arrow cannot be used at the same time!"); | ||||||||||
|
||||||||||
#[cfg(feature = "arrow_53")] | ||||||||||
pub use arrow_53::*; | ||||||||||
|
||||||||||
#[cfg(feature = "arrow_54")] | ||||||||||
pub use arrow_54::*; |
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.
I usually do the updates to version all at once during a release