Skip to content
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: add stats to convert-to-delta operation #2491

Merged
merged 7 commits into from
May 15, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Pick up config options on which columns to skip
  • Loading branch information
gruuya committed May 14, 2024
commit 1191aa50e0a84cb7cb63fa4f1f9b9dce748c152c
9 changes: 7 additions & 2 deletions crates/core/src/operations/convert_to_delta.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Command for converting a Parquet table to a Delta table in place
// https://github.com/delta-io/delta/blob/1d5dd774111395b0c4dc1a69c94abc169b1c83b6/spark/src/main/scala/org/apache/spark/sql/delta/commands/ConvertToDeltaCommand.scala

use crate::operations::write::get_num_idx_cols_and_stats_columns;
use crate::{
kernel::{Add, DataType, Schema, StructField},
logstore::{LogStore, LogStoreRef},
Expand Down Expand Up @@ -286,6 +287,10 @@ impl ConvertToDeltaBuilder {
// A vector of StructField of all unique partition columns in a Parquet table
let mut partition_schema_fields = HashMap::new();

// Obtain settings on which columns to skip collecting stats on if any
let (num_indexed_cols, stats_columns) =
get_num_idx_cols_and_stats_columns(None, self.configuration.clone());

for file in files {
// A HashMap from partition column to value for this parquet file only
let mut partition_values = HashMap::new();
Expand Down Expand Up @@ -341,8 +346,8 @@ impl ConvertToDeltaBuilder {
let stats = stats_from_parquet_metadata(
&IndexMap::from_iter(partition_values.clone().into_iter()),
parquet_metadata.as_ref(),
-1,
&None,
num_indexed_cols,
&stats_columns,
)
.map_err(|e| Error::DeltaTable(e.into()))?;
let stats_string =
Expand Down
Loading