Database Reference
In-Depth Information
FROM flightdata_stg fds
INSERT OVERWRITE TABLE flightdata
PARTITION(flight_date='2013-01-01')
SELECT fds.airline_cd, fds.airport_cd, fds.delay,
fds.dep_time
WHERE fds.flight_date = '2013-01-01'
To load into multiple partitions, you can create a multi-insert statement as
follows:
FROM flightdata_stg fds
INSERT OVERWRITE TABLE flightdata
PARTITION(flight_date='2013-01-01')
SELECT fds.airline_cd, fds.airport_cd, fds.delay,
fds.dep_time
WHERE fds.flight_date = '2013-01-01'
INSERT OVERWRITE TABLE flightdata
PARTITION(flight_date='2013-01-02')
SELECT fds.airline_cd, fds.airport_cd, fds.delay,
fds.dep_time
WHERE fds.flight_date = '2013-01-02'
If you have a table partitioned on more than one column, HCatalog supports
dynamic partitioning. This allows you to load more efficiently without the
need to know all the partition values ahead of time. To use dynamic
partitioning, you need the top-level partition to be static, and the rest can
be dynamic. For example, you could create a static partition on month and
a dynamic partition on date. Then you could load the dates for the month
in one statement. The following statement dynamically creates and inserts
data into a date partition for a month's worth of data:
FROM flightdata_stg fds INSERT OVERWRITE TABLE
flightdata
PARTITION(flight_month='01',flight_date)
SELECT fds.airline_cd, fds.airport_cd, fds.delay,
fds.dep_time,
fds.flight_date WHERE fds.flight_month = '01'
Search WWH ::




Custom Search