You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support nullable complex types such as Tuple/Array/Map #52562
Use case
Currently CH doesn't support nullable complext types, but nullable complex types exist widely in formats like ORC/Parquet, and OLAP systems like Hive/Spark. From the perspective of users, nullable complex types are necessary because null and empty values of complex types are different in sematics.
If you are interested in this topic, we are glad to contribute to it for we had some works on it previously in gluten @alexey-milovidov . cc @baibaichen@zhanglistar
Reacted by lgbo, Chang Chen, UnamedRus, Duc Canh Le, Anthony Pessy, Charlie Lewis, Anders, Peter Keše, Michael Kolupaev, Artem Brezhniev and 1 more
I don't understand why CH doesn't allow nullable Array in the first place if nested type is neither nullable nor complex. From storage and column POV, it should could have been supported without any code change. The only issue I can foresee is when enable optimize_functions_to_subcolumns, if it's nullable array then we need to read both size0 and null.
I don't understand why CH doesn't allow nullable Array in the first place if nested type is neither nullable nor complex. From storage and column POV, it should could have been supported without any code change. The only issue I can foresee is when enable optimize_functions_to_subcolumns, if it's nullable array then we need to read both size0 and null.
A long time ago (around 2014), Nullable types were implemented in a non-generic way, and we forbid Nullable complex types to avoid code explosion. Then it was generalized, but the restrictions remain. Now it could make sense to allow Nullable complex types, but it is still in doubt.
Currently Array(LowCardinality(Nullable(String))) data type produce 6 files on disk.
-rw-r----- 1 clickhouse clickhouse 9.7K Aug 15 13:56 value.bin
-rw-r----- 1 clickhouse clickhouse 3.1K Aug 15 13:56 value.mrk2
-rw-r----- 1 clickhouse clickhouse 43 Aug 15 13:56 value.dict.bin
-rw-r----- 1 clickhouse clickhouse 3.1K Aug 15 13:56 value.dict.mrk2
-rw-r----- 1 clickhouse clickhouse 37K Aug 15 13:56 value.size0.bin
-rw-r----- 1 clickhouse clickhouse 3.1K Aug 15 13:56 value.size0.mrk2
And for Array(Nullable(String))
-rw-r----- 1 clickhouse clickhouse 13K Aug 15 14:00 value.bin
-rw-r----- 1 clickhouse clickhouse 1.7K Aug 15 14:00 value.mrk2
-rw-r----- 1 clickhouse clickhouse 5.0K Aug 15 14:00 value.null.bin
-rw-r----- 1 clickhouse clickhouse 1.7K Aug 15 14:00 value.null.mrk2
-rw-r----- 1 clickhouse clickhouse 20K Aug 15 14:00 value.size0.bin
-rw-r----- 1 clickhouse clickhouse 1.7K Aug 15 14:00 value.size0.mrk2
Are you going to embed them in value.null.* files or create another pair of files? (6 files is already quite a few to read for single column, adding even more may affect performance.)
@UnamedRus sorry, we have not thought about this issue yet. Currently the most important thing for us is to keep all tests in ci passed, and there is a lot of works to do.
Hey @alexey-milovidov great update! Do you have any ETA when Nullable(Array) would be implemented? Our team is really hitting a wall because of this problem and we are eagerly waiting for a good solution
Reacted by Nikola Krstev, VaneStojanov2, 李扬, Artem Brezhniev and Ishita Bindlish
Activity
baibaichen commentedon Jul 26, 2023
@alexey-milovidov would you please take a look at this issue?
canhld94 commentedon Aug 11, 2023
I don't understand why CH doesn't allow nullable Array in the first place if nested type is neither nullable nor complex. From storage and column POV, it should could have been supported without any code change. The only issue I can foresee is when enable
optimize_functions_to_subcolumns, if it's nullable array then we need to read bothsize0andnull.canhld94 commentedon Aug 11, 2023
@baibaichen @taiyang-li pls enlighten me if I'm wrong [THANKS]!
taiyang-li commentedon Aug 11, 2023
@canhld94 it is not that easy. AFSIS,
taiyang-li commentedon Aug 11, 2023
@alexey-milovidov If you has any opinion about this topic, pls let us knonw, thanks very much !
canhld94 commentedon Aug 14, 2023
@taiyang-li @baibaichen I think this is a valuable feature (at least for us, it will make our life much easier). Hope to see your PR soon!
alexey-milovidov commentedon Aug 14, 2023
A long time ago (around 2014), Nullable types were implemented in a non-generic way, and we forbid Nullable complex types to avoid code explosion. Then it was generalized, but the restrictions remain. Now it could make sense to allow Nullable complex types, but it is still in doubt.
alexey-milovidov commentedon Aug 14, 2023
The way is to allow them in a pull request and see what will happen.
taiyang-li commentedon Aug 14, 2023
@alexey-milovidov I'll create a PR soon.
UnamedRus commentedon Aug 15, 2023
Currently
Array(LowCardinality(Nullable(String)))data type produce 6 files on disk.And for
Array(Nullable(String))Are you going to embed them in
value.null.*files or create another pair of files? (6 files is already quite a few to read for single column, adding even more may affect performance.)taiyang-li commentedon Aug 16, 2023
@UnamedRus sorry, we have not thought about this issue yet. Currently the most important thing for us is to keep all tests in ci passed, and there is a lot of works to do.
panthony commentedon Apr 24, 2024
Stumbled upon this issue too, we are looking to transition part of our stack to ClickHouse and the absence of nullable array is a bummer.
There is a huge difference between saying "I don't know" and "There is nothing".
Adding a new field to hold that info for every Array() field manually is not somewhere I'm willing to go.
alexey-milovidov commentedon Jan 29, 2026
Nullable(Tuple)is implemented. Next step: Nullable(Array) and Nullable(Map).ViktorPetrovski commentedon Jan 30, 2026
Hey @alexey-milovidov great update! Do you have any ETA when Nullable(Array) would be implemented? Our team is really hitting a wall because of this problem and we are eagerly waiting for a good solution
ibindlish commentedon Apr 23, 2026
Also interested in Nullable(Array) here if you have any updates!