Skip to content

Commit 5e1c2b5

Browse files
committed
feat: implement predicate adaptation for nested structs
1 parent 0e48627 commit 5e1c2b5

6 files changed

Lines changed: 1000 additions & 0 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ members = [
4040
"datafusion/functions-window-common",
4141
"datafusion/optimizer",
4242
"datafusion/physical-expr",
43+
"datafusion/physical-expr-adapter",
4344
"datafusion/physical-expr-common",
4445
"datafusion/physical-optimizer",
4546
"datafusion/pruning",
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "datafusion-physical-expr-adapter"
3+
description = "Physical expression schema adaptation utilities for DataFusion"
4+
keywords = ["datafusion", "query", "sql"]
5+
readme = "README.md"
6+
version = { workspace = true }
7+
edition = { workspace = true }
8+
homepage = { workspace = true }
9+
repository = { workspace = true }
10+
license = { workspace = true }
11+
authors = { workspace = true }
12+
rust-version = { workspace = true }
13+
14+
[lib]
15+
name = "datafusion_physical_expr_adapter"
16+
path = "src/lib.rs"
17+
18+
[dependencies]
19+
arrow = { workspace = true }
20+
datafusion-common = { workspace = true }
21+
datafusion-expr = { workspace = true }
22+
datafusion-functions = { workspace = true }
23+
datafusion-physical-expr = { workspace = true }
24+
datafusion-physical-expr-common = { workspace = true }
25+
itertools = { workspace = true }
26+
27+
[dev-dependencies]
28+
datafusion-expr = { workspace = true }
29+
rstest = { workspace = true }
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# DataFusion Physical Expression Adapter
2+
3+
This crate provides physical expression schema adaptation utilities for DataFusion, with support for complex nested struct type handling.
4+
5+
## Overview
6+
7+
The `PhysicalExprSchemaRewriter` allows rewriting physical expressions to match different schemas, including:
8+
9+
- Type casting when logical and physical schemas have different types
10+
- Handling missing columns by inserting null literals
11+
- Struct support: Recursive rebuilding of struct expressions with proper field mapping
12+
- Partition column replacement with literal values
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
#![doc(
19+
html_logo_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg",
20+
html_favicon_url = "https://raw.githubusercontent.com/apache/datafusion/19fe44cf2f30cbdd63d4a4f52c74055163c6cc38/docs/logos/standalone_logo/logo_original.svg"
21+
)]
22+
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
23+
24+
//! Physical expression schema adaptation utilities for DataFusion
25+
26+
pub mod schema_rewriter;
27+
28+
pub use schema_rewriter::PhysicalExprSchemaRewriter;

0 commit comments

Comments
 (0)