apache / apache/datafusion

Convert Expr to a parsable representation

Open
#7,165 6 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

In the delta-rs project we support operations such as delete, update, and merge where users can supply predicate as either a string or a DataFusion `Expr`. String predicates go through sql-parser to obtain an `Expr` and are evaluated. At the end of each operation the expression must be converted back to a string to store in the transaction log for conflict resolution.

The implementations for `create_name` and `canonical_name` almost fit this need but scalar values are surrounded by their type which cannot be parsed by sql-parser.

E.G `col1 = 1` becomes `col1 = Int32(1)`

### Describe the solution you'd like

Given an `Expr` one should be able to obtain it's string representation that can be parsed by sql parser.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing create_name and canonical_name implementations and the Expr-to-string path used by delta-rs. Check how scalar values such as Int32(1) are rendered against sql-parser. Done means an Expr string can be parsed by sql-parser while preserving predicates such as col1 = 1.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.