请告诉我如何将数据从hdfs加载到hive表??因为我把昨天下载的推文弄丢了。加载我在下面使用的数据。
LOAD DATA LOCAL INPATH '/user/hue/twitter/tweets/2017/03/10'
OVERWRITE INTO TABLE tweets
PARTITION (datehour=20170310).
给我一个正确的查询这是我的表。我分两步发送
CREATE EXTERNAL TABLE twitter.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 '/twitter';
样本数据:附加的数据很少
{"filter_level":"low","retweeted":false,"in_reply_to_screen_name":null,"possibly_sensitive":false,"truncated":false,"lang":"en","in_reply_to_status_id_str":null,"id":840649342042148865,"extended_entities":{"media":[{"sizes":{"thumb":{"w":150,"resize":"crop","h":150},"small":{"w":340,"resize":"fit","h":340},"medium":{"w":600,"resize":"fit","h":600},"large":{"w":960,"resize":"fit","h":960}},"source_user_id":15934076,
我发现将数据从hdfs加载到hive表是,
LOAD DATA INPATH '/user/hue/twitter/tweets/2017/03/10' OVERWRITE INTO TABLE tweets PARTITION (datehour=20170310).
这是正确的,我会失去我的源文件??如果是,那么什么是解决方案查询??
暂无答案!
目前还没有任何答案,快来回答吧!