在路径提取器中使用搜索路径 - Amazon Athena
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

在路径提取器中使用搜索路径

路径提取器的 SerDe 属性语法包含 <path_extractor_expression>

"ion.<column_name>.path_extractor" = "<path_extractor_expression>"

您可以使用 <path_extractor_expression> 以指定解析 Amazon Ion 文档并查找匹配数据的搜索路径。搜索路径用括号括起来,可以包含以下一个或多个以空格分隔的组件。

  • 通配符 – 匹配所有值。

  • 索引 – 匹配指定数字索引处的值。指数从零开始。

  • 文本 – 匹配字段名称与指定文本匹配的所有值。

  • 注释 – 匹配由具有指定注释的包装路径组件指定的值。

以下示例显示了 Amazon Ion 文档和一些示例搜索路径。

-- Amazon Ion document { foo: ["foo1", "foo2"] , bar: "myBarValue", bar: A::"annotatedValue" } -- Example search paths (foo 0) # matches "foo1" (1) # matches "myBarValue" (*) # matches ["foo1", "foo2"], "myBarValue" and A::"annotatedValue" () # matches {foo: ["foo1", "foo2"] , bar: "myBarValue", bar: A::"annotatedValue"} (bar) # matches "myBarValue" and A::"annotatedValue" (A::bar) # matches A::"annotatedValue"