Questions tagged [hiveddl]

Use this tag for questions about Apache Hive Data Definition Language.

Official documentation: LanguageManual DDL

117 questions
1
vote
1 answer

Hive table re-create before load every date

I saw application are droping external table and creating again then loading the data and runnning msck command every time data load..what is the benefit of this on every time dropping and creating?
KM Prak
  • 127
  • 1
  • 1
  • 6
1
vote
1 answer

Is there a way to specify Date/Timestamp format for the incoming data within the Hive CREATE TABLE statement itself?

I've have a CSV files which contain date and timestamp values in the below formats. Eg: Col1|col2 01JAN2019|01JAN2019:17:34:41 But when I define Col1 as Date and Col2 as Timestamp in my create statement, the Hive tables simply returns NULL when I…
LearneR
  • 2,351
  • 3
  • 26
  • 50
1
vote
1 answer

Map two columns into one on Athena using SerDe properties

I'm trying to map two columns into one on Athena using JsonSerDe properties. In this case, I want to map both columns conversionsRate and cr from jsons 1 and 2 to column cr_new (doing like a coalesce). json1 { "deviceType": "TABLET", "day":…
1
vote
2 answers

Deletion of Partitions

I am not able to drop partition in hive table. ALTER TABLE db.table drop if exists partition(dt="****-**-**/id=**********"); OK Time taken: 0.564 seconds But partitions are not getting deleted Below is the what I get when I check partitions of my…
1
vote
1 answer

Why my table not recognize the field delimited?

I'm trying input a text file delimited with ";", but it does not work. The create tables is OK, but all data is in one column (tp_registro). tp_registro …
lboniotti
  • 41
  • 1
  • 6
1
vote
1 answer

Input text file whitout header

I don't know which table properties I have to use for input text file without header. My text file only has one column. I have this example: STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT …
lboniotti
  • 41
  • 1
  • 6
1
vote
1 answer

Deleting the managed table will delete external table if both have the same location?

The Managed and External tables are created with the same location. When you drop the internal table what will happen to the data file? Will it cause any problem to external table or the file location of the external table?
Chris
  • 11
  • 2
1
vote
1 answer

How to undo ALTER TABLE ... ADD PARTITION without deleting data

Let's suppose I have two hive tables, table_1 and table_2. I use: ALTER TABLE table_2 ADD PARTITION (col=val) LOCATION [table_1_location] Now, table_2 will have the data in table_1 at the partition where col = val. What I want to do is reverse this…
allen kim
  • 1,705
  • 2
  • 14
  • 13
1
vote
1 answer

Hive table data load gives NULL values

Select * from movierating gives NULL values as a Result. I have tried below create table queries: CREATE TABLE movierating(id INT, movieid INT, rating INT, time string); CREATE TABLE movierating(id INT, movieid INT, rating INT, time string) ROW…
Helping Hand..
  • 2,430
  • 4
  • 32
  • 52
1
vote
1 answer

Hive import only certain file types from hdfs

I’m creating a external table using Serde org.apache.hive.hcatalog.data.JsonSerde Hdfs folder location has multiple file formats and I would like to import only json files types . I tried to use **SERDEPROPERTIES (“input.regex” = “*.json”)**…
RData
  • 959
  • 1
  • 13
  • 33
1
vote
1 answer

Changing the partition spec of a hive table and move data

I have a external hive table employee which is partitioned by extract_timestamp (yyyy-mm-dd hh:mm:ss) as below. empid empname extract_time 1 abc 2019-05-17 00:00:00 2 def 2019-05-18 14:21:00 I am trying to remove…
SreeVik
  • 43
  • 8
1
vote
1 answer

How to define a partitioned external table for a nested directory structure

For a set of datafiles stored in hdfs in a year/*.csv structure as follows: $ hdfs dfs -ls air/ Found 21 items air/year=2000 drwxr-xr-x - hadoop hadoop 0 2019-03-08 01:45 air/year=2001 drwxr-xr-x - hadoop hadoop 0…
WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
1
vote
1 answer

hive parsing json records as NULL

I have a simple hive table: hive> show create table tweets; OK CREATE EXTERNAL TABLE `tweets`( `json_body` string COMMENT 'from deserializer') ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe' STORED AS INPUTFORMAT …
John Smith
  • 315
  • 2
  • 9
1
vote
2 answers

I want to add an extra column in my existing hive table so that I can have a current time stamp for that day

Need to add extra date column in my existing hive table so that it picks up the current date from the system for that day hive (hivejobs)> select * from my_current_Table; OK name age Aditya 2 Aditya 7 I want to add a date column here so that i…
Aditya Verma
  • 201
  • 4
  • 14
1
vote
1 answer

Is it possible for a HIVE table to point to a dynamic Location based on a variable like CURRENT_DATE?

I want to be able to define (or create) a HIVE table with location having a variable. As the variable value changes, query on the HIVE table should read the files under the new location based on the variable value. Specifically, I want to use…
KKKR
  • 11
  • 1