我使用值在HIVE(0.10.0)中创建了表:
2012-01-11 17:51 Stockton Children's Clothing 168.68 Cash
2012-01-11 17:51 Tampa Health and Beauty 441.08 Amex
............
Run Code Online (Sandbox Code Playgroud)
这里的日期和时间是制表符分隔的值,我需要在日期列上工作,由于Hive不允许使用“日期”数据类型,因此我在第一个日期列中使用了“ TIMESTAMP”(2012-01-11,...),但是,在创建表之后,它在第一列中显示NULL值。
如何解决呢?请指导。
我需要计算周日的平均销售额.salesdate列(时间戳)的值为:
2012-01-01 09:00:00
2012-01-01 09:00:00
2012-01-01 09:00:00
...........
Run Code Online (Sandbox Code Playgroud)
我使用to_date()提取了日期部分.现在如何从hive中的这个日期获得工作日(如星期日)?请指导.
我试图运行样本,例如.在CDH 4.4中使用logstash-1.4.2.每当我使用文件输入而不是stdin时,窗口会冻结以下消息:
使用里程碑2插件'文件'.这个插件应该是稳定的,但如果你看到奇怪的行为,请告诉我们!有关更多信息.....我的代码如下所示:
input {
file {
path => "/tmp/access_log"
start_position => "beginning"
}
}
filter {
if [path] =~ "access" {
mutate { replace => { "type" => "apache_access" } }
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
file{
path =>"/logs/output_log"
}
}
Run Code Online (Sandbox Code Playgroud)
Command-bin/logstash -f logstash-apache.conf
我试过在$ HOME中删除我以前的所有sincedb文件.目录并重新运行logstash,但这似乎也不起作用.我错过了什么吗?
我想将xml数据存储到hive表,XML数据中:
<servicestatuslist>
<recordcount>1266</recordcount>
<servicestatus id="435680">
<status_text>/: 61%used(9714MB/15975MB) (<80%) : OK</status_text>
<display_name>/ Disk Usage</display_name>
<host_name>zabbix.vshodc.com</host_name>
</servicestatus>
</servicestatuslist>
Run Code Online (Sandbox Code Playgroud)
我已经将jar文件添加到路径中
hive> add jar /home/cloudera/HiveJars/hivexmlserde-1.0.5.1.jar ;
Added /home/cloudera/HiveJars/hivexmlserde-1.0.5.1.jar to class path
Added resource: /home/cloudera/HiveJars/hivexmlserde-1.0.5.1.jar
Run Code Online (Sandbox Code Playgroud)
我写了一个hive serDe查询:
create table xml_AIR(id STRING, status_text STRING,display_name STRING ,host_name STRING)
row format serde 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
with serdeproperties(
"column.xpath.id"="/servicestatus/@id",
"column.xpath.status_text"="/servicestatus/status_text/text()",
"column.xpath.display_name"="/servicestatus/display_name/text()",
"column.xpath.host_name"="/servicestatus/host_name/text()"
)
stored as
inputformat 'com.ibm.spss.hive.serde2.xml.XmlInputFormat'
outputformat 'org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat'
LOCATION '/user/cloudera/input/air.xml'
tblproperties(
"xmlinput.start"="<servicestatus",
"xmlinput.end"="</servicestatus>"
);
OK
Time taken: 1.609 seconds
Run Code Online (Sandbox Code Playgroud)
当我发出select命令时,它没有显示表的数据:
hive> select * from xml_AIR;
OK
Time taken: 3.0 seconds …Run Code Online (Sandbox Code Playgroud)