我在Hive catalog
的Teradata PrestoDB发行版中运行查询:
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";
抛出以下异常:
Query 20180316_022346_00001_h9iie failed: line 1:8: no viable alternative at input 'CREATE EXTERNAL'
即使我使用hive并运行show table命令,我也会看到错误,因为 Schema已设置但目录不是:
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
任何帮助将不胜感激。感谢。
答案 0 :(得分:2)
Presto中没有像CREATE EXTERNAL TABLE
这样的东西。要在Presto中创建Hive外部表,请执行以下操作:
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/'
)
请访问此页面,了解如何与Presto的Hive进行互动:https://docs.starburstdata.com/latest/connector/hive.html?highlight=hive
use hive;
仅在用户会话中设置当前架构。我想你想做点什么:USE hive.default;
。有关详细信息,请查看此处:https://docs.starburstdata.com/latest/sql/use.html