Skip to content

Support output hive text format - #60737

Closed
shuai-xu wants to merge 4 commits into
ClickHouse:masterfrom
bigo-sg:csv
Closed

shuai-xu wants to merge 4 commits into
ClickHouse:masterfrom
bigo-sg:csv

Conversation

@shuai-xu

@shuai-xu shuai-xu commented Mar 4, 2024

Copy link
Copy Markdown
Contributor

Changelog category (leave one):

  • Improvement

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

Add a config to control whether write string in quote for CSV format

Documentation entry for user-facing changes

This pr add a config to control whether write string in quote for CSV format. Now CSV will write string in quote, this is conflicing with hive, and we hope it is configurable.

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

@CLAassistant

CLAassistant commented Mar 4, 2024 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@alexey-milovidov
alexey-milovidov marked this pull request as draft March 4, 2024 05:01
@alexey-milovidov

Copy link
Copy Markdown
Member

Need to sign a CLA.
Need to write a test.

@alexey-milovidov alexey-milovidov self-assigned this Mar 4, 2024
@alexey-milovidov alexey-milovidov added the close in a month if not active This will be closed in case of no information label Mar 5, 2024
@alexey-milovidov

Copy link
Copy Markdown
Member

^

@shuai-xu

shuai-xu commented Mar 7, 2024

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov In fact, this issue is that clickhouse output csv in format such like "20240305",1,"['s','d']","{'a':2}","(123567,'e01001',{'action':33333})", but hive write csv like
image
, we need to let clickhouse compatiable with hive in our production. But I see it needs a lot to do as now clickhouse hard code the delimiters and so on. So will the clickhouse community consider let csv format support compatiable with hive? If so, I will continue working on it.

@alexey-milovidov

Copy link
Copy Markdown
Member

@shuai-xu, It looks like the CustomSeparated format.

@alexey-milovidov alexey-milovidov added the st-need-info We need extra data to continue (waiting for response). Either some details or a repro of the issue. label Mar 9, 2024
@shuai-xu

Copy link
Copy Markdown
Contributor Author

@shuai-xu, It looks like the CustomSeparated format.

Yes, it looks like CustomSeparated, but not fully supported since map has to in the '{}', and so do array/tuple.

@alexey-milovidov alexey-milovidov removed st-need-info We need extra data to continue (waiting for response). Either some details or a repro of the issue. close in a month if not active This will be closed in case of no information labels Mar 21, 2024
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review March 21, 2024 22:23

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.

Old tests should not be modified.

@alexey-milovidov alexey-milovidov left a comment

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.

Maybe better to add it as a new format? What is the name for it?

@alexey-milovidov
alexey-milovidov marked this pull request as draft March 21, 2024 22:24
@shuai-xu

Copy link
Copy Markdown
Contributor Author

Maybe better to add it as a new format? What is the name for it?

Maybe HiveTextOutputFormat?

@shuai-xu shuai-xu changed the title Make csv write string in quote configurable Support output hive text format Apr 11, 2024
@shuai-xu

Copy link
Copy Markdown
Contributor Author

I added the HiveTextRowOutputFormat to support write as hive

@shuai-xu
shuai-xu marked this pull request as ready for review April 12, 2024 02:58
@shuai-xu

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov can you help to review this pr?

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label May 5, 2024
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-improvement Pull request with some product improvements label May 5, 2024
@robot-ch-test-poll2

robot-ch-test-poll2 commented May 5, 2024 •

Copy link
Copy Markdown
Contributor

This is an automated comment for commit 8f7ab97 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
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests❌ error
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
BuildsThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ 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
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

@shuai-xu
shuai-xu force-pushed the csv branch 3 times, most recently from c5b1266 to c6b5119 Compare May 8, 2024 09:53
@shuai-xu

shuai-xu commented May 9, 2024

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov Tests have passed, the failed one seems not related to this pr.

@clickhouse-gh

clickhouse-gh Bot commented Aug 20, 2024

Copy link
Copy Markdown
Contributor

Dear @alexey-milovidov, 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.


void SerializationVariant::serializeTextHive(const IColumn & /*column*/, size_t /*row_num*/, WriteBuffer & /*ostr*/, const FormatSettings & /*settings*/) const
{
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method serializeTextHive is not implemented for Variant");

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.

It could be.

@alexey-milovidov

Copy link
Copy Markdown
Member

@shuai-xu, please allow edits in your branch.

@nikitamikhaylov nikitamikhaylov added the comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). label Dec 12, 2025
@alexey-milovidov

Copy link
Copy Markdown
Member

Continued in #107582

pull Bot pushed a commit to SINHASantos/ClickHouse that referenced this pull request Aug 7, 2026
Add the HiveText output format, mirroring Apache Hive's LazySimpleSerDe text
serialization. Each row is written without quoting; top-level fields are
separated by the fields delimiter ('\001' by default) and rows by the rows
delimiter ('\n', configurable via the new format_hive_text_rows_delimiter
setting). Values of nested types (Array, Map, Tuple) are written without
brackets, separated by a delimiter derived from the fields delimiter by their
nesting level, the same way Hive does it.

Implemented via a new ISerialization::serializeTextHive() method (whose default
throws for types that Hive does not support) and a new HiveTextRowOutputFormat.

Reimplements ClickHouse#60737.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Add the HiveText output format, mirroring Apache Hive's LazySimpleSerDe text
serialization. Each row is written without quoting; top-level fields are
separated by the fields delimiter ('\001' by default) and rows by the rows
delimiter ('\n', configurable via the new format_hive_text_rows_delimiter
setting). Values of nested types (Array, Map, Tuple) are written without
brackets, separated by a delimiter derived from the fields delimiter by their
nesting level, the same way Hive does it.

Implemented via a new ISerialization::serializeTextHive() method (whose default
throws for types that Hive does not support) and a new HiveTextRowOutputFormat.

Reimplements ClickHouse#60737.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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 comp-formats Input/output formats (CSV/JSON/Parquet/ORC/Arrow/Protobuf/etc.). pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants