apache / apache/datafusion

Can not handle `'` characters in PARTITIONED BY clause

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

Description

### Describe the bug

https://github.com/apache/arrow-datafusion/pull/9604 from @metesynnada rationalied `COPY` option handling 🙏

However one of the tests needed to be commented out: https://github.com/apache/arrow-datafusion/blob/1d0171ab9d33fc7896861dee85804d7daf0a6390/datafusion/sqllogictest/test_files/copy.slt#L114-L142

### To Reproduce

@metesynnada explained on https://github.com/synnada-ai/datafusion-upstream/pull/10#discussion_r1526407025

> Before this pull request, there was a problem with how escape characters in the PARTITIONED BY clause were processed in both the CREATE EXTERNAL TABLE and COPY TO statements. The issue stemmed from converting the Value to a string too early in the parsing process, leading to errors.
>
> Although it appears that the test passes, in reality, during the execution of CREATE EXTERNAL TABLE, the specified field names do not match as expected, indicating a silent error. This issue should be addressed separately, as it falls outside the scope of the current PR.
>
> I propose that we standardize the approach to handling column names in both the schema definitions and the PARTITIONED BY clauses. Once we establish a consistent method, the relevance of this test can be reassessed.
>
> I will proceed to open an issue to address it.

### Expected behavior

The test should pass

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with datafusion/sqllogictest/test_files/copy.slt lines 114-142 and reproduce the PARTITIONED BY case involving an apostrophe. Trace how column names are handled in CREATE EXTERNAL TABLE and COPY TO parsing, then restore the test and verify that the expected partition field names are preserved and the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.