没有行匹配时更新列类型
update column type when no rows matched
"b" ~ meta[update b:1b from ([]a:1 2) where a=3][`b;`t]
但是 q 如何知道在 update
表达式中没有任何匹配行 (where a=3
) 的列 b
中应该是什么类型?
它从你的语句中推断出类型,是否匹配并不重要。它采用您为该列指定的任何类型的 null。
同样的事情如果有匹配:
q)update b:.z.D from ([]a:1 2) where a=2
a b
------------
1
2 2021.05.14
它用您的值填充匹配项,但不匹配项会获得该数据类型的相应空值。布尔值是一个灰色区域,因为技术上没有空值,但 0b
是假定的空值布尔值
"b" ~ meta[update b:1b from ([]a:1 2) where a=3][`b;`t]
但是 q 如何知道在 update
表达式中没有任何匹配行 (where a=3
) 的列 b
中应该是什么类型?
它从你的语句中推断出类型,是否匹配并不重要。它采用您为该列指定的任何类型的 null。
同样的事情如果有匹配:
q)update b:.z.D from ([]a:1 2) where a=2
a b
------------
1
2 2021.05.14
它用您的值填充匹配项,但不匹配项会获得该数据类型的相应空值。布尔值是一个灰色区域,因为技术上没有空值,但 0b
是假定的空值布尔值