雪花 UDF require 指定输入类型。我想使用像 print("\033[1;32;40m Bright Green \n") ##and
print('\033[31m' + 'some red text')
这样的函数,它可以将多种数据类型作为输入。如果我尝试在 BigQuery 中使用的内容:
hash
我收到错误
CREATE FUNCTION hash_mod (x any type) returns int AS
$$
hash(x) % 100
$$
;
。
答案 0 :(得分:2)
您可以使用 variant
作为类型:
CREATE FUNCTION hash_mod (x variant) returns int AS
$$
hash(x) % 100
$$
;
select hash_mod(1);
select hash_mod(1.1);