【问题标题】:How to print special characters in Athena/Presto如何在 Athena/Presto 中打印特殊字符
【发布时间】:2021-03-07 04:54:09
【问题描述】:

我正在寻找一种在 aws Athena/presto 中打印制表符分隔值的方法。以下查询不这样做:

select 'fielf1\tfield2'

这给了(unsurprisingyl)

field1\tfield2

我愿意

field1    field2

这两个字段由制表符分隔。

编辑:Piotr Findeisen 提出的“标准”语法:

SELECT U&'field1\0009field2'

返回:

Your query has the following error(s):

Queries of this type are not supported (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: [...])

【问题讨论】:

    标签: amazon-web-services presto amazon-athena


    【解决方案1】:

    作为记录,一个可能的解决方案是:

    select 'field1'||chr(9)||'field2'
    

    【讨论】:

      【解决方案2】:
      SELECT U&'field1\0009field2'
      

      https://trino.io/docs/current/language/types.html#varchar查看更多示例

      【讨论】:

      • 此语法不适用于 aws Athena,我已编辑问题
      • 这很奇怪。 Athena 基于 Presto .172(2017 年 4 月),我相信我们当时已经有了这种语法。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 2014-07-27
      • 1970-01-01
      • 1970-01-01
      • 2015-11-30
      • 1970-01-01
      相关资源
      最近更新 更多