Amazon Athena is based on Presto. Amazon Athena supports views.
Presto does not support Hive views because it doesn't want to deal with Hive Query Language. Since a view is actually a Hive query, it would have to understand hive's entire language rather than just its schema. Presto supports views via its Hive connector. These views are "Presto views", are Presto-specific (cannot be queried from Hive).
Does Athena support Hive views under the covers? Or are Athena views an entirely separate layer/bolt-on that just saves named Presto/Athena queries?
To the best of my knowledge they are Presto views. I've dug into how views are saved in the Glue catalog, and talked to the Athena team about why it's done the way it is. I'm no expert on what makes something a Presto view vs. a Hive view, but Athena is not doing anything on top of Presto when it comes to views.
When you create a view in Athena it creates a table in Glue that is of type VIRTUAL_VIEW
, and has TableInput.ViewOriginalText
with a very special structure (see below). Parameters
also needs to contain presto_view: true
.
The structure in TableInput.ViewOriginalText
looks like this /* Presto View: <BASE64 DATA> */
, where the payload is a base 64 encoded JSON structure that describes the view. Value of TableInput.ViewOriginalText
is produced by Presto (see https://github.com/prestosql/presto/blob/27a1b0e304be841055b461e2c00490dae4e30a4e/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveUtil.java#L597-L600).
If the question is whether or not views created in Athena can be used by other tools that connect to the Glue catalog I think the answer is no. The way they are encoded is Presto-specific.