I am running a query in Teradata PrestoDB distribution for Hive catalog
as:
我在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";
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:
甚至当我使用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
Any help would be appreciated. Thanks.
如有任何帮助,我们将不胜感激。谢谢。
1 个解决方案
#1
2
There is no such thing like CREATE EXTERNAL TABLE
in Presto. In order to create Hive external table in Presto, please do something like:
在Presto中没有创建外部表之类的东西。为了在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/'
)
Please visit this page to see how to interact with Hive from Presto: https://docs.starburstdata.com/latest/connector/hive.html?highlight=hive
请访问此页面以了解如何从Presto与Hive进行交互:https://docs.starburstdata.com/latest/connector/hive.html?
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
使用蜂巢;只设置用户会话中的当前模式。我认为你想做的是:使用hive.default;请在这里查看更多细节:https://docs.starburstdata.com/latest/sql/use.html。
#1
2
There is no such thing like CREATE EXTERNAL TABLE
in Presto. In order to create Hive external table in Presto, please do something like:
在Presto中没有创建外部表之类的东西。为了在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/'
)
Please visit this page to see how to interact with Hive from Presto: https://docs.starburstdata.com/latest/connector/hive.html?highlight=hive
请访问此页面以了解如何从Presto与Hive进行交互:https://docs.starburstdata.com/latest/connector/hive.html?
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
使用蜂巢;只设置用户会话中的当前模式。我认为你想做的是:使用hive.default;请在这里查看更多细节:https://docs.starburstdata.com/latest/sql/use.html。