草庐IT

java - 如何在 Hive 嵌入式模式下运行包含 "select count(*)"和 "group by"子句的 Hive Sql 查询?

如何在Hive嵌入式模式下运行此查询(1)selectproduct,count(*)ascntfromhive_bigpetstore_etlgroupbyproduct在Maven控制台中,我得到一个InvocationTargetException异常在我找到的Hive日志文件中java.lang.Exception:java.lang.NullPointerExceptionatorg.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:354)Causedby:java.lang.NullPointe

hadoop - Hive QL 中的条件 GROUP BY 子句

我正在尝试在HiveQL脚本中参数化GROUPBY子句。SELECTCOUNT(*)ASsales,country,state,cityFROMtestdb.dataWHEREPRICE>5GROUPBYIF(TRUE,(country,state,city),(country,state))如何实现这样的查询? 最佳答案 我曾尝试在GROUPBY及其作品中使用CASE语句。不过,您可能想要验证查询结果。如果您可以将您的条件转换为case语句,则此查询可以工作。SELECT*FROMtestdb.dataWHEREprice>5GR

hadoop - 确定 Hive "order by"子句中的 reducer 数量

我有一个2.6MB大小的CSV文件。我创建了一个配置单元表并在其中加载了csv文件。现在,如果我将查询编写为“select*fromabcorderbya;”,mapreduce使用了1个reducer。它是如何识别reducer的数量为1的呢?它使用默认值“1”还是其他什么?一般来说,hive如何决定在“orderby”、“sortby”或“groupby”子句中使用多少个reducer? 最佳答案 它与数据大小有关,默认为每1GB1个,由此属性调节:hive.exec.reducers.bytes.per.reducer如果你想

java - 配置单元顶点失败 : killed/failed due to:ROOT_INPUT_INIT_FAILURE Caused by: java. lang.NullPointerException

我正在查询一个表,一个简单的计数(*)并收到以下错误:Vertexfailed,vertexName=Map1,vertexId=vertex_1486982569467_0809_3_00,diagnostics=[Vertexvertex_1486982569467_0809_3_00[Map1]killed/faileddueto:ROOT_INPUT_INIT_FAILURE,VertexInput:table_nameinitializerfailed,vertex=vertex_1486982569467_0809_3_00[Map1],java.lang.RuntimeE

xml - 配置单元-site.xml : The element type "configuration" must be terminated by the matching end-tag "</configuration>"

为了练习/学习,我正在尝试在Ubuntu系统上安装Hive。我正在遵循一组预先编写的说明。它说通过转到$HIVE_HOME并运行bin/hive来测试Hive安装。当我这样做时,我得到了相当大的文本转储,但我认为最重要的一点如下:**[FatalError]hive-site.xml:2787:3:Theelementtype"configuration"mustbeterminatedbythematchingend-tag"".17/05/0610:46:12FATALconf.Configuration:errorparsingconffile:/usr/local/hive/c

scala - Spark 流 : Write Data to HDFS by reading from one HDFSdir to another

我正在尝试使用SparkStreaming将数据从一个HDFS位置读取到另一个位置下面是我在spark-shell上的代码片段但我看不到在HDFS输出目录上创建的文件能否指出如何在HDFS上加载文件scala>sc.stop()scala>importorg.apache.spark.SparkConfscala>importorg.apache.spark.streamingscala>importorg.apache.spark.streaming.{StreamingContext,Seconds}scala>valconf=newSparkConf().setMaster("l

hadoop - Caused by : java. lang.ClassCastException : org. apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text

我正在尝试编译以下github项目https://github.com/DigitalPebble/behemoth/tree/master/uima我收到以下错误java.lang.ClassCastException:org.apache.hadoop.io.LongWritablecannotbecasttoorg.apache.hadoop.io.Text代码定义了以下输出键和值类。其中BehemothDocument是定义的自定义类job.setInputFormat(SequenceFileInputFormat.class);job.setOutputFormat(Seq

java - HBase 获取扫描器异常 - "This is supposed to be overridden by subclasses"

我正在尝试运行以下代码:Clustercluster=newCluster();cluster.add("localhost",port_number);Clientclient=newClient(cluster);RemoteHTabletable=newRemoteHTable(client,"my_table");Scanscan=newScan();scan.setStartRow(startKey);scan.setStopRow(endKey);scan.addFamily(columnFamily);ResultScannerscanner=table.getScann

hadoop - pig : how to separate data by positions in a single line

通常,如果我们在一行中有任何分隔符,我们会这样做。load"pigtest.txt"usingPigStorage(',')as(year:int,temp:float);下面是单行数据的示例。0029029070999991901010106004+64333+023450FM12+000599999V0202701N015919999999N0000001N9-00781+99999102001ADDGF108991999999999999999999我需要提取年份1901(16thpositionto4positions)吨emperature(89thpositionto4po

hadoop - Hive group by with cube 和 group by 在同一个查询中

假设我正在观察表架构如下的超速事​​故:createtablespeeding_data(date_of_occurrencedate,yearint,makestring,modelstring,speedint);我想观察这些特征的不同组合下的平均速度,但希望它始终按date_of_occurrence分组,例如可能是这样的selectdate_of_occurrence,year,make,model,avg(speed)fromspeeding_datagroupbydate_of_occurrencegroupbyyear,make,modelwithcube;只是想知道在h