Use Athena generated path extractors
By default, Athena searches for top level Amazon Ion values that match Hive column names and creates path extractors at runtime based on these matching values. If your Amazon Ion data format matches the Hive table schema, Athena dynamically generates the extractors for you, and you do not need to add any additional path extractors. These default path extractors are not stored in the table metadata.
The following example shows how Athena generates extractors based on column name.
-- Example Amazon Ion Document { identification: { name: "John Smith", driver_license: "XXXX" }, alias: "Johnny" } -- Example DDL CREATE EXTERNAL TABLE example_schema2 ( identification MAP<STRING, STRING>, alias STRING ) STORED AS ION LOCATION 's3://amzn-s3-demo-bucket/path_extraction1/'
The following example extractors are generated by Athena. The first extracts the
identification
field to the identification
column, and the
second extracts the alias
field to the alias
column.
'ion.identification.path_extractor' = '(identification)' 'ion.alias.path_extractor' = '(alias)'
The following example shows the extracted table.
| identification | alias | |----------------------------------------------------|----------| |{["name", "driver_license"],["John Smith", "XXXX"]} | "Johnny" |