I am running a query in Teradata PrestoDB distribution for Hive catalog
as:
CREATE EXTERNAL TABLE hive.default.mydata
id INT, datetime timestamp, latitude FLOAT,
longitude FLOAT, bookingid VARCHAR, pre_lat FLOAT,
pre_long FLOAT, time_hour decimal(6, 1), dist_kms decimal(6, 1),
ma6_dist_kms decimal(6, 1), istationary INT, quality_overall VARCHAR,
quality_nonstationary VARCHAR, cartype VARCHAR, isbigloss INT,
bookregion VARCHAR, iho_road VARCHAR)
STORED AS PARQUET
LOCATION "s3://sb.mycompany.com/someFolder/anotherFolder";
Throwing following exception:
Query 20180316_022346_00001_h9iie failed: line 1:8: no viable alternative at input 'CREATE EXTERNAL'
Even when I use hive and run a show table command, I see an error as Schema is set but catalog is not:
presto> use hive;
presto:hive> show tables;
Error running command:
Error starting query at http://localhost:8080/v1/statement returned HTTP response code 400.
Response info:
JsonResponse{statusCode=400, statusMessage=Bad Request, headers={Content-Length=[32], Date=[Fri, 16 Mar 2018 02:25:25 GMT], Content-Type=[text/plain]}, hasValue=false, value=null}
Response body:
Schema is set but catalog is not
Any help would be appreciated. Thanks.
There is no such thing like CREATE EXTERNAL TABLE
in Presto. In order to create Hive external table in Presto, please do something like:
CREATE TABLE hive.web.request_logs (
request_time timestamp,
url varchar,
ip varchar,
user_agent varchar
)
WITH (
format = 'TEXTFILE',
external_location = 's3://my-bucket/data/logs/'
)
Please visit this page to see how to interact with Hive from Presto: https://docs.starburstdata.com/latest/connector/hive.html?highlight=hive
use hive;
set only the current schema in the user session. I think you wanted to do something like: USE hive.default;
. Please take a look here for more details: https://docs.starburstdata.com/latest/sql/use.html