我正在使用JetBrains‘DataGrip查询Google的DataGrip数据库。我在很多方面都喜欢UI,但我想知道的是,是否有一种更友好的方式来查看结构和数组。我讨厌BigQuery WebUI有很多原因,但我喜欢它们隐式地呈现结构和数组的方式。
select struct("s1","s2","s3")
, array(select "a1" union all select "a2" union all select "a3")
union all
select struct("s4","s5","s6")
, array(select "a4" union all select "a5" union all select "a6")为了澄清图像,我喜欢BigQuery中的以下内容:

DataGrip更难读懂:

发布于 2022-10-25 12:17:30
发布于 2022-10-25 00:53:47
不确定它在DataGrip中会是什么样子,但是尝试下面
select format('%T', col1) col1, format('%T', col2) col2 from (
select struct("s1","s2","s3") col1
, array(select "a1" union all select "a2" union all select "a3") col2
union all
select struct("s4","s5","s6")
, array(select "a4" union all select "a5" union all select "a6")
) 我在BigQuery控制台中多次使用这个技巧,以获得更好的视图,从而使结果更紧凑,更易于吞咽。

https://stackoverflow.com/questions/74187430
复制相似问题