简体   繁体   English

查询字符串列的 Redshift Spectrum 数组

[英]Querying Redshift Spectrum array of string columns

I have an external (s3) table in my redshift cluster with an array of string column.我的 redshift 集群中有一个外部 (s3) 表,其中包含一个字符串列数组。 It's literally just a list of strings.它实际上只是一个字符串列表。 I can query and only select the array column no worries.我可以查询并且只选择数组列,不用担心。 I can query all 3 of the array columns no worries but as soon as I try to query other columns that are not arrays I get the following:我可以不用担心地查询所有 3 个数组列,但是一旦我尝试查询不是数组的其他列,我就会得到以下信息:

error: Spectrum Scan Error错误:频谱扫描错误

I have tried the following as I saw it on some other stack overflow questions我已经尝试了以下一些其他堆栈溢出问题

select id_col, b
from test.test_table as a, a.array_col as b 

but when I run the above I get: navigation on array_col is not allowed as it is not a struct/tuple type但是当我运行上面的我得到: array_col 上的导航是不允许的,因为它不是结构/元组类型

Of course, this error message makes sense as it isn't a struct or tuple type but I am lost as to how on earth I can query a simple array of strings and have found no documentation on how to do this.当然,此错误消息是有道理的,因为它不是结构体或元组类型,但我不知道如何查询简单的字符串数组并且没有找到有关如何执行此操作的文档。 Any help or advice would be greatly appreciated!任何帮助或建议将不胜感激!

Since you renamed the external table, you have to use that name for all the fields that you want to retrieve;由于您重命名了外部表,因此您必须对要检索的所有字段使用该名称; in the same way you did with the array column.与处理数组列的方式相同。 Your query will be:您的查询将是:

select a.id_col, b
from test.test_table as a, a.array_col as b 

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM