0
votes

I am using HDP 2.3

  • Hadoop version - 2.7.1

  • Hive version - 1.2.1

I created a table dev101 in hive using

create table dev101 (col1 int, col2 char(10));

I inserted two records using

insert into dev101 values (1, 'value1');
insert into dev101 values (2, 'value2');

I exported data to HDFS using

export table dev101 to '/tmp/dev101';

Then, I created a new table dev102 using

create table dev102 (col1 int, col2 String);

I imported data from /tmp/dev10 in dev102 using

import table dev102 from '/tmp/dev101';

I got error:

FAILED: SemanticException [Error 10120]: The existing table is not compatible with the import spec. Column Schema does not match

Then I created another table dev103 using

create table dev103 (col1 int, col2 char(50));

Again imported:

import table dev103 from '/tmp/dev101';

Same error:

FAILED: SemanticException [Error 10120]: The existing table is not compatible with the import spec. Column Schema does not match

Finally, I create table with exactly same schema

create table dev104 (col1 int, col2 char(10));

And imported

import table dev104 from '/tmp/dev101';

Imported Successfully.

Does hive need exact schema in Hive Export/Import?

1

1 Answers

0
votes

On Hive Export, it create _metadata and data directories where it keeps metadata and data respectively.

On Hive Import, you need new table (not present in hive) or blank table with exact same metadata.