如何在 Athena 中指定多个 grokCustomPatterns?

How to specify more than one grokCustomPatterns in Athena?

我正在尝试在 Athena 中使用 Grok 表达式,主要是作为在 AWS Glue 分类器中调试 Grok 表达式的工具。

这个有效:

CREATE EXTERNAL TABLE example_grok (
  myColumn string
)
ROW FORMAT SERDE
 'com.amazonaws.glue.serde.GrokSerDe'
WITH SERDEPROPERTIES (
'input.format'='(%{WORD:header},%{WORD:file_type},%{GREEDYDATA:head_rest})|(%{DETAILS:det},%{WORD:icp_number},%{GREEDYDATA:det_rest})',
'input.grokCustomPatterns' = 'DETAILS DET'
)
STORED AS INPUTFORMAT
 'org.apache.hadoop.mapred.TextInputFormat'
 OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
 's3://my-secret-bucket/path/';

我想指定几个自定义模式,但 the documentation 没有示例,并且 none 我尝试过的分隔符,无论是在字符串内部还是外部,都有成功了。

例如,这些工作

新行分隔(没有前导空格,那些只是为了这个post):

 'input.grokCustomPatterns' = 
 'POSTFIX_QUEUEID [0-9A-F]{7,12}
HEADER HDR'

作为 "json" 数组:

'input.grokCustomPatterns' = ['POSTFIX_QUEUEID [0-9A-F]{7,12}','HEADER HDR']

有多个条目:

'input.grokCustomPatterns'='HEADER (HDR)',
'input.grokCustomPatterns'='POSTFIX_QUEUEID [0-9A-F]{7,12}',

感谢任何帮助,

AWS 响应了我要求的文档改进。文字 \n 分隔模式。

To include multiple pattern entries into the input.grokCustomPatterns expression, use the newline escape character (\n) to separate them, as follows: 'input.grokCustomPatterns'='INSIDE_QS ([^\"])\nINSIDE_BRACKETS ([^\]])').

Grok Serde