所有这些都符合本指南:http://blog.cloudera.com/blog/2012/12/how-to-use-a-serde-in-apache-hive/
hive> ADD JAR /home/hadoop/hive-serdes-1.0-SNAPSHOT.jar;
Added /home/hadoop/hive-serdes-1.0-SNAPSHOT.jar to class path
Added resource: /home/hadoop/hive-serdes-1.0-SNAPSHOT.jar
在 /tmp/new
我有个档案 .json
包含以下内容:http://pastie.org/9504218
create external table命令运行正常,但不接收任何数据:
hive>
> CREATE EXTERNAL TABLE tweets (
> id BIGINT,
> created_at STRING,
> source STRING,
> favorited BOOLEAN,
> retweeted_status STRUCT<
> text:STRING,
> user:STRUCT<screen_name:STRING,name:STRING>,
> retweet_count:INT>,
> entities STRUCT<
> urls:ARRAY<STRUCT<expanded_url:STRING>>,
> user_mentions:ARRAY<STRUCT<screen_name:STRING,name:STRING>>,
> hashtags:ARRAY<STRUCT<text:STRING>>>,
> text STRING,
> user STRUCT<
> screen_name:STRING,
> name:STRING,
> friends_count:INT,
> followers_count:INT,
> statuses_count:INT,
> verified:BOOLEAN,
> utc_offset:INT,
> time_zone:STRING>,
> in_reply_to_screen_name STRING
> )
> PARTITIONED BY (datehour INT)
> ROW FORMAT SERDE 'com.cloudera.hive.serde.JSONSerDe'
> LOCATION '/tmp/new';
OK
Time taken: 0.142 seconds
选择*:
hive> select * from tweets;
OK
Time taken: 0.392 seconds
这里会发生什么?
1条答案
按热度按时间11dmarpk1#
所以问题是您已经创建了一个带有分区的外部表。但是您没有在配置单元中添加分区,也没有以这种方式在hdfs中创建目录。
以下是您可以遵循的步骤:
希望对你有帮助。。。!!!