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

[Enhancement] Support column mismatch fill property in files() #54362

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

wyb
Copy link
Contributor

@wyb wyb commented Dec 26, 2024

Why I'm doing:

What I'm doing:

select * from files("path" = "xxx", "format" = "csv", "fill_mismatch_column_with" = "null");

add fill_mismatch_column_with property in files() to process column mismatch, default value is none.

query files()
none: return error
null: fill null

insert from files()
none: filter rows, return error or not, based on max filter ratio
null: fill null

behavior change:
after this pr, query csv files() return error when column mismatch, but previous behavior is fill null.

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.4
    • 3.3
    • 3.2
    • 3.1
    • 3.0

@wyb wyb requested review from a team as code owners December 26, 2024 04:53
@github-actions github-actions bot added the 3.4 label Dec 26, 2024
@wanpengfei-git wanpengfei-git requested a review from a team December 26, 2024 04:54
@mergify mergify bot assigned wyb Dec 26, 2024
@wyb wyb force-pushed the files_mismatch_fill branch 2 times, most recently from ca3679d to 0de41ef Compare December 26, 2024 05:13
@gengjun-git gengjun-git self-assigned this Dec 26, 2024
@wyb wyb force-pushed the files_mismatch_fill branch 2 times, most recently from c71b3a4 to ab74319 Compare December 26, 2024 08:44
@wyb wyb force-pushed the files_mismatch_fill branch from ab74319 to 447e43a Compare December 26, 2024 10:18
Copy link

[BE Incremental Coverage Report]

pass : 32 / 39 (82.05%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 be/src/exec/csv_scanner.cpp 29 36 80.56% [65, 381, 386, 387, 388, 389, 489]
🔵 be/src/exec/file_scanner.cpp 3 3 100.00% []

@@ -459,17 +479,23 @@ Status CSVScanner::_parse_csv(Chunk* chunk) {
_curr_reader->split_record(record, &fields);

if (fields.size() != _num_fields_in_csv && !_scan_range.params.flexible_column_mapping) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about reading 3 columns from a 4-column csv file?
How about reading 3 columns from a jagged csv file with both 2-column rows, 4-column rows?

Copy link

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

[FE Incremental Coverage Report]

fail : 39 / 61 (63.93%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/sql/plan/PlanFragmentBuilder.java 0 2 00.00% [3869, 3870]
🔵 com/starrocks/catalog/TableFunctionTable.java 22 39 56.41% [140, 141, 142, 145, 149, 214, 380, 443, 449, 450, 451, 452, 453, 460, 462, 464, 692]
🔵 com/starrocks/planner/FileScanNode.java 5 8 62.50% [270, 271, 757]
🔵 com/starrocks/sql/analyzer/InsertAnalyzer.java 12 12 100.00% []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants