为什么在Snowflake中同时给两个变量赋值,变量有256字节的限制?

In Snowflake, why, when you assign two variables at the same time, is there a 256 byte limit on the variables?

我正在使用 Snowflake,试图同时将两个变量设置为具有两个字段的结果集,但它并没有像我想象的那样工作。这是一个例子:

当我运行这个:

set (var1, var2) = (select 'IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII','');

我收到以下错误:

Assignment to 'VAR1' not done because value exceeds size limit for variables. Its size is 280; the limit is 256 (internal storage size in bytes).

然而,这工作正常(相同数量的字符):

set (var1) = (select 'IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII');

似乎在给两个变量赋值时其中一个字段的字符串长度只能是256字节。使用 4 字节字符时,我上面的 70 个字符的字符串是 280 个字符,超出了 256 个字符的限制。

我在想,这可能与变量集合的存储方式在不支持超过 256 字节的类似数组或元组的数据类型中有关吗?但我正在努力通过文档确认这一点。

实际上在 SET 运算符的文档中有说明:

Usage Notes

The command supports setting multiple variables in the same statement.

If the command executing complex expressions, it might require a running virtual warehouse in the session.

The number of expressions must match the number of variables to initialize.

> The size of string or binary variables is limited to 256 bytes.

The identifier (i.e. name) for a SQL variable is limited to 256 characters.

Variable names such as CURRENT or PUBLIC are reserved for future use by Snowflake and cannot be used.

但是,就您的示例而言,它似乎也可以通过同一 SET 操作中的两个 SELECT 来完成 - 如下所示:

set (var1, var2) = (
  (select ''),
  (select 'IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII----------IIIIIIIIII')
);