失败:ParseException 第 5:16 行无法识别“TIME”附近的输入',' “商店名称”在列类型中

发布于 2025-01-14 13:27:06 字数 660 浏览 1 评论 0原文

尝试在配置单元数据库中创建表时出现错误。我通过 docker 镜像访问它。

我正在使用的命令:

root@:/opt/Hadoop#hive -f test_db.sql

下面提到的是 .sql 文件的内容:

create database test_db;

use test_db;

CREATE EXTERNAL TABLE purchases (
  
purchase_date DATE, 
  
Purchase_time TIME,
  
store_name STRING, 
  
item_name STRING,
  
item_cost FLOAT,
 
payment STRING

) ROW FORMAT DELIMITED
FIELDS TERMINATED BY '#'
STORED AS TEXTFILE

LOCATION '/user/input/purchases';

错误是:

FAILED: ParseException line 5:16 cannot recognize input near 'TIME' ',' 
'store_name' in column type

知道这有什么问题吗?

谢谢!

I am getting error when trying to create a table in hive database. I am accessing it through docker image.

The command I am using:

root@:/opt/Hadoop#hive -f test_db.sql

Below mentioned is the content for the .sql file:

create database test_db;

use test_db;

CREATE EXTERNAL TABLE purchases (
  
purchase_date DATE, 
  
Purchase_time TIME,
  
store_name STRING, 
  
item_name STRING,
  
item_cost FLOAT,
 
payment STRING

) ROW FORMAT DELIMITED
FIELDS TERMINATED BY '#'
STORED AS TEXTFILE

LOCATION '/user/input/purchases';

The error is:

FAILED: ParseException line 5:16 cannot recognize input near 'TIME' ',' 
'store_name' in column type

Any idea what's wrong in this?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2025-01-21 13:27:06

当我将“TIME”数据类型更改为“TIMESTAMP”并尝试构建表时,我可以在 HIVE 内构建表。

create database test_db;

use test_db;

CREATE EXTERNAL TABLE purchases (

purchase_date DATE,

Purchase_time TIMESTAMP,

store_name STRING,

item_name STRING,

item_cost FLOAT,

payment STRING

) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE

LOCATION '/user/input/purchases';

When I changed the 'TIME' datatype into 'TIMESTAMP' and tried building the table, I could build the table inside HIVE.

create database test_db;

use test_db;

CREATE EXTERNAL TABLE purchases (

purchase_date DATE,

Purchase_time TIMESTAMP,

store_name STRING,

item_name STRING,

item_cost FLOAT,

payment STRING

) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE

LOCATION '/user/input/purchases';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文