Skip to content

Commit ee2de0c

Browse files
committed
Update for new APIs, update other dependencies
1 parent 114ea61 commit ee2de0c

33 files changed

+437
-491
lines changed

Cargo.lock

Lines changed: 45 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ parquet = { version = "56.2.0", default-features = false, features = [
162162
"async",
163163
"object_store",
164164
] }
165-
pbjson = { version = "0.7.0" }
166-
pbjson-types = "0.7"
167-
# Should match arrow-flight's version of prost.
165+
pbjson = { version = "0.8.0" }
166+
pbjson-types = "0.8"
168167
insta = { version = "1.43.2", features = ["glob", "filters"] }
169-
prost = "0.13.1"
168+
# Should match arrow-flight's version of prost.
169+
prost = "0.14.1"
170170
rand = "0.9"
171171
recursive = "0.1.1"
172172
regex = "1.11"

datafusion-examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ serde_json = { workspace = true }
8181
tempfile = { workspace = true }
8282
test-utils = { path = "../test-utils" }
8383
tokio = { workspace = true, features = ["rt-multi-thread", "parking_lot"] }
84-
tonic = "0.13.1"
84+
tonic = "0.14"
8585
tracing = { version = "0.1" }
8686
tracing-subscriber = { version = "0.3" }
8787
url = { workspace = true }

datafusion-examples/examples/flight/flight_client.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
use std::collections::HashMap;
1919
use std::sync::Arc;
20+
use tonic::transport::Endpoint;
2021

2122
use datafusion::arrow::datatypes::Schema;
2223

@@ -34,7 +35,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3435
let testdata = datafusion::test_util::parquet_test_data();
3536

3637
// Create Flight client
37-
let mut client = FlightServiceClient::connect("http://localhost:50051").await?;
38+
let endpoint = Endpoint::new("http://localhost:50051")?;
39+
let channel = endpoint.connect().await?;
40+
let mut client = FlightServiceClient::new(channel);
3841

3942
// Call get_schema to get the schema of a Parquet file
4043
let request = tonic::Request::new(FlightDescriptor {

datafusion-examples/examples/flight/flight_server.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use arrow::ipc::writer::{DictionaryTracker, IpcDataGenerator};
18+
use arrow::ipc::writer::{CompressionContext, DictionaryTracker, IpcDataGenerator};
1919
use std::sync::Arc;
2020

2121
use arrow_flight::{PollInfo, SchemaAsIpc};
@@ -106,6 +106,7 @@ impl FlightService for FlightServiceImpl {
106106

107107
// add an initial FlightData message that sends schema
108108
let options = arrow::ipc::writer::IpcWriteOptions::default();
109+
let mut compression_context = CompressionContext::default();
109110
let schema_flight_data = SchemaAsIpc::new(&schema, &options);
110111

111112
let mut flights = vec![FlightData::from(schema_flight_data)];
@@ -115,7 +116,7 @@ impl FlightService for FlightServiceImpl {
115116

116117
for batch in &results {
117118
let (flight_dictionaries, flight_batch) = encoder
118-
.encoded_batch(batch, &mut tracker, &options)
119+
.encode(batch, &mut tracker, &options, &mut compression_context)
119120
.map_err(|e: ArrowError| Status::internal(e.to_string()))?;
120121

121122
flights.extend(flight_dictionaries.into_iter().map(Into::into));

datafusion/functions-aggregate-common/src/utils.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ pub struct DecimalAverager<T: DecimalType> {
9595
target_mul: T::Native,
9696
/// the output precision
9797
target_precision: u8,
98+
/// the output scale
99+
target_scale: i8,
98100
}
99101

100102
impl<T: DecimalType> DecimalAverager<T> {
@@ -127,6 +129,7 @@ impl<T: DecimalType> DecimalAverager<T> {
127129
sum_mul,
128130
target_mul,
129131
target_precision,
132+
target_scale,
130133
})
131134
} else {
132135
// can't convert the lit decimal to the returned data type
@@ -145,8 +148,11 @@ impl<T: DecimalType> DecimalAverager<T> {
145148
if let Ok(value) = sum.mul_checked(self.target_mul.div_wrapping(self.sum_mul)) {
146149
let new_value = value.div_wrapping(count);
147150

148-
let validate =
149-
T::validate_decimal_precision(new_value, self.target_precision);
151+
let validate = T::validate_decimal_precision(
152+
new_value,
153+
self.target_precision,
154+
self.target_scale,
155+
);
150156

151157
if validate.is_ok() {
152158
Ok(new_value)

datafusion/proto-common/src/to_proto/mod.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ use arrow::datatypes::{
2828
DataType, Field, IntervalDayTimeType, IntervalMonthDayNanoType, IntervalUnit, Schema,
2929
SchemaRef, TimeUnit, UnionMode,
3030
};
31-
use arrow::ipc::writer::{DictionaryTracker, IpcDataGenerator};
31+
use arrow::ipc::writer::{
32+
CompressionContext, DictionaryTracker, IpcDataGenerator, IpcWriteOptions,
33+
};
3234
use datafusion_common::{
3335
config::{
3436
CsvOptions, JsonOptions, ParquetColumnOptions, ParquetOptions,
@@ -1018,8 +1020,15 @@ fn encode_scalar_nested_value(
10181020

10191021
let gen = IpcDataGenerator {};
10201022
let mut dict_tracker = DictionaryTracker::new(false);
1023+
let write_options = IpcWriteOptions::default();
1024+
let mut compression_context = CompressionContext::default();
10211025
let (encoded_dictionaries, encoded_message) = gen
1022-
.encoded_batch(&batch, &mut dict_tracker, &Default::default())
1026+
.encode(
1027+
&batch,
1028+
&mut dict_tracker,
1029+
&write_options,
1030+
&mut compression_context,
1031+
)
10231032
.map_err(|e| {
10241033
Error::General(format!("Error encoding ScalarValue::List as IPC: {e}"))
10251034
})?;

0 commit comments

Comments
 (0)