简体   繁体   English

不支持的变量类型:STRUCT<int64></int64>

[英]Unsupported variable type: STRUCT<INT64>

I've got a query where I need to use a list of strings over and over in a query and would like to declare it once, the only thing is I've only got it working as it is in the second example and would like to not have to UNNEST我有一个查询,我需要在查询中一遍又一遍地使用字符串列表,并且想声明一次,唯一的事情是我只让它像第二个示例中那样工作并且想要不必 UNNEST

DECLARE
  list X DEFAULT (
8335, 9776, 11496);
  
  SELECT * FROM `dataset.table` WHERE quantity_sold IN list

X as not sure what type it'd have to be X 因为不确定它必须是什么类型

DECLARE
  list ARRAY<INT64> DEFAULT [
8335, 9776, 11496];
  
  SELECT * FROM `dataset.table` WHERE quantity_sold IN UNNEST(list)

this is the "trick" I am usually using in such cases这是我通常在这种情况下使用的“技巧”

with my_variables as (
  select [8335, 9776, 11496] list1, ['a', 'b', 'c'] list2
  # note: this is just one row CTE   
)
select * 
from `dataset.table`, my_valiables 
where quantity_sold in unnest(list1) 
and something_else in unnest(list1)
and yet_another_one in unnest(list2)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不能将 r.Condition.AgeInDays(int64 类型的变量)用作结构文字中的 *int64 类型 - cannot use r.Condition.AgeInDays (variable of type int64) as type *int64 in struct literal 当我将 int64 类型号写入 function 时,返回不同的数字 - When I write an int64 type number to the function, a different number is returned int64 溢出采样 n 行数(不是 %) - int64 overflow in sampling n number of rows (not %) bigquery 错误:“无法将‘41.66666667’解析为 INT64” - bigquery error: "Could not parse '41.66666667' as INT64" BigQuery - operator = 参数类型没有匹配的签名:INT64,STRING - BigQuery - No matching signature for operator = for argument types: INT64, STRING 有人可以向我解释一下吗? ROUND(AVG(cast(tripduration as int64)/60),2) - Can somebody please explain me this? ROUND(AVG(cast(tripduration as int64)/60),2) 如何从 AWS Kinesis Firehose 编写带有 int64 时间戳(而不是 int96)的 Parquet 文件? - How can I write Parquet files with int64 timestamps (instead of int96) from AWS Kinesis Firehose? mk 操作中的 BigQuery 错误:读取表时出错...“无法将分区键 &lt; &gt;(类型:TYPE_INT64)添加到架构 - BigQuery error in mk operation: Error while reading table... "failed to add partition key < > (type: TYPE_INT64) to schema 如何确定类型是否为结构 - How to determine if type is a struct S3 批量操作中的“不支持的加密类型” - "Unsupported Encryption Type" in S3 Batch Operations
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM