Ami*_*ahu 1 javascript java mysql amazon-web-services amazon-athena
[查询时第一个错误][1]
select * from table where properties 'year' = 2007 // is not working
//please check the screen shot of the table
Run Code Online (Sandbox Code Playgroud)
我想通过 sql 查询在 Athena 数据集上进行查询。我尝试了每个查询,但它不适用于此 Athena 数据
我假设该properties列是 a STRING,在这种情况下,您可以执行此操作来提取该year字段并在过滤器中使用它:
SELECT * FROM table WHERE JSON_EXTRACT_SCALAR(properties, '$.year') = '2007'
Run Code Online (Sandbox Code Playgroud)
请注意,它是'2007',不是2007,因为从您的屏幕截图看来,这些值是字符串。
您可以JSON_EXTRACT_SCALAR在 Athena 当前使用的 Presto 版本的文档中阅读有关该函数和其他 JSON 操作函数的更多信息。
| 归档时间: |
|
| 查看次数: |
1842 次 |
| 最近记录: |