Creating DDL tables ( Example) :
Sample Internal Table Creation :
CREATE TABLE IT(foo INT, bar STRING);
Sample and Temporary Table creation :
CREATE Temporary TABLE Temp_IT (foo INT, bar STRING);
Sample External table :
CREATE TABLE ET_Weather(wban INT, date STRING, precip INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’
LOCATION ‘ /hive/data/weather’;
Sample Partition Table :
CREATE TABLE PT(emp_id INT, emp_name STRING) PARTITIONED BY (dept STRING);
Sample Bucket Table ::
CREATE TABLE bucketed_table(
firstname VARCHAR(64),
lastname VARCHAR(64),
address STRING,
city VARCHAR(64),
state VARCHAR(64),
)
COMMENT 'A bucketed sorted user table'
PARTITIONED BY (country VARCHAR(64))
CLUSTERED BY (state) SORTED BY (city) INTO 32 BUCKETS
STORED AS SEQUENCEFILE;
Table creation on Index:
CREATE TEMPORARY TABLE TABLE1(
firstname VARCHAR(64),
lastname VARCHAR(64),
address STRING,
country VARCHAR(64),
city VARCHAR(64),
state VARCHAR(64),
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
stored as inputformat 'com.hadoop.mapred.DeprecatedLzoTextInputFormat'
outputformat 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
location '/attribution/B15001'
Difference :
Sample Internal Table Creation :
CREATE TABLE IT(foo INT, bar STRING);
Sample and Temporary Table creation :
CREATE Temporary TABLE Temp_IT (foo INT, bar STRING);
Sample External table :
CREATE TABLE ET_Weather(wban INT, date STRING, precip INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’
LOCATION ‘ /hive/data/weather’;
Sample Partition Table :
CREATE TABLE PT(emp_id INT, emp_name STRING) PARTITIONED BY (dept STRING);
Sample Bucket Table ::
CREATE TABLE bucketed_table(
firstname VARCHAR(64),
lastname VARCHAR(64),
address STRING,
city VARCHAR(64),
state VARCHAR(64),
)
COMMENT 'A bucketed sorted user table'
PARTITIONED BY (country VARCHAR(64))
CLUSTERED BY (state) SORTED BY (city) INTO 32 BUCKETS
STORED AS SEQUENCEFILE;
Table creation on Index:
CREATE TEMPORARY TABLE TABLE1(
firstname VARCHAR(64),
lastname VARCHAR(64),
address STRING,
country VARCHAR(64),
city VARCHAR(64),
state VARCHAR(64),
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
STORED AS TEXTFILE;
stored as inputformat 'com.hadoop.mapred.DeprecatedLzoTextInputFormat'
outputformat 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
location '/attribution/B15001'
Difference :
1 Comments