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

[RFC] useDefaultImplementationForLowCardinalityColumns should not return LowCardinality for small types #63477

Open
Algunenano opened this issue May 7, 2024 · 0 comments
Labels
performance st-discussion The story requires discussion /research / expert help / design & decomposition before will be taken

Comments

@Algunenano
Copy link
Member

Somewhat related to #63458
Also related to #63398

We don't support LowCardinality on small types on CREATE queries (unless allow_suspicious_low_cardinality_types is enabled) because it's useless, bad for performance and takes more space.

But then we do this:

SELECT
    toInt16(CAST('1', 'LowCardinality(String)')) AS i,
    toTypeName(i)

Query id: 95fda3e0-f823-48a6-8bd6-545ffb0de2b5

   ┌─i─┬─toTypeName(i)─────────┐
1. │ 1 │ LowCardinality(Int16) │
   └───┴───────────────────────┘

1 row in set. Elapsed: 0.001 sec. 
SELECT
    toLowCardinality(1) + toLowCardinality(2) AS d,
    toTypeName(d)

Query id: b463b441-f97b-45c8-8733-3426886caf37

   ┌─d─┬─toTypeName(d)──────────┐
1. │ 3 │ LowCardinality(UInt16) │
   └───┴────────────────────────┘

I think we shouldn't wrap the return type of functions with LowCardinality by default unless it's of a big type, that is, ignore the ones disallowed by allow_suspicious_low_cardinality_types.

This might be a breaking change, so I'd rather hear thoughts first.

@Algunenano Algunenano added performance st-discussion The story requires discussion /research / expert help / design & decomposition before will be taken labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance st-discussion The story requires discussion /research / expert help / design & decomposition before will be taken
Projects
None yet
Development

No branches or pull requests

1 participant