mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
Athena reads a partitioned table through the partitions the Glue Data Catalog holds for it, each from its own location, and a table whose partitions are not loaded answers no rows. Floci read the table's whole location with Hive partitioning instead: a folder no partition names was read, a dropped partition's files still were, and a partition at a location outside the table's, or in a non-Hive layout, was not. - A Hive table with partition keys and no partition projection (GlueTableResolver.readsRegisteredPartitions) is read through the registered partitions holding data, each at its storage descriptor's location or <table location>/key=value/... for one that gives none (AthenaHiveDdlExecutor.defaultLocation). - They are read together (registeredPartitionsSelect): one read of every partition's location, columns matched by name, so a partition written before a column was added reads NULL for it, each row joined by its file's path to a VALUES row of its partition's location and values, cast to the keys' types. Hive's __HIVE_DEFAULT_PARTITION__ is NULL, and a value the type cannot hold fails the query with Athena's HIVE_INVALID_PARTITION_VALUE. - One listing of the table's location tells which partitions under it hold data; one elsewhere is listed on its own. The view is built once per batch for the qualified and unqualified views. - A partition that does not give one value for each key, which Glue refuses on AWS, is skipped. No partition holding data answers no rows, typed as the declared columns. AthenaDelimitedTextSidecarIntegrationTest reads a partition at its default folder and one outside the table's location, skips an unregistered folder, answers no rows with none registered, and fails a date key holding 'soon' with HIVE_INVALID_PARTITION_VALUE; it fails without this change. GlueViewDdlBuilderTest covers the view, typed keys, Hive's default partition, a Parquet read by name, a skipped malformed partition and the single listing. athena.md says so.