-1

I have a file with the following columns, for which I'm being asked to "partition based on the extract date". "Extract date" is a column in the file. Here are the columns in the file:

  1. Extract date
  2. name
  3. location
  4. Extract date

Now, I have containing this file in my Unix directory.

What exactly am I being asked to do here?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • This link will help you to understand the concept - https://stackoverflow.com/questions/19128940/what-is-the-difference-between-partitioning-and-bucketing-a-table-in-hive – arunkvelu Jan 11 '19 at 14:11

1 Answers1

0

Partitioning is a feature in Hive provided to target a set of records from your table.

First you create a partitioned table based on the "Extract Date" column, like below

create table <table_name> 
(
name string,
location string
)
partitioned by (extract_date string)
stored as TEXTFILE;

By doing this your partitioned table will be created.

Now in order to load the data from a file into your table there are again many ways to do so,

  1. Loading using static partition mechanism

  2. Loading using Dynamic partition by selecting the data from another table etc.

Ankith M
  • 21
  • 4