Skip to content

Feature/generate random json support - #94832

Closed
Tanish196 wants to merge 5 commits into
ClickHouse:masterfrom
Tanish196:feature/generate-random-json-support
Closed

Tanish196 wants to merge 5 commits into
ClickHouse:masterfrom
Tanish196:feature/generate-random-json-support

Conversation

@Tanish196

@Tanish196 Tanish196 commented Jan 22, 2026 •

Copy link
Copy Markdown

Related to #92360

Changelog category :

  • Improvement

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

GenerateRandom now supports generation of structured Object (JSON-like) values for benchmarking and testing.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Description

  • This change adds internal support for generating structured Object (JSON-like) values in the GenerateRandom table engine.

  • It enables generation of nested objects, arrays, and scalar values for benchmarking and testing, and removes the previous “not implemented for Object” error.

  • User-facing configuration of JSON generation parameters (such as nesting depth, key count, and null ratio) will be added in a follow-up PR.

Motivation:

  • GenerateRandom is commonly used to populate tables with synthetic data for testing and benchmarking.
  • Adding support for structured Object values allows generating JSON-like data directly within ClickHouse, without relying on external data sources.

Parameters:

  • No new user-facing parameters are introduced in this change.
  • Existing parameters max_string_length and max_array_length are reused internally for Object value generation. Additional JSON-specific parameters will be exposed in a follow-up PR.

Example use:

CREATE TABLE t
(
    payload Object
)
ENGINE = GenerateRandom();

@CLAassistant

CLAassistant commented Jan 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@fm4v

fm4v commented Feb 2, 2026

Copy link
Copy Markdown
Member

Thanks! Tests are missing

@Tanish196

Copy link
Copy Markdown
Author

Thanks for the feedback, @fm4v.
I’ve added a stateless SQL test covering GenerateRandom with the Object type. I’m not able to execute this test locally because my local ClickHouse build does not include support for the experimental Object type. I even tried enabling allow_experimental_object_type. However, this test is intended to run in CI, where Object is available.
I can commit the test as-is and rely on CI for validation. Please let me know if you’d prefer a different approach.

@fm4v

fm4v commented Feb 3, 2026

Copy link
Copy Markdown
Member

Object('json') data type was deprecated for a long time and now removed. Original task is about adding support for JSON data type. https://clickhouse.com/docs/sql-reference/data-types/newjson

@Tanish196

Copy link
Copy Markdown
Author

Thanks for the clarification. I misunderstood the scope and implemented support for the deprecated Object type, while the task is to support the new JSON data type. I’ll rework the approach to add native JSON support in GenerateRandom directly and open a new PR for that. I’ll close this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants