Login  Register

Create table like old table.

classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Create table like old table.

prabhatkashyap
10 posts
Hello I'm trying to create a table like my old table but it is not creating as expected.

0: jdbc:hive2://localhost:10000> CREATE TABLE mainTable(id INT, name STRING) STORED BY 'carbondata';
+---------+--+
| Result  |
+---------+--+
+---------+--+
No rows selected (0.206 seconds)
0: jdbc:hive2://localhost:10000> DESC mainTable;
+-----------+------------+----------+--+
| col_name  | data_type  | comment  |
+-----------+------------+----------+--+
| name      | string     |          |
| id        | bigint     |          |
+-----------+------------+----------+--+
2 rows selected (0.056 seconds)

Above one is my mainTable and I wants to create copiedTable from it but everytime it is show something like:

0: jdbc:hive2://localhost:10000> CREATE TABLE copiedTable LIKE mainTable;
+---------+--+
| result  |
+---------+--+
+---------+--+
No rows selected (0.101 seconds)
0: jdbc:hive2://localhost:10000> DESC copiedTable;
+-----------+----------------+--------------------+--+
| col_name  |   data_type    |      comment       |
+-----------+----------------+--------------------+--+
| col       | array<string>  | from deserializer  |
+-----------+----------------+--------------------+--+
1 row selected (0.022 seconds)

0: jdbc:hive2://localhost:10000> LOAD DATA LOCAL INPATH 'hdfs://localhost:54310/user/hduser/datafiles/data.csv' INTO TABLE copiedTable OPTIONS('DELIMITER'=',');
Error: java.lang.RuntimeException: Data loading failed. table not found: knoldus.copiedtable (state=,code=0)

0: jdbc:hive2://localhost:10000> select * from copiedTable;
+------+--+
| col  |
+------+--+
+------+--+
No rows selected (0.11 seconds)
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Create table like old table.

ravipesala
300 posts
Carbon did not implement 'create table like'  feature. But it should not create wrong table if we use 'like' command, either it should throw error saying it does not support or it should create right table. Its an issue, please raise a jira.