From 3acbd12c54fb920b82ea0e7a91bcfb4aaa64f44a Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Tue, 25 May 2021 03:49:24 +0300 Subject: [PATCH] enable reading of subcolumn for distributed tables --- src/Storages/StorageDistributed.h | 1 + .../01883_subcolumns_distributed.reference | 2 ++ .../01883_subcolumns_distributed.sql | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/queries/0_stateless/01883_subcolumns_distributed.reference create mode 100644 tests/queries/0_stateless/01883_subcolumns_distributed.sql diff --git a/src/Storages/StorageDistributed.h b/src/Storages/StorageDistributed.h index 61e83c611a7..9849ce7625c 100644 --- a/src/Storages/StorageDistributed.h +++ b/src/Storages/StorageDistributed.h @@ -51,6 +51,7 @@ public: bool supportsSampling() const override { return true; } bool supportsFinal() const override { return true; } bool supportsPrewhere() const override { return true; } + bool supportsSubcolumns() const override { return true; } StoragePolicyPtr getStoragePolicy() const override; bool isRemote() const override { return true; } diff --git a/tests/queries/0_stateless/01883_subcolumns_distributed.reference b/tests/queries/0_stateless/01883_subcolumns_distributed.reference new file mode 100644 index 00000000000..459f90ada98 --- /dev/null +++ b/tests/queries/0_stateless/01883_subcolumns_distributed.reference @@ -0,0 +1,2 @@ +3 0 bbb ccc +3 0 bbb ccc diff --git a/tests/queries/0_stateless/01883_subcolumns_distributed.sql b/tests/queries/0_stateless/01883_subcolumns_distributed.sql new file mode 100644 index 00000000000..5593dc60251 --- /dev/null +++ b/tests/queries/0_stateless/01883_subcolumns_distributed.sql @@ -0,0 +1,21 @@ +DROP TABLE IF EXISTS t_subcolumns_local; +DROP TABLE IF EXISTS t_subcolumns_dist; + +CREATE TABLE t_subcolumns_local (arr Array(UInt32), n Nullable(String), t Tuple(s1 String, s2 String)) +ENGINE = MergeTree ORDER BY tuple(); + +CREATE TABLE t_subcolumns_dist AS t_subcolumns_local ENGINE = Distributed(test_cluster_two_shards, currentDatabase(), t_subcolumns_local); + +INSERT INTO t_subcolumns_local VALUES ([1, 2, 3], 'aaa', ('bbb', 'ccc')); + +SELECT arr.size0, n.null, t.s1, t.s2 FROM t_subcolumns_dist; + +DROP TABLE t_subcolumns_local; + +-- StripeLog doesn't support subcolumns. +CREATE TABLE t_subcolumns_local (arr Array(UInt32), n Nullable(String), t Tuple(s1 String, s2 String)) ENGINE = StripeLog; + +SELECT arr.size0, n.null, t.s1, t.s2 FROM t_subcolumns_dist; -- { serverError 47 } + +DROP TABLE t_subcolumns_local; +DROP TABLE t_subcolumns_dist;