PrestoDB Hive Catalog:输入没有可行的替代方案 'CREATE EXTERNAL'

PrestoDB Hive Catalog: no viable alternative at input 'CREATE EXTERNAL'

我正在 运行在 Teradata PrestoDB 分发版中为 Hive catalog 查询:

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 命令,我也会看到一个错误,因为 设置了架构但没有设置目录 :

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

如有任何帮助,我们将不胜感激。谢谢。

Presto 中没有 CREATE EXTERNAL TABLE 这样的东西。为了在 Presto 中创建外部 Hive table,请执行以下操作:

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