Tag: hive

使用Hiveserver2 Thrift Java客户端时请求挂起

这是这个问题的后续问题 ,我在哪里询问Hiveserver 2 thrift java客户端API是什么。 如果您不需要任何更多背景,这个问题应该能够在没有背景的情况下站立。 无法找到有关如何使用hiverserver2 thrift api的任何文档,我把它放在一起。 我能找到的最佳参考是Apache JDBC实现 。 TSocket transport = new TSocket(“hive.example.com”, 10002); transport.setTimeout(999999999); TBinaryProtocol protocol = new TBinaryProtocol(transport); TCLIService.Client client = new TCLIService.Client(protocol); transport.open(); TOpenSessionReq openReq = new TOpenSessionReq(); TOpenSessionResp openResp = client.OpenSession(openReq); TSessionHandle sessHandle = openResp.getSessionHandle(); TExecuteStatementReq execReq = new TExecuteStatementReq(sessHandle, “SHOW TABLES”); TExecuteStatementResp execResp = client.ExecuteStatement(execReq); TOperationHandle […]

写入HDFS只能复制到0个节点而不是minReplication(= 1)

我有3个数据节点正在运行,而在运行作业时我得到以下错误, java.io.IOException:File / user / ashsshar / olhcache / loaderMap9b663bd9只能复制到0个节点而不是minReplication(= 1)。 运行中有3个数据节点,此操作中排除了3个节点。 在org.apache.hadoop.hdfs.server.blockmanagement.BlockManager.chooseTarget(BlockManager.java:1325) 此错误主要发生在我们的DataNode实例空间不足或DataNode未运行时。 我尝试重新启动DataNodes但仍然遇到相同的错误。 我的集群节点上的dfsadmin -reports清楚地显示了大量可用空间。 我不确定为什么会这样。

Apache Hive JDBC驱动程序在哪里下载?

我需要通过JDBC从Java程序连接到Hive。 我搜索了谷歌,发现了许多这样的指南和示例: HiveServer2客户端 但是,我无法在任何地方找到JDBC驱动程序本身(jar文件)。 似乎有一个jar文件可以从Cloudera下载,但它需要注册。 有谁知道在哪里可以获得普通的Apache Hive JDBC驱动程序?

如何使用Hive支持创建SparkSession(未找到“Hive类”)?

当我尝试运行此代码时,我收到此错误。 import org.apache.spark.sql.Dataset; import org.apache.spark.sql.Row; import org.apache.spark.sql.SparkSession; public class App { public static void main(String[] args) throws Exception { String warehouseLocation = “file:” + System.getProperty(“user.dir”) + “spark-warehouse”; SparkSession spark = SparkSession .builder().master(“local”) .appName(“Java Spark Hive Example”) .config(“spark.sql.warehouse.dir”, warehouseLocation).enableHiveSupport() .getOrCreate(); String path = “/home/cloudera/Downloads/NetBeansProjects/sparksql1/src/test/Employee.json”; spark.sql(“CREATE TABLE IF NOT EXISTS src (key INT, value STRING)”); spark.sql(“LOAD DATA […]

PIG – 找到接口org.apache.hadoop.mapreduce.JobContext,但是类是预期的

我试图从蜂巢中加载一个表。 我正在使用Hcatalog。 我使用登录hive pig -useHCatalog 我从蜂巢和hadoop出口几乎所有的jar子 register ‘hdfs://localhost:8020/user/pig/jars/hive-jdbc-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-exec-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-common-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-metastore-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/mysql-connector-java-5.1.28-bin.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-beeline-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-builtins-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-cli-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-contrib-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-hbase-handler-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-hwi-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-metastore-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-pdk-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-serde-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-service-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hive-shims-0.10.0-cdh4.5.0.jar’; register ‘hdfs://localhost:8020/user/pig/jars/antlr-2.7.7.jar’; register ‘hdfs://localhost:8020/user/pig/jars/antlr-runtime-3.4.jar’; register ‘hdfs://localhost:8020/user/pig/jars/avro-1.7.4.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hcatalog-core-0.5.0-incubating.jar’; register ‘hdfs://localhost:8020/user/pig/jars/hcatalog-pig-adapter-0.5.0-incubating.jar’; register ‘hdfs://localhost:8020/user/pig/jars/avro-ipc-1.7.4-tests.jar’; register ‘hdfs://localhost:8020/user/pig/jars/avro-mapred-1.7.4-hadoop2.jar’; register ‘hdfs://localhost:8020/user/pig/jars/commons-cli-1.2.jar’; register […]

java中的java.sql.SQLException:org.apache.thrift.transport.TTransportException?

我正在尝试使用java在hive中创建表。 我发现 java.sql.SQLException: org.apache.thrift.transport.TTransportException 在执行我的代码时。 这是我的代码 public void createTable(String tableName) { try{ Statement stat = con.createStatement(); String QueryString = “CREATE TABLE ‘”+tableName+”‘(User_Id INTEGER NOT NULL AUTO_INCREMENT, ” + “User_Name VARCHAR(25), UserId VARCHAR(20), User_Pwd VARCHAR(15), primary key(User_Id))”; a = stat.executeUpdate(QueryString); if(a==1){ System.out.println(a); System.out.println(“Table has been created”); } }catch(Exception e){ System.out.println(e);} } 为什么抛出此exception以及如何解决它。