Skip to content

Add JSONExtractKeysAndValuesRaw - #10378

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
hczhcz:patch-0420
Apr 20, 2020
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
hczhcz:patch-0420

Conversation

@hczhcz

@hczhcz hczhcz commented Apr 20, 2020 •

Copy link
Copy Markdown
Contributor

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category (leave one):

  • New Feature

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

Add function JSONExtractKeysAndValuesRaw which extracts raw data from JSON objects

Detailed description / Documentation draft:

JSONExtractKeysAndValuesRaw(json[, indices_or_keys…])

Parses key-value pairs from a JSON and returns an array of such pairs, each value represented as unparsed string.
Example:

SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300]}') = [('a','"hello"'),('b','[-100,200,300]')]

@blinkov blinkov added doc-alert pr-feature Pull request with new product feature labels Apr 20, 2020
@alexey-milovidov

Copy link
Copy Markdown
Member

Fantastic! That's exactly what I need!

Comment thread src/Functions/FunctionsJSON.h Outdated

static DataTypePtr getType(const char *, const ColumnsWithTypeAndName &)
{
DataTypePtr key_type = std::make_unique<DataTypeString>();

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.

Data types are 100% immutable objects, we can have just one DataTypeString.

@alexey-milovidov
alexey-milovidov merged commit c4758b6 into ClickHouse:master Apr 20, 2020
@hczhcz
hczhcz deleted the patch-0420 branch April 21, 2020 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-feature Pull request with new product feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants