'AthenaQueryError: Athena query failed: "NOT_SUPPORTED: Unsupported Hive type

I recently ran into the following error "AthenaQueryError: Athena query failed: "NOT_SUPPORTED: Unsupported Hive type", and for this I followed this stack overflow link: converting to timestamp with time zone failed on Athena

error:

The weird part of the whole issue is the sql query that is generated as I use an internal python plugin is working fine as I run it manually in Athena but the same doesn't work in a jupyter notebook



Solution 1:[1]

Not sure if this is the same as yours, But I ran into the same error when I was extracting some JSON data using json_extract, it works fine with Athena, but fails inside a Jupyter Notebook, throwing the same error as yours.

Putting json_format before json_extract solved it for me. casting json into an array also solved it.

Here is a example SQL code using json_format:

SELECT col1,col2 
json_format(json_extract(col3, '$JSPath')) AS some_alias 
FROM some_database

Here is the other one using CAST

SELECT col1,col2 
CAST ((json_extract(col3, '$JSPath')) AS ARRAY(JSON)) AS some_alias 
FROM some_database

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MoRen