EXISTS db1.table1_local ON CLUSTER '{cluster}' (
transaction_id UUID,
common_tenant String,
common_device UUID,
internal_datetime_utc DateTime64(3, 'UTC'),
) ENGINE = ReplicatedReplacingMergeTree(
'/clickhouse/tables/{shard}/table1_local', '{replica}'
) ORDER BY (common_tenant, common_device, internal_datetime_utc, transaction_id)
PRIMARY KEY (common_tenant, common_device)
PARTITION BY toYYYYMM(internal_datetime_utc)
CREATE TABLE IF NOT EXISTS db1.table1 ON CLUSTER '{cluster}' (
transaction_id UUID,
common_tenant String,
common_device UUID,
internal_datetime_utc DateTime64(3, 'UTC'),
) ENGINE = Distributed(
'{cluster}', db1, table1_local, rand()
)
Таблицы наполнили тестовыми данными и сейчас делаю селекты. И не могу понять, должно ли так быть
Вот такой селект не возвращает ничего
SELECT common_tenant, common_device FROM db1.table1_local WHERE (common_tenant, common_device) IN tuple(('23c38aa5-64a7-461b-a4a4-6cb3c01fa3b9', '4fb6b657-b4c7-4d47-a4fd-1eeda65a4d1d'), ('2e63a510-8aab-4255-ad44-c72e3ef0f6aa', 'cdfc6dc1-927f-447e-913c-4da33ef03f90')) AND isNull(customer) ORDER BY common_tenant, common_device
Вот такие селекты возвращают записанные ранее данные
В этом запросе я убрал tuple
SELECT common_tenant, common_device FROM db1.table1_local WHERE (common_tenant, common_device) IN (('23c38aa5-64a7-461b-a4a4-6cb3c01fa3b9', '4fb6b657-b4c7-4d47-a4fd-1eeda65a4d1d'), ('2e63a510-8aab-4255-ad44-c72e3ef0f6aa', 'cdfc6dc1-927f-447e-913c-4da33ef03f90')) AND isNull(customer) ORDER BY common_tenant, common_device
В этом запросе обратился к таблице table1:
SELECT common_tenant, common_device FROM db1.table1 WHERE (common_tenant, common_device) IN tuple(('23c38aa5-64a7-461b-a4a4-6cb3c01fa3b9', '4fb6b657-b4c7-4d47-a4fd-1eeda65a4d1d'), ('2e63a510-8aab-4255-ad44-c72e3ef0f6aa', 'cdfc6dc1-927f-447e-913c-4da33ef03f90')) AND isNull(customer) ORDER BY common_tenant, common_device
Так должно быть? В какую сторону смотреть, подскажите, плиз
select * from (select 1 a,2 b) where (a,b) in (tuple(1,2), tuple(2,3)) ┌─a─┬─b─┐ │ 1 │ 2 │ └───┴───┘
В продолжение вчерашнего вопроса Тестирую на managed кликхаусе в Яндекс облаке с такой же структурой БД. Там первый вариант селекта работает Вижу, что версии различаются в облаке - 20.3, самоподнятый - 20.5.4 И, возможно, в настройках что то различается. Настройки на менеджед не вижу Почему так может быть?
Обсуждают сегодня