跨群集查询和架构更改Cross-cluster queries and schema changes

执行跨群集查询时,进行初始查询解释的群集必须具有远程群集中引用的实体的架构。When executing cross-cluster query, the cluster that is doing the initial query interpretation must have the schema of the entities referenced in the remote clusters. 当以下查询发送到 Cluster1 时When the following query is sent to Cluster1

Table1 | join ( cluster("Cluster2").database("SomeDB").Table2 ) on KeyColumn

Cluster1 必须知道 Cluster2 上的 Table2 有哪些列以及这些列的数据类型。Cluster1 must know what columns Table2 on Cluster2 has, and the data types of those columns. 若要获取该信息,需要将特殊命令从 Cluster1 发送到 Cluster2。To get that information, the special command is sent from Cluster1 to Cluster2. 发送命令的开销可能很高。Sending the command can be expensive. 检索到后,将缓存远程实体的架构,并且引用相同实体的下一个查询将运行较少的网络操作。Once retrieved, the schemas for remote entities are cached, and the next query referencing the same entities will run fewer network operations.

远程实体架构的更改可能会导致不利影响。Changes in the schema of the remote entity may result in unwanted effects. 例如,无法识别添加的列,或者删除的列会导致“部分查询错误”而不是语义错误。For example, added columns aren't recognized, or deleted columns cause a 'Partial Query Error' instead of a semantic error.

为了解决这个问题,缓存的架构会在检索到后一小时过期,因此在更改后超过一小时才执行的任何查询都将使用最新架构。To solve this problem, cached schemas expire one hour after retrieval, so that any query executed more than one hour after the change, will work with the up-to-date schema.