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

Arrays cannot be nullable ? #1062

Closed
silviucpp opened this issue Aug 4, 2017 · 5 comments
Closed

Arrays cannot be nullable ? #1062

silviucpp opened this issue Aug 4, 2017 · 5 comments

Comments

@silviucpp
Copy link
Contributor

After I updated clickhouse to last testing version for the following query:

CREATE TABLE example_src(`ck.partition` Date,`ck.created_at` DateTime,`ck.timestamp` DateTime,`arr` Nullable(Array(String)),`customer_id` Nullable(String),`user_action_id` Nullable(Int64),`user_id` Nullable(String)) ENGINE = ReplicatedMergeTree('/var/lib/clickhouse/tables/{shard}/example_src','{replica}',`ck.partition`,`ck.timestamp`,8192);

I get:

Code: 43, e.displayText() = DB::Exception: Nested type Array(String) cannot be inside Nullable type, e.what() = DB::Exception

So this means we cannot have fields of type array that can accept null value ? This was supported before..

Silviu

@alexey-milovidov
Copy link
Member

We decided, that for simplicity reasons we need to support either arrays with nullable values or nullable arrays, but not both. And arrays with nullable values seems more useful. Nullable arrays are less needed, because often empty arrays are enough.

This is still subject to change.

@silviucpp
Copy link
Contributor Author

silviucpp commented Aug 5, 2017

Hmm, and how do you solve the problem of adding later let's say in a table a row which is array and you want to select records from past where this property was not available ? I mean where new field it's NULL not empty array..

Silviu

@silviucpp
Copy link
Contributor Author

Hy @alexey-milovidov do you have an opinion on my previous question ?

Silviu

@alexey-milovidov
Copy link
Member

This will be more difficult. You could add another field as a flag to indicate older data.
For example, you could have two fields Items Array(String) and HasItems UInt8.
But sometimes it is enough to not differentiate between empty array and undefined array value.

@silviucpp
Copy link
Contributor Author

Ok then, if the decision that Nullable array are not supported is final then I don't see any option..

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

No branches or pull requests

2 participants