prestodb配置单元目录:输入“创建外部”时没有可行的替代方案

ttp71kqs  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(363)

我正在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'

即使使用配置单元并运行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

任何帮助都将不胜感激。谢谢。

hrysbysz

hrysbysz1#

世上没有这样的事 CREATE EXTERNAL TABLE 在普雷斯托。要在presto中创建配置单元外部表,请执行以下操作:

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

相关问题