Questions tagged [hiveddl]

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

Official documentation: LanguageManual DDL

117 questions
14
votes
2 answers

HIVE - INSERT OVERWRITE vs DROP TABLE + CREATE TABLE + INSERT INTO

I'm doing some automatic script of few queries in hive and we found that we need time to time clear the data from a table and insert the new one. And we are thinking what could be faster? INSERT OVERWRITE TABLE SOME_TABLE SELECT * FROM…
Thiago Baldim
  • 7,362
  • 3
  • 29
  • 51
8
votes
4 answers

How to truncate a partitioned external table in hive?

I'm planning to truncate the hive external table which has one partition. So, I have used the following command to truncate the table : hive> truncate table abc; But, it is throwing me an error stating : Cannot truncate non-managed table abc. Can…
fervent
  • 123
  • 1
  • 2
  • 10
8
votes
4 answers

how to add columns to existing hive partitioned table?

alter table abc add columns (stats1 map, stats2 map) i have altered my table with above query. But after while checking the data i got NULL's for the both extra columns. I'm not getting data. screenshot
Veeru Chow
  • 81
  • 1
  • 1
  • 3
6
votes
1 answer

How to create an empty copy of a table in hive

I have a table with lots of columns. I don't want to write something like CREATE TABLE IF NOT EXISTS table1( col1 int, col2 String, etc....) Is there a fast way to create a table with the same structure, but without any data?
gjin
  • 860
  • 1
  • 14
  • 28
6
votes
2 answers

Does DROP PARTITION delete data from external table in HIVE?

An external table in HIVE is partitioned on year, month and day. So does the following query delete data from external table for the specific partitioned referenced in this query?:- ALTER TABLE MyTable DROP IF EXISTS…
Dhiraj
  • 3,396
  • 4
  • 41
  • 80
5
votes
1 answer

What are the allowed data types of partition column in hive?

I am pretty sure that complex types like STRUCT can not be the type of a partition column. But I am not sure if all the primitive types are valid or not. I have read a lot of documentation but didn't find anything.
Wang Zhong
  • 125
  • 2
  • 9
5
votes
1 answer

Create Table in Hive with one file

I'm creating a new table in Hive using: CREATE TABLE new_table AS select * from old_table; My problem is that after the table is created, It generates multiple files for each partition - while I want only one file for each partition. How can I…
Bramat
  • 979
  • 4
  • 24
  • 40
4
votes
2 answers

Understanding Hive table creation notation

I have come across Hive tables which I need to convert to Redshift/MySql equivalent. I am having trouble understanding Hive query structure and would appreciate some help: CREATE TABLE IF NOT EXISTS table_1 ( id BIGINT, price DOUBLE, …
madu
  • 5,232
  • 14
  • 56
  • 96
4
votes
3 answers

Create new table from the exiting table in Hive

I am trying to create a new table with the existing table using Hive query. While creating a new table I want to add a new column and insert current timestamp for all the rows. For example: Exiting table: |user_id|user_name|user_address| |1001 …
mayank bisht
  • 618
  • 3
  • 14
  • 43
4
votes
1 answer

Sorted Table in Hive (ORC file format)

I'm having some difficulties to make sure I'm leveraging sorted data within a Hive table. (Using ORC file format) I understand we can affect how the data is read from a Hive table, by declaring a DISTRIBUTE BY clause in the create DDL. CREATE TABLE…
raul ferreira
  • 886
  • 7
  • 21
4
votes
1 answer

How to partition a Hive Table using range of values for a column

I have a Hive Table with 2 columns.Employee ID and Salary. Data is something like given below. Employee ID Salary 1 10000.08 2 20078.67 3 20056.45 4 30000.76 5 10045.14 6 43567.76 I want to create Partitions based on Salary Column.For…
Surbhi
  • 43
  • 1
  • 3
4
votes
1 answer

Hive Create table - When to use VARCHAR and STRING as column data type

I am trying to create a HIVE table. I am not sure when we use VARCHAR and when we use String. If we use VARCHAR then do we have to define length like we define in RDBMS as VARCHAR(10) Please help
v83rahul
  • 283
  • 2
  • 7
  • 20
4
votes
1 answer

S3 hive external table on subdirectories is not working

I have following s3 directory structure. Data/ Year=2015/ Month=01/ Day=01/ files Day=02/ files Month=02/ Day=01/ files Day=02/ …
user3313379
  • 459
  • 10
  • 21
3
votes
1 answer

Repartition in Hadoop

My question is mostly theoretical, but i have some tables that already follow some sort of partition scheme, lets say my table is partitioned by day, but after working with the data for sometime we want to modifity to month partitions instead, i…
frammnm
  • 537
  • 1
  • 5
  • 17
3
votes
2 answers

Cannot find class 'org.apache.hadoop.hive.druid.DruidStorageHandler'

The jar file for druid hive handler is there. Clients table is already there in hive with data. Filename in hive library folder hive-druid-handler-3.1.2.jar. I am getting the error an when I try to create table in hive for druid FAILED:…
Vishnu
  • 93
  • 1
  • 5
1
2 3 4 5 6 7 8