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

Autocast Strings to Int for Enum for JSON #65119

Closed
gingerwizard opened this issue Jun 11, 2024 · 1 comment · Fixed by #66801
Closed

Autocast Strings to Int for Enum for JSON #65119

gingerwizard opened this issue Jun 11, 2024 · 1 comment · Fixed by #66801
Assignees
Labels
feature warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency.

Comments

@gingerwizard
Copy link
Collaborator

Use case

CREATE TABLE test
(
    `answer` Enum8('Question' = 1, 'Answer' = 2, 'Wiki' = 3, 'TagWikiExcerpt' = 4, 'TagWiki' = 5, 'ModeratorNomination' = 6, 'WikiPlaceholder' = 7, 'PrivilegeWiki' = 8)
)
ENGINE = Memory

INSERT INTO test FORMAT JSONEachRow {"answer": 1}

Ok.


INSERT INTO test FORMAT JSONEachRow {"answer": "1"}

Ok.
Exception on client:
Code: 691. DB::Exception: Unknown element '1' for enum: (while reading the value of key answer): (at row 1)
: While executing ParallelParsingBlockInputFormat: data for INSERT was parsed from query. (UNKNOWN_ELEMENT_OF_ENUM)

Describe the solution you'd like

A setting which enables cast as Int prior to insert so this works.

@Avogar Avogar added the warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency. label Jun 11, 2024
@Blargian
Copy link
Member

@Avogar I'd like to work on this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants