`

hive,mysql 创建表字段报错

阅读更多
hive(hphivedb)>create table employee(name string,age int);
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
	at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.Util.getInstance(Util.java:381)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2571)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:782)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:625)
	at com.jolbox.bonecp.StatementHandle.execute(StatementHandle.java:254)
	at org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatement(AbstractTable.java:760)
	at org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatementList(AbstractTable.java:711)
	at org.datanucleus.store.rdbms.table.AbstractTable.create(AbstractTable.java:425)
	at org.datanucleus.store.rdbms.table.AbstractTable.exists(AbstractTable.java:488)
	at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation(RDBMSStoreManager.java:3380)
	at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTablesAndValidate(RDBMSStoreManager.java:3190)
	at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2841)
	at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:122)
	at org.datanucleus.store.rdbms.RDBMSStoreManager.addClasses(RDBMSStoreManager.java:1605)
	at org.datanucleus.store.AbstractStoreManager.addClass(AbstractStoreManager.java:954)
	at org.datanucleus.store.rdbms.RDBMSStoreManager.getDatastoreClass(RDBMSStoreManager.java:679)
	at org.datanucleus.store.rdbms.RDBMSStoreManager.getPropertiesForGenerator(RDBMSStoreManager.java:2045)
	at org.datanucleus.store.AbstractStoreManager.getStrategyValue(AbstractStoreManager.java:1365)
	at org.datanucleus.ExecutionContextImpl.newObjectId(ExecutionContextImpl.java:3827)
	at org.datanucleus.state.JDOStateManager.setIdentity(JDOStateManager.java:2571)
	at org.datanucleus.state.JDOStateManager.initialiseForPersistentNew(JDOStateManager.java:513)
	at org.datanucleus.state.ObjectProviderFactoryImpl.newForPersistentNew(ObjectProviderFactoryImpl.java:232)
	at org.datanucleus.ExecutionContextImpl.newObjectProviderForPersistentNew(ExecutionContextImpl.java:1414)
	at org.datanucleus.ExecutionContextImpl.persistObjectInternal(ExecutionContextImpl.java:2218)
	at org.datanucleus.ExecutionContextImpl.persistObjectWork(ExecutionContextImpl.java:2065)
	at org.datanucleus.ExecutionContextImpl.persistObject(ExecutionContextImpl.java:1913)
	at org.datanucleus.ExecutionContextThreadedImpl.persistObject(ExecutionContextThreadedImpl.java:217)
	at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:727)
	at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
	at org.apache.hadoop.hive.metastore.ObjectStore.createTable(ObjectStore.java:784)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:98)
	at com.sun.proxy.$Proxy6.createTable(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1374)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1407)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:102)
	at com.sun.proxy.$Proxy7.create_table_with_environment_context(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.create_table_with_environment_context(HiveMetaStoreClient.java:1884)
	at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.create_table_with_environment_context(SessionHiveMetaStoreClient.java:96)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:607)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:90)
	at com.sun.proxy.$Proxy8.createTable(Unknown Source)
	at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:670)
	at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3959)
	at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:295)
	at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
	at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604)
	at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:247)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:199)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:410)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:783)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

	at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:451)
	at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:732)
	at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:752)
	at org.apache.hadoop.hive.metastore.ObjectStore.createTable(ObjectStore.java:784)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RawStoreProxy.invoke(RawStoreProxy.java:98)
	at com.sun.proxy.$Proxy6.createTable(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_core(HiveMetaStore.java:1374)
	at org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.create_table_with_environment_context(HiveMetaStore.java:1407)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingHMSHandler.invoke(RetryingHMSHandler.java:102)
	at com.sun.proxy.$Proxy7.create_table_with_environment_context(Unknown Source)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.create_table_with_environment_context(HiveMetaStoreClient.java:1884)
	at org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient.create_table_with_environment_context(SessionHiveMetaStoreClient.java:96)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:607)
	at org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createTable(HiveMetaStoreClient.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.hive.metastore.RetryingMetaStoreClient.invoke(RetryingMetaStoreClient.java:90)
	at com.sun.proxy.$Proxy8.createTable(Unknown Source)
	at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:670)
	at org.apache.hadoop.hive.ql.exec.DDLTask.createTable(DDLTask.java:3959)
	at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:295)
	at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:160)
	at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:85)
	at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1604)
	at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1364)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1177)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1004)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:994)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:247)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:199)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:410)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:783)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:616)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
NestedThrowablesStackTrace:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes


造成原因:mysql数据库字符集造成的,
解决的方法是到mysql中的hive数据库里执行 alter database hive character set latin1;改变Hive元数据库的字符集。
分享到:
评论

相关推荐

    datax数据从hive导入mysql数据缺失解决

    ### DataX 数据从 Hive 导入 MySQL 数据缺失解决 #### 背景介绍 在大数据处理领域,Hive 和 MySQL 分别作为数据仓库与关系型数据库的重要组成部分,在数据流转过程中承担着关键角色。Hive 通常用于存储海量数据并...

    hive on tez 常见报错问题收集

    这里我们将深入探讨五个在Hive on Tez中常见的报错问题及其解决方案。 1. 错误一:Failing because I am unlikely to write too。 这个问题是由于Hive中的一个已知bug,具体问题可以在Apache JIRA的HIVE-16398中...

    hive的一些报错及解决方法

    - 检查MySQL数据库中Hive元数据表的版本信息,确认是否存在多版本的情况。 ```sql SELECT * FROM version; ``` - 如果确实存在多版本,则可以通过删除冗余版本或更新版本信息来解决问题。 - 为避免再次出现多...

    hive3.1.2+mysql驱动.zip

    1. 安装并启动MySQL服务,创建专门的数据库和用户用于Hive元数据。 2. 将"Hive 3.1.2+mysql驱动.zip"中的MySQL驱动JAR文件(通常为`mysql-connector-java.jar`)添加到Hive的类路径中。 3. 修改Hive的配置文件`hive-...

    hive-mysql安装包,HIVE连接mysql驱动

    新手学习大数据搭建环境所需要安装资料包,其中包括hive-mysql安装包,HIVE连接mysql驱动。其中包括 apache-hive-1.2.1-bin.tar.gz MySQL-client-5.6.24-1.el6.x86_64.rpm mysql-connector-java-5.1.27.tar.gz MySQL-...

    简单的spark 读写hive以及mysql

    在大数据处理领域,Apache Spark 和 Apache Hive 以及 MySQL 是三个重要的组件。Spark 提供了高效的数据处理能力,而 Hive 则是基于 Hadoop 的数据仓库工具,MySQL 是一种广泛使用的开源关系型数据库。本篇文章将...

    mysql数据抽取,自动生成hive建表语句

    4. **处理分区**:如果需要在Hive中创建分区表,可以分析MySQL表中的时间戳或分类字段,将其设置为Hive的分区字段。 5. **生成Hive建表语句**:基于上述信息,构造Hive的CREATE TABLE语句,包括表名、字段定义、...

    pyflink实现hive关联mysql

    pyflink将mysql数据直接插入hive,由此可以延伸出pyflink实现hive关联mysql

    springboot+mybatisplus+druid+hive+mysql.zip

    【标题】"springboot+mybatisplus+druid+hive+mysql.zip" 是一个整合了多种技术的项目压缩包,其中包含Spring Boot、MyBatisPlus、Druid、Hive和MySQL等关键组件。这些技术在现代软件开发,尤其是大数据处理和Web...

    大数据入门HIVE和MySQL安装包

    4. **创建Metastore数据库**:在MySQL中创建用于存储Hive元数据的数据库和用户。 5. **启动Hive**:启动Hive Server2和Hive Metastore服务,可以通过`hive`命令进入交互式shell。 **MySQL介绍** MySQL是一种快速、...

    centos下hive连接mysql驱动 ,mysql-connector-java-8.0.26-1.el7.noarch.

    centos 下hive连接mysql驱动 ,mysql-connector-java-8.0.26-1.el7.noarch. 使用方法: 1.下载本rpm文件后,上传至你的服务器(虚拟机) 2. rpm -ivh mysql-connector-java-8.0.26-1.el7.noarch进行安装 3.安装完成...

    hive1.2.1-mysql-connector.rar

    【标题】"hive1.2.1-mysql-connector.rar" 涉及的主要知识点是Hive 1.2.1版本与MySQL数据库的连接器。这个压缩包包含的资源是用来将Hive与MySQL数据库集成的,使得Hive能够通过MySQL作为元数据存储。 【描述】...

    hive开启权限后不能创建数据库问题

    背景:由于Hive需要开启权限管理,安装网上教程,开启权限配置,重启集群后。...发现报错: Authorization failed:No privilege 'Create' found for outputs { }. Use SHOW GRANT to get more details

    Hive、MySQL、HBase数据互导

    【Hive、MySQL、HBase数据互导】是大数据领域常见的数据处理操作,涉及三个不同的数据存储系统。Hive是一个基于Hadoop的数据仓库工具,它允许使用类SQL的查询语言HiveQL对大规模数据进行批处理和分析。MySQL是一种...

    spring-boot集成mybtis+druid实现hive/mysql多数据源切换

    本文将详细讨论如何使用Spring Boot、MyBatis和Druid来实现MySQL与Hive之间的多数据源切换,以满足不同业务场景的需求。 首先,Spring Boot是Spring框架的一种轻量级实现,它简化了配置并提供了快速开发新应用的...

    hive-3.1.2&mysql-5.7.2安装包.rar

    配置 MySQL 服务器,创建用户、数据库和权限,确保 Hive 可以安全地访问。在 Hive 中设置 metastore(元数据存储)连接,可以选择本地 MySQL 实例作为 metastore 服务,这将提高 Hive 的性能和数据一致性。 总的来...

    cloudera manager中添加hive数据库使用mysql的配置步骤

    在Cloudera Manager中配置Hive使用MySQL数据库涉及多个步骤,从卸载CentOS默认MySQL到配置完毕,下面详细说明每一步的知识点。 首先,确保在添加Hive数据库前,系统中不存在先前安装的MySQL版本。使用命令rpm -qa |...

    Hive安装,使用MySQL作为元数据库

    本教程将详细介绍如何安装Hive,并配置使用MySQL作为其元数据库。 首先,我们来理解元数据库的作用。元数据库存储了关于Hive表、分区、列等对象的元数据,这些元数据是执行Hive查询的关键。通常,Hive默认使用Derby...

    java操作Hive源码之HiveJDBC实例(mysql数据库)

    本实例将聚焦于如何使用Java和HiveJDBC来操作基于MySQL的Hive元数据存储。以下是一份详细的步骤指南和相关知识点解释: 1. **HiveJDBC简介**: HiveJDBC是Hive提供的一种JDBC驱动,使得任何支持JDBC的应用程序,如...

Global site tag (gtag.js) - Google Analytics