Skip to content

Improve JSONEachRow reading by ignoring the keys case#61750

Merged
al13n321 merged 7 commits intoClickHouse:masterfrom
KevinyhZou:improve_json_each_row_ignore_key_case
Jun 28, 2024
Merged

Improve JSONEachRow reading by ignoring the keys case#61750
al13n321 merged 7 commits intoClickHouse:masterfrom
KevinyhZou:improve_json_each_row_ignore_key_case

Conversation

@KevinyhZou
Copy link
Copy Markdown
Contributor

@KevinyhZou KevinyhZou commented Mar 22, 2024

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Allow matching column names in a case insensitive manner when reading json files (input_format_json_case_insensitive_column_matching).

So we introduce a config to ignore the case problem in such situation.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Information about CI checks: https://clickhouse.com/docs/en/development/continuous-integration/


Modify your CI run:

NOTE: If your merge the PR with modified CI you MUST KNOW what you are doing
NOTE: Set desired options before CI starts or re-push after updates

Run only:

  • Integration tests
  • Integration tests (arm64)
  • Stateless tests (release)
  • Stateless tests (asan)
  • Stateful tests (release)
  • Stateful tests (asan)
  • No sanitizers
  • Tests with analyzer
  • Fast tests
  • Only package_debug build
  • Add your CI variant description here

CI options:

  • do not test (only style check)
  • disable merge-commit (no merge from master before tests)
  • disable CI cache (job reuse)

Only specified batches in multi-batch jobs:

  • 1
  • 2
  • 3
  • 4

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Mar 22, 2024
@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Mar 22, 2024
@robot-clickhouse
Copy link
Copy Markdown
Member

robot-clickhouse commented Mar 22, 2024

This is an automated comment for commit 0990a82 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR❌ failure
Cloud fork sync (only for ClickHouse Inc. employees)If it fails, ask a maintainer for help⏳ pending
Mergeable CheckChecks if all other necessary checks are successful⏳ pending
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Successful checks
Check nameDescriptionStatus
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests✅ success
PR CheckChecks correctness of the PR's body✅ success
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts✅ success

@divanik divanik self-requested a review March 22, 2024 17:19
@KevinyhZou KevinyhZou force-pushed the improve_json_each_row_ignore_key_case branch from 7159bec to 37f028d Compare March 25, 2024 10:08
@divanik divanik self-requested a review March 25, 2024 10:11
@alexey-milovidov
Copy link
Copy Markdown
Member

alexey-milovidov commented Mar 26, 2024

I like the idea, but I'd prefer a few things differently:

  1. It should apply to all data formats with names, such as CSVWithNames, Protobuf, Avro, Parquet, and even Native.
  2. The modes should be: match case, ignore case, and auto. The auto mode will search for a matching column case insensitive if the direct match isn't found. In contrast, the case insensitive mode should throw an exception if the data contain ambiguous names. We will use the "auto" mode by default.

@alexey-milovidov alexey-milovidov changed the title Improve json earch row read by ignore key case Improve JSONEachRow reading by ignoring the keys case Mar 26, 2024
@KevinyhZou
Copy link
Copy Markdown
Contributor Author

done @Avogar

@KevinyhZou KevinyhZou force-pushed the improve_json_each_row_ignore_key_case branch from 39949fa to 93de14c Compare March 29, 2024 01:51
@KevinyhZou
Copy link
Copy Markdown
Contributor Author

Could this pr be merged ? and support for other formats and modes can be later @divanik @alexey-milovidov

@alexey-milovidov
Copy link
Copy Markdown
Member

alexey-milovidov commented Apr 3, 2024

It does not build, and the tests don't pass.
If it's not your tests that have failed, you should either help fix them or wait while they are fixed.

Could this pr be merged ? and support for other formats and modes can be later

Not later. The code should be complete and consistent. The user experience should be flawless.

@KevinyhZou
Copy link
Copy Markdown
Contributor Author

OK

@KevinyhZou KevinyhZou force-pushed the improve_json_each_row_ignore_key_case branch from ef86407 to 70d6a62 Compare April 25, 2024 06:07
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Jun 25, 2024

Dear @divanik, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@alexey-milovidov
Copy link
Copy Markdown
Member

This is a good change - please resolve conflicts and merge.

@al13n321 al13n321 added this pull request to the merge queue Jun 27, 2024
Merged via the queue into ClickHouse:master with commit 3229cb5 Jun 28, 2024
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 28, 2024
@KevinyhZou KevinyhZou deleted the improve_json_each_row_ignore_key_case branch June 28, 2024 02:12
{"output_format_csv_serialize_tuple_into_separate_columns", true, true, "A new way of how interpret tuples in CSV format was added."},
{"input_format_csv_deserialize_separate_columns_into_tuple", true, true, "A new way of how interpret tuples in CSV format was added."},
{"input_format_csv_try_infer_strings_from_quoted_tuples", true, true, "A new way of how interpret tuples in CSV format was added."},
{"input_format_json_ignore_key_case", false, false, "Ignore json key case while read json field from string."},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be 24.7

liuneng1994 pushed a commit to apache/gluten that referenced this pull request Jul 8, 2024
What changes were proposed in this pull request?
(Please fill in changes proposed in this fix)

(Fixes: #6262)

this pr is depend on clickhouse pr: ClickHouse/ClickHouse#61750

How was this patch tested?
test by ut
@alexey-milovidov
Copy link
Copy Markdown
Member

It is implemented not like we needed. Let's revert.

Block::NameMap name_map;

/// Hash table match `lower_case field name -> field name in the block`.
std::unordered_map<String, StringRef> lower_case_name_map;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is very bad.

{
String field_name_str = field_name.toString();
std::transform(field_name_str.begin(), field_name_str.end(), field_name_str.begin(),
[](unsigned char c) { return std::tolower(c); });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is wrong.

@alexey-milovidov
Copy link
Copy Markdown
Member

This will be reverted, because the review is not addressed: #61750 (comment)

al13n321 added a commit that referenced this pull request Jul 30, 2024
…ow_ignore_key_case"

This reverts commit 3229cb5, reversing
changes made to f838c25.
github-merge-queue bot pushed a commit that referenced this pull request Aug 6, 2024
Revert #61750 "Improve JSONEachRow reading by ignoring the keys case"
baibaichen added a commit to Kyligence/gluten that referenced this pull request Aug 8, 2024
baibaichen added a commit to Kyligence/gluten that referenced this pull request Aug 8, 2024
baibaichen added a commit to apache/gluten that referenced this pull request Aug 8, 2024
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240808)

* Fix build due to ClickHouse/ClickHouse#66279

* Revert "[GLUTEN-6262][CH]Json input format ignore key case #6263" due to ClickHouse/ClickHouse#67484 revert ClickHouse/ClickHouse#61750

This reverts commit 2be6c86.

* fix gtest due to #6722

---------

Co-authored-by: kyligence-git <[email protected]>
Co-authored-by: Chang Chen <[email protected]>
@KevinyhZou
Copy link
Copy Markdown
Contributor Author

would you open another pr to slove this problem? @alexey-milovidov

@alexey-milovidov
Copy link
Copy Markdown
Member

We should do it, but I didn't plan it for the next days. It will be very helpful if you resumbit.

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

Labels

can be tested Allows running workflows for external contributors pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants