1 Risposta
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
0
Hello,
Please put the 'USING' clause before the 'CREATE TABLE'
Please ensure that the database has a location associated in AWS Glue.
For example:
USING EXTERNAL FUNCTION detect_dominant_language(col1 VARCHAR) RETURNS VARCHAR LAMBDA 'textanalytics-udf'
CREATE TABLE amazon_reviews_with_language WITH ( format='parquet' ) AS
SELECT *, detect_dominant_language(review_body) AS language
FROM amazon_reviews_parquet
LIMIT 5000
References:
https://docs.aws.amazon.com/athena/latest/ug/create-table.html
https://docs.amazonaws.cn/en_us/athena/latest/ug/create-table-as.html
https://docs.aws.amazon.com/athena/latest/ug/alter-table-set-location.html
Contenuto pertinente
- AWS UFFICIALEAggiornata 3 anni fa
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 2 anni fa
Thanks, mate. Appreciate the suggestion. I'm using the database that was created previously. The location was not set in the Glue Catalog, so I set it. Then I moved 'USING' clause before 'CREATE TABLE' and now I get the following error: GENERIC_INTERNAL_ERROR: Can not create a Path from an empty string
I also tried adding a location in the 'CREATE TABLE' statement like this:
USING EXTERNAL FUNCTION detect_dominant_language(col1 VARCHAR) RETURNS VARCHAR LAMBDA 'textanalytics-udf' CREATE TABLE amazon_reviews_with_language WITH ( format='parquet' ) LOCATION 's3://my-bucket/db_path/amazon_reviews_with_language' AS SELECT *, detect_dominant_language(review_body) AS language FROM amazon_reviews_parquet LIMIT 5000
But it is not working in Athena v.3: Error: mismatched input 'LOCATION'. Expecting: '%', ')', '*', '+', ',', '-', '.', '/', 'AND', 'AS', 'AT', 'OR', '[', '||', <EOF>, <predicate>
I'm also getting errors in Engine V3 with a Lambda UDF + CTAS statement. My current workaround is to revert to Engine V2 and place USING EXTERNAL FUNCTION after CREATE TABLE AS.