无法将数据加载到配置单元创建的分区表中。告诉我'hive.partition not

时间:2018-09-01 06:39:06

标签: hadoop hive hiveql

当我将数据加载到hive中时,它告诉我“ hive.partition不存在”是错误的

centos7.2 蜂巢0.12 hadoop 2.7.6

--------------行---------

当我创建表时,使用外部表插入MySQL,

详细信息是:

create external table people(id int,name string)

partitioned by (logdate string,hour string) row format delimited

fields terminated by ',';

但是!加载数据时会出错。

java.sql.SQLSyntaxErrorException: Table 'hive.PARTITIONS' doesn't exist

所以我检查MySQL中的数据库和表。数据库配置单元已经存在,但是表分区确实不存在。

然后,我找到了一个像这样的表名-> partition_keys

mysql> show tables;
+---------------------------+
| Tables_in_hive            |
+---------------------------+
| BUCKETING_COLS            |
| CDS                       |
| COLUMNS_V2                |
| DATABASE_PARAMS           |
| DBS                       |
| PARTITION_KEYS            |
| SDS                       |
| SD_PARAMS                 |

然后我描述并选择该表(partition_keys)

mysql> describe PARTITION_KEYS;
+--------------+---------------+------+-----+---------+-------+
| Field        | Type          | Null | Key | Default | Extra |
+--------------+---------------+------+-----+---------+-------+
| TBL_ID       | bigint(20)    | NO   | PRI | NULL    |       |
| PKEY_COMMENT | varchar(4000) | YES  |     | NULL    |       |
| PKEY_NAME    | varchar(128)  | NO   | PRI | NULL    |       |
| PKEY_TYPE    | varchar(767)  | NO   |     | NULL    |       |
| INTEGER_IDX  | int(11)       | NO   |     | NULL    |       |
+--------------+---------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

mysql> 
mysql> select * from PARTITION_KEYS;
+--------+--------------+-----------+-----------+-------------+
| TBL_ID | PKEY_COMMENT | PKEY_NAME | PKEY_TYPE | INTEGER_IDX |
+--------+--------------+-----------+-----------+-------------+
|      1 | NULL         | hour      | string    |           1 |
|      1 | NULL         | logdate   | string    |           0 |
|      6 | NULL         | hour      | string    |           1 |
|      6 | NULL         | logdate   | string    |           0 |
+--------+--------------+-----------+-----------+-------------+
4 rows in set (0.00 sec)

我的元数据在其中。

但是我无法将数据加载到我已创建的配置单元表中。我该怎么办?

我发现它也无法将表名更改为分区,原因是MySQL的关键字是partition。

我需要帮助,我花了很多时间来处理它。谢谢。

------------------更新以上传我的hive-site.xml ----------------- ------------

该网站不能超过30000个字符。而且我只是使用默认配置cp -r hive-default.xml hive-site.xml。这样我就可以在此默认站点中进行一些更改,如下所示:

  • <property> <name>hive.metastore.schema.verification</name> <value>false</value> </property>

  • <property> <name>hive.server2.thrift.sasl.qop</name> <value>auth</value> <description>Sasl QOP value; Set it to one of following values to enable higher levels of protection for hive server2 communication with clients. "auth" - authentication only (default) "auth-int" - authentication plus integrity protection "auth-conf" - authentication plus integrity and confidentiality protection This is applicable only hive server2 is configured to use kerberos authentication. </description> </property>

  • <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value> <description>JDBC connect string for a JDBC metastore</description> </property>

  • <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property>

其他更改是连接名称,密码。不做任何关于hive-site.xml的事情。

0 个答案:

没有答案