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

untuple expand fields can not be accessed again #18133

Closed
melin opened this issue Dec 16, 2020 · 5 comments
Closed

untuple expand fields can not be accessed again #18133

melin opened this issue Dec 16, 2020 · 5 comments
Assignees
Labels
st-wontfix Known issue, no plans to fix it currenlty unfinished code

Comments

@melin
Copy link
Contributor

melin commented Dec 16, 2020

untuple expand fields can not be accessed again

select ACTIVITY_RAW, parseDateTime64BestEffort(toString(S_D_EVENTOCCURTIME)) from (
  SELECT JSONExtractRaw(activity_json, 'activity') as ACTIVITY_RAW,
    untuple(JSONExtract(ACTIVITY_RAW, 'Tuple(S_S_PARTNERCODE String, S_S_EVENTTYPE String, S_S_EVENTID String, 
    S_E_INVOKETYPE String, S_D_EVENTOCCURTIME Int64')) activity
  FROM activity_result
);

image

@melin melin added the bug Confirmed user-visible misbehaviour in official release label Dec 16, 2020
@hexiaoting
Copy link
Contributor

Can you give us a minimal info that can reproduce this error? including how to create this table and some data

@melin
Copy link
Contributor Author

melin commented Dec 16, 2020

Can you give us a minimal info that can reproduce this error? including how to create this table and some data

select _ut_1 from (select untuple(tuple(1, 2)))

error: Code: 8, e.displayText() = DB::Exception: Cannot find column _ut_1 in source stream (version 20.12.3.3 (official build))

@alexey-milovidov alexey-milovidov added unfinished code and removed bug Confirmed user-visible misbehaviour in official release labels Dec 16, 2020
@alexey-milovidov
Copy link
Member

CC @amosbird @KochetovNicolai

@larry-cdn77
Copy link
Contributor

I can indeed see this in version 21.8 LTS (was fine in previous 21.3 LTS)

@alexey-milovidov
Copy link
Member

alexey-milovidov commented Oct 19, 2022

The behavior of untuple function has been deliberately made worse as the previous implementation was not memory-safe.
The initial implementation did not pass ClickHouse testing with fuzzing.
Now it's only possible to access them with the following syntax:

SELECT `tupleElement((1, 2), 1)` FROM (select untuple(tuple(1, 2)))

It is inconvenient. But I'd rather recommend not using the untuple function at all.

@alexey-milovidov alexey-milovidov self-assigned this Oct 19, 2022
@alexey-milovidov alexey-milovidov added the st-wontfix Known issue, no plans to fix it currenlty label Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
st-wontfix Known issue, no plans to fix it currenlty unfinished code
Projects
None yet
Development

No branches or pull requests

4 participants