Skip to content

Commit

Permalink
Bumpup arrow2
Browse files Browse the repository at this point in the history
  • Loading branch information
sundy-li committed Nov 6, 2021
1 parent 0224fd2 commit 7c24c74
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 44 deletions.
67 changes: 45 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions common/arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ simd = ["arrow/simd"]
# Workspace dependencies

# Github dependencies
arrow = { package = "arrow2", git="https://github.com/datafuse-extras/arrow2", default-features = false, rev = "bd8f02b" }
arrow-format = { version = "0.2.1", features = ["flight-data", "flight-service"]}
arrow = { package = "arrow2", git="https://github.com/datafuse-extras/arrow2", default-features = false, rev = "83d828c" }
arrow-format = { version = "0.3.0", features = ["flight-data", "flight-service"]}
parquet2 = { version = "0.6", default_features = false }
# Crates.io dependencies

Expand Down
6 changes: 5 additions & 1 deletion common/datavalues/src/arrays/ops/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::sync::Arc;
use common_arrow::arrow::array::Array;
use common_arrow::arrow::array::ArrayRef;
use common_arrow::arrow::compute::cast;
use common_arrow::arrow::compute::cast::CastOptions;
use common_exception::ErrorCode;
use common_exception::Result;

Expand All @@ -38,7 +39,10 @@ fn cast_ca(ca: &dyn Array, data_type: &DataType) -> Result<Series> {
let arrow_type = data_type.to_arrow();
let arrow_type = get_physical_arrow_type(&arrow_type);
// we enable ignore_overflow by default
let array = cast::wrapping_cast(ca, arrow_type)?;
let array = cast::cast(ca, arrow_type, CastOptions {
wrapped: true,
partial: true,
})?;
let array: ArrayRef = Arc::from(array);
Ok(array.into_series())
}
Expand Down
14 changes: 9 additions & 5 deletions common/datavalues/src/arrays/primitive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use common_arrow::arrow::bitmap::Bitmap;
use common_arrow::arrow::buffer::Buffer;
use common_arrow::arrow::compute::arity::unary;
use common_arrow::arrow::compute::cast;
use common_arrow::arrow::compute::cast::CastOptions;
use common_arrow::arrow::datatypes::DataType as ArrowDataType;
use common_arrow::arrow::datatypes::TimeUnit;
use common_exception::ErrorCode;
Expand Down Expand Up @@ -62,7 +63,10 @@ impl<T: DFPrimitiveType> DFPrimitiveArray<T> {
pub fn from_arrow_array(array: &dyn Array) -> Self {
let expected_arrow_type = T::data_type().to_arrow();
let arrow_type = get_physical_arrow_type(array.data_type());

let cast_options = CastOptions {
wrapped: true,
partial: true,
};
if &expected_arrow_type != arrow_type {
match array.data_type() {
// u32
Expand All @@ -78,17 +82,17 @@ impl<T: DFPrimitiveType> DFPrimitiveArray<T> {
Self::from_arrow_array(&array)
}
ArrowDataType::Date32 => {
let array = cast::cast(array, &ArrowDataType::Int32)
let array = cast::cast(array, &ArrowDataType::Int32, cast_options)
.expect("primitive cast should be ok");
let array = cast::cast(array.as_ref(), &expected_arrow_type)
let array = cast::cast(array.as_ref(), &expected_arrow_type, cast_options)
.expect("primitive cast should be ok");

Self::from_arrow_array(array.as_ref())
}
ArrowDataType::Date64 => {
let array = cast::cast(array, &ArrowDataType::Int64)
let array = cast::cast(array, &ArrowDataType::Int64, cast_options)
.expect("primitive cast should be ok");
let array = cast::cast(array.as_ref(), &expected_arrow_type)
let array = cast::cast(array.as_ref(), &expected_arrow_type, cast_options)
.expect("primitive cast should be ok");

Self::from_arrow_array(array.as_ref())
Expand Down
4 changes: 2 additions & 2 deletions common/exception/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ backtrace = "0.3.63"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "1.0.30"
tonic = "0.5.2"
prost = "0.8.0"
tonic = "0.6.0"
prost = "0.9.0"
paste = "^1.0"

# Github dependencies
Expand Down
4 changes: 2 additions & 2 deletions common/flight-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ common-exception= {path = "../exception"}
futures = "0.3"
jwt-simple = "0.10.6"
log = "0.4"
prost = "0.8.0"
prost = "0.9.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio-stream = "0.1"
tonic = { version = "0.5.2", features = ["transport", "codegen", "prost", "tls-roots", "tls"] }
tonic = { version = "0.6.0", features = ["transport", "codegen", "prost", "tls-roots", "tls"] }
hyper = "0.14.14"
lazy_static = "1.4.0"
trust-dns-resolver = { version = "0.20.3", features = ["system-config"] }
Expand Down
5 changes: 3 additions & 2 deletions common/meta/flight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ async-trait = "0.1"
futures = "0.3"
jwt-simple = "0.10.6"
log = "0.4"
prost = "0.8.0"
prost = "0.9.0"
# prost-derive = "0.9.0"
rand = "0.8.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio-stream = "0.1"
tonic = { version = "0.5.2", features = ["transport", "codegen", "prost", "tls-roots", "tls"] }
tonic = { version = "0.6.0", features = ["transport", "codegen", "prost", "tls-roots", "tls"] }
hyper = "0.14.14"
lazy_static = "1.4.0"
trust-dns-resolver = { version = "0.20.3", features = ["system-config"] }
Expand Down
2 changes: 1 addition & 1 deletion common/tracing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edition = "2021"
lazy_static = "1.4.0"
opentelemetry = { version = "0.16", default-features = false, features = ["trace", "rt-tokio"] }
opentelemetry-jaeger = { version = "0.15", features = ["rt-tokio"] }
tonic = "0.5.2"
tonic = "0.6.0"
tracing = "0.1.29"
tracing-appender = "0.2.0"
tracing-bunyan-formatter = "0.3.0"
Expand Down
4 changes: 2 additions & 2 deletions metasrv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ metrics = "0.17.0"
metrics-exporter-prometheus = "0.6.0"
num = "0.4"
num_cpus = "1.0"
prost = "0.8.0"
prost = "0.9.0"
rand = "0.8.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand All @@ -61,7 +61,7 @@ tempfile = "3.2.0"
thiserror = "1.0.30"
threadpool = "1.8.1"
tokio-stream = "0.1"
tonic = { version = "0.5.2", features = ["tls"]}
tonic = { version = "0.6.0", features = ["tls"]}

sha2 = "0.9.8"
uuid = { version = "0.8", features = ["serde", "v4"] }
Expand Down
4 changes: 2 additions & 2 deletions query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ nom = "7.0.0"
num = "0.4"
num_cpus = "1.0"
paste = "^1.0"
prost = "0.8.0"
prost = "0.9.0"
quantiles = "0.7.1"
rand = "0.8.4"
rusoto_core = "0.47.0"
Expand All @@ -94,7 +94,7 @@ threadpool = "1.8.1"
tokio-rustls = "0.22.0"
tokio-stream = { version = "0.1", features = ["net"] }
toml = "0.5.8"
tonic = "0.5.2"
tonic = "0.6.0"
uuid = { version = "0.8", features = ["serde", "v4"] }
walkdir = "2.3.2"

Expand Down
6 changes: 3 additions & 3 deletions query/src/api/rpc/flight_service_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use std::convert::TryInto;

use common_arrow::arrow::io::flight::serialize_batch;
use common_arrow::arrow::io::ipc::write::common::IpcWriteOptions;
use common_arrow::arrow::io::ipc::write::WriteOptions;
use common_arrow::arrow_format::flight::data::FlightData;
use common_base::tokio::macros::support::Pin;
use common_base::tokio::macros::support::Poll;
Expand All @@ -27,14 +27,14 @@ use tonic::Status;

pub struct FlightDataStream {
input: Receiver<common_exception::Result<DataBlock>>,
options: IpcWriteOptions,
options: WriteOptions,
}

impl FlightDataStream {
pub fn create(input: Receiver<common_exception::Result<DataBlock>>) -> FlightDataStream {
FlightDataStream {
input,
options: IpcWriteOptions::default(),
options: WriteOptions { compression: None },
}
}
}
Expand Down

0 comments on commit 7c24c74

Please sign in to comment.