When I set up the distributed tables, there was such a mistake.
`node01 :) create table dummy (p Date, k UInt64, d String) ENGINE = MergeTree(p, k, 8192)
CREATE TABLE dummy
(
p Date,
k UInt64,
d String
)
ENGINE = MergeTree(p, k, 8192)
Ok.
0 rows in set. Elapsed: 0.020 sec.
node01 :) create table distributed (p Date, k UInt64, d String) ENGINE = Distributed(cluster-1, 'default', 'dummy')
CREATE TABLE distributed
(
p Date,
k UInt64,
d String
)
ENGINE = Distributed(cluster - 1, 'default', 'dummy')
Received exception from server (version 19.9.5):
Code: 170. DB::Exception: Received from localhost:9000, ::1. DB::Exception: Bad get: has UInt64, requested String.
0 rows in set. Elapsed: 0.001 sec.
`
I don't know why. I tried many times.
Distributed(cluster - 1
-1 ? It should be a cluster name.
For example test_shard_localhost : ENGINE = Distributed(test_shard_localhost, default, dummy)
check for available clusters select distinct cluster from system.clusters
@JonLeeCSDN
cluster-1 is interpreted as arithmetic expression. You have to put in in backticks:
`cluster-1`
or use different cluster name.
@JonLeeCSDN
cluster-1is interpreted as arithmetic expression. You have to put in in backticks:`cluster-1`or use different cluster name.
thank you ,in fact ,code as follow will be true:
`node03 :) CREATE TABLE ontime_all AS ontime_local_2 ENGINE = Distributed('cluster-1', 'h2', 'ontime_local_2', 100);
CREATE TABLE ontime_all AS ontime_local_2
ENGINE = Distributed('cluster-1', 'h2', 'ontime_local_2', 100)
Ok.
0 rows in set. Elapsed: 0.005 sec
Most helpful comment
@JonLeeCSDN
cluster-1is interpreted as arithmetic expression. You have to put in in backticks:or use different cluster name.