Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 104 additions & 243 deletions Cargo.lock

Large diffs are not rendered by default.

37 changes: 33 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ half = { version = "2.7.0", default-features = false }
hashbrown = { version = "0.14.5", features = ["raw"] }
hex = { version = "0.4.3" }
indexmap = "2.11.4"
insta = { version = "1.43.2", features = ["glob", "filters"] }
itertools = "0.14"
log = "^0.4"
object_store = { version = "0.12.4", default-features = false }
Expand All @@ -164,11 +165,10 @@ parquet = { version = "56.2.0", default-features = false, features = [
"async",
"object_store",
] }
pbjson = { version = "0.7.0" }
pbjson-types = "0.7"
pbjson = { version = "0.8.0" }
pbjson-types = "0.8"
# Should match arrow-flight's version of prost.
insta = { version = "1.43.2", features = ["glob", "filters"] }
prost = "0.13.1"
prost = "0.14.1"
rand = "0.9"
recursive = "0.1.1"
regex = "1.11"
Expand Down Expand Up @@ -260,3 +260,32 @@ incremental = false
inherits = "release"
debug = true
strip = false

[patch.crates-io]
# Local pin
# arrow = { path = "/Users/andrewlamb/Software/arrow-rs/arrow" }
# arrow-array = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-array" }
# arrow-buffer = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-buffer" }
# arrow-cast = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-cast" }
# arrow-data = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-data" }
# arrow-ipc = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-ipc" }
# arrow-schema = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-schema" }
# arrow-select = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-select" }
# arrow-string = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-string" }
# arrow-ord = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-ord" }
# arrow-flight = { path = "/Users/andrewlamb/Software/arrow-rs/arrow-flight" }
# parquet = { path = "/Users/andrewlamb/Software/arrow-rs/parquet" }

# latest arrow main: https://github.com/apache/arrow-rs
arrow = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-array = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-buffer = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-cast = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-data = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-ipc = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-schema = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-select = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-string = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-ord = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
arrow-flight = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
parquet = { git = "https://github.com/apache/arrow-rs.git", rev = "d49f017fe1c6712ba32e2222c6f031278b588ca5" }
4 changes: 3 additions & 1 deletion datafusion-cli/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@ impl TableFunctionImpl for ParquetMetadataFunc {
stats_max_value_arr.push(None);
};
compression_arr.push(format!("{:?}", column.compression()));
encodings_arr.push(format!("{:?}", column.encodings()));
// need to collect into Vec to format
let encodings: Vec<_> = column.encodings().collect();
encodings_arr.push(format!("{:?}", encodings));
index_page_offset_arr.push(column.index_page_offset());
dictionary_page_offset_arr.push(column.dictionary_page_offset());
data_page_offset_arr.push(column.data_page_offset());
Expand Down
18 changes: 9 additions & 9 deletions datafusion-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ mod tests {
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| filename | row_group_id | row_group_num_rows | row_group_num_columns | row_group_bytes | column_id | file_offset | num_values | path_in_schema | type | stats_min | stats_max | stats_null_count | stats_distinct_count | stats_min_value | stats_max_value | compression | encodings | index_page_offset | dictionary_page_offset | data_page_offset | total_compressed_size | total_uncompressed_size |
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| ../datafusion/core/tests/data/fixed_size_list_array.parquet | 0 | 2 | 1 | 123 | 0 | 125 | 4 | "f0.list.item" | INT64 | 1 | 4 | 0 | | 1 | 4 | SNAPPY | [RLE_DICTIONARY, PLAIN, RLE] | | 4 | 46 | 121 | 123 |
| ../datafusion/core/tests/data/fixed_size_list_array.parquet | 0 | 2 | 1 | 123 | 0 | 125 | 4 | "f0.list.item" | INT64 | 1 | 4 | 0 | | 1 | 4 | SNAPPY | [PLAIN, RLE, RLE_DICTIONARY] | | 4 | 46 | 121 | 123 |
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
"#);

Expand All @@ -510,7 +510,7 @@ mod tests {
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| filename | row_group_id | row_group_num_rows | row_group_num_columns | row_group_bytes | column_id | file_offset | num_values | path_in_schema | type | stats_min | stats_max | stats_null_count | stats_distinct_count | stats_min_value | stats_max_value | compression | encodings | index_page_offset | dictionary_page_offset | data_page_offset | total_compressed_size | total_uncompressed_size |
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| ../datafusion/core/tests/data/fixed_size_list_array.parquet | 0 | 2 | 1 | 123 | 0 | 125 | 4 | "f0.list.item" | INT64 | 1 | 4 | 0 | | 1 | 4 | SNAPPY | [RLE_DICTIONARY, PLAIN, RLE] | | 4 | 46 | 121 | 123 |
| ../datafusion/core/tests/data/fixed_size_list_array.parquet | 0 | 2 | 1 | 123 | 0 | 125 | 4 | "f0.list.item" | INT64 | 1 | 4 | 0 | | 1 | 4 | SNAPPY | [PLAIN, RLE, RLE_DICTIONARY] | | 4 | 46 | 121 | 123 |
+-------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+-------+-----------+-----------+------------------+----------------------+-----------------+-----------------+-------------+------------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
"#);

Expand All @@ -532,7 +532,7 @@ mod tests {
+-----------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+------------+-----------+-----------+------------------+----------------------+-----------------+-----------------+--------------------+--------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| filename | row_group_id | row_group_num_rows | row_group_num_columns | row_group_bytes | column_id | file_offset | num_values | path_in_schema | type | stats_min | stats_max | stats_null_count | stats_distinct_count | stats_min_value | stats_max_value | compression | encodings | index_page_offset | dictionary_page_offset | data_page_offset | total_compressed_size | total_uncompressed_size |
+-----------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+------------+-----------+-----------+------------------+----------------------+-----------------+-----------------+--------------------+--------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
| ../parquet-testing/data/data_index_bloom_encoding_stats.parquet | 0 | 14 | 1 | 163 | 0 | 4 | 14 | "String" | BYTE_ARRAY | Hello | today | 0 | | Hello | today | GZIP(GzipLevel(6)) | [BIT_PACKED, RLE, PLAIN] | | | 4 | 152 | 163 |
| ../parquet-testing/data/data_index_bloom_encoding_stats.parquet | 0 | 14 | 1 | 163 | 0 | 4 | 14 | "String" | BYTE_ARRAY | Hello | today | 0 | | Hello | today | GZIP(GzipLevel(6)) | [PLAIN, RLE, BIT_PACKED] | | | 4 | 152 | 163 |
+-----------------------------------------------------------------+--------------+--------------------+-----------------------+-----------------+-----------+-------------+------------+----------------+------------+-----------+-----------+------------------+----------------------+-----------------+-----------------+--------------------+--------------------------+-------------------+------------------------+------------------+-----------------------+-------------------------+
"#);

Expand Down Expand Up @@ -592,9 +592,9 @@ mod tests {
+-----------------------------------+-----------------+---------------------+------+------------------+
| filename | file_size_bytes | metadata_size_bytes | hits | extra |
+-----------------------------------+-----------------+---------------------+------+------------------+
| alltypes_plain.parquet | 1851 | 10181 | 2 | page_index=false |
| alltypes_tiny_pages.parquet | 454233 | 881418 | 2 | page_index=true |
| lz4_raw_compressed_larger.parquet | 380836 | 2939 | 2 | page_index=false |
| alltypes_plain.parquet | 1851 | 6957 | 2 | page_index=false |
| alltypes_tiny_pages.parquet | 454233 | 267014 | 2 | page_index=true |
| lz4_raw_compressed_larger.parquet | 380836 | 996 | 2 | page_index=false |
+-----------------------------------+-----------------+---------------------+------+------------------+
");

Expand Down Expand Up @@ -623,9 +623,9 @@ mod tests {
+-----------------------------------+-----------------+---------------------+------+------------------+
| filename | file_size_bytes | metadata_size_bytes | hits | extra |
+-----------------------------------+-----------------+---------------------+------+------------------+
| alltypes_plain.parquet | 1851 | 10181 | 5 | page_index=false |
| alltypes_tiny_pages.parquet | 454233 | 881418 | 2 | page_index=true |
| lz4_raw_compressed_larger.parquet | 380836 | 2939 | 3 | page_index=false |
| alltypes_plain.parquet | 1851 | 6957 | 5 | page_index=false |
| alltypes_tiny_pages.parquet | 454233 | 267014 | 2 | page_index=true |
| lz4_raw_compressed_larger.parquet | 380836 | 996 | 3 | page_index=false |
+-----------------------------------+-----------------+---------------------+------+------------------+
");

Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ serde_json = { workspace = true }
tempfile = { workspace = true }
test-utils = { path = "../test-utils" }
tokio = { workspace = true, features = ["rt-multi-thread", "parking_lot"] }
tonic = "0.13.1"
tonic = "0.14"
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3" }
url = { workspace = true }
Expand Down
5 changes: 4 additions & 1 deletion datafusion-examples/examples/flight/flight_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use std::collections::HashMap;
use std::sync::Arc;
use tonic::transport::Endpoint;

use datafusion::arrow::datatypes::Schema;

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

// Create Flight client
let mut client = FlightServiceClient::connect("http://localhost:50051").await?;
let endpoint = Endpoint::new("http://localhost:50051")?;
let channel = endpoint.connect().await?;
let mut client = FlightServiceClient::new(channel);

// Call get_schema to get the schema of a Parquet file
let request = tonic::Request::new(FlightDescriptor {
Expand Down
5 changes: 3 additions & 2 deletions datafusion-examples/examples/flight/flight_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

use arrow::ipc::writer::{DictionaryTracker, IpcDataGenerator};
use arrow::ipc::writer::{CompressionContext, DictionaryTracker, IpcDataGenerator};
use std::sync::Arc;

use arrow_flight::{PollInfo, SchemaAsIpc};
Expand Down Expand Up @@ -106,6 +106,7 @@ impl FlightService for FlightServiceImpl {

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

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

for batch in &results {
let (flight_dictionaries, flight_batch) = encoder
.encoded_batch(batch, &mut tracker, &options)
.encode(batch, &mut tracker, &options, &mut compression_context)
.map_err(|e: ArrowError| Status::internal(e.to_string()))?;

flights.extend(flight_dictionaries.into_iter().map(Into::into));
Expand Down
8 changes: 5 additions & 3 deletions datafusion-examples/examples/parquet_encrypted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
// under the License.

use datafusion::common::DataFusionError;
use datafusion::config::TableParquetOptions;
use datafusion::config::{ConfigFileEncryptionProperties, TableParquetOptions};
use datafusion::dataframe::{DataFrame, DataFrameWriteOptions};
use datafusion::logical_expr::{col, lit};
use datafusion::parquet::encryption::decrypt::FileDecryptionProperties;
use datafusion::parquet::encryption::encrypt::FileEncryptionProperties;
use datafusion::prelude::{ParquetReadOptions, SessionContext};
use std::sync::Arc;
use tempfile::TempDir;

#[tokio::main]
Expand Down Expand Up @@ -55,7 +56,7 @@ async fn main() -> datafusion::common::Result<()> {

// Write encrypted parquet
let mut options = TableParquetOptions::default();
options.crypto.file_encryption = Some((&encrypt).into());
options.crypto.file_encryption = Some(ConfigFileEncryptionProperties::from(&encrypt));
parquet_df
.write_parquet(
tempfile_str.as_str(),
Expand Down Expand Up @@ -100,7 +101,8 @@ async fn query_dataframe(df: &DataFrame) -> Result<(), DataFusionError> {
// Setup encryption and decryption properties
fn setup_encryption(
parquet_df: &DataFrame,
) -> Result<(FileEncryptionProperties, FileDecryptionProperties), DataFusionError> {
) -> Result<(Arc<FileEncryptionProperties>, Arc<FileDecryptionProperties>), DataFusionError>
{
let schema = parquet_df.schema();
let footer_key = b"0123456789012345".to_vec(); // 128bit/16
let column_key = b"1234567890123450".to_vec(); // 128bit/16
Expand Down
4 changes: 2 additions & 2 deletions datafusion-examples/examples/parquet_encrypted_with_kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl EncryptionFactory for TestEncryptionFactory {
options: &EncryptionFactoryOptions,
schema: &SchemaRef,
_file_path: &Path,
) -> Result<Option<FileEncryptionProperties>> {
) -> Result<Option<Arc<FileEncryptionProperties>>> {
let config: EncryptionConfig = options.to_extension_options()?;

// Generate a random encryption key for this file.
Expand Down Expand Up @@ -268,7 +268,7 @@ impl EncryptionFactory for TestEncryptionFactory {
&self,
_options: &EncryptionFactoryOptions,
_file_path: &Path,
) -> Result<Option<FileDecryptionProperties>> {
) -> Result<Option<Arc<FileDecryptionProperties>>> {
let decryption_properties =
FileDecryptionProperties::with_key_retriever(Arc::new(TestKeyRetriever {}))
.build()?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ log = { workspace = true }
object_store = { workspace = true, optional = true }
parquet = { workspace = true, optional = true, default-features = true }
paste = "1.0.15"
pyo3 = { version = "0.25", optional = true }
pyo3 = { version = "0.26", optional = true }
recursive = { workspace = true, optional = true }
sqlparser = { workspace = true, optional = true }
tokio = { workspace = true }
Expand Down
Loading
Loading