【问题标题】:Creating column names with "(" in hive 1.1.0在 hive 1.1.0 中使用“(”创建列名
【发布时间】:2017-01-03 07:12:18
【问题描述】:

我尝试在 hive 中创建表如下:

create table IF NOT EXISTS department(deptid int, deptname(1) string, deptname(2) string)
row format delimited
fields terminated by ','
lines terminated by '\n'
stored as textfile;

我收到错误

编译语句时出错:FAILED: ParseException line 1:58 cannot identify input near '(' '1' ')' in column type

有没有其他方法可以用“(”创建列

【问题讨论】:

    标签: hive


    【解决方案1】:

    使用`反引号)转义圆括号)。

    它可以用于表名和字段名。

    试试:

    create table IF NOT EXISTS department(`deptid` int, `deptname(1)` string, `deptname(2)` string) row format delimited fields terminated by ',' lines terminated by '\n' stored as textfile;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-02
      相关资源
      最近更新 更多