cancel
Showing results for 
Search instead for 
Did you mean: 

Hive - Complex data types - Issue reverse engineering followed by Updating DB based on Model

0 Kudos

I'm trying to reverse engineer a Hive DB with a complex data type such as Array or Map and then add a new column to that table in PD and then Apply Model Changes to DB. The output script has an issue.

Example:

create external table DBA.ADDR (

   ADDR_ID              decimal(10,0),

   SHIPPER_ID           decimal(10,0),

   EMP_ID               decimal(10,0),

   ADDR_TYP_CODE        string(10),

   ADDR_LINE_1          string(40),

   ADDR_LINE_2          string(40),

   ZIP_CODE             string(10),

   CITY                 string(40),

   ARRAY_EXAMPLE        array < decimal(10,0) >,

   MAP_EXAMPLE            map < int, decimal(10,0) >

);

I then add a column to this table in PD and then 'Apply Model Changes to DB...'

The resulting script is:

create external table DBA.ADDR (

   ADDR_ID              decimal(10,0),

   SHIPPER_ID           decimal(10,0),

   EMP_ID               decimal(10,0),

   ADDR_TYP_CODE        string(10),

   ADDR_LINE_1          string(40),

   ADDR_LINE_2          string(40),

   ZIP_CODE             string(10),

   CITY                 string(40),

   ARRAY_EXAMPLE         < undefined (.L:Type=) >,

   MAP_EXAMPLE           < undefined (.L:Type=) >,

   COLUMN_13            string(10)

)

The complex columns now have < undefined (.L:Type=) > as the data type.

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member200945
Contributor
0 Kudos

I got correct result:

alter table ADDR

add column COLLUM_13 string(10);

This is the step:

1) Save your PDM as archived PDM format.

2) Add the column to the original PDM.

3) Apply Model Change to Databases. Select "Using an archive model"

0 Kudos

I followed your sequence Phillip but got the same result as before.

The difference is that I'm using the 'Always use create statements' option.

This is sometimes necessary and it creates a new 'create table' statement instead of using the alter statement which you had.

Even if I changed the value to 'Use alter statement when possible' it won't always use the 'alter' statement. For example if I change the 'partitioned by' option it will recreate the table with the same issue as above.

Here is my test case. The Hive pdm is create with this table.

create external table DBA.ADDR (

   ADDR_ID              decimal(10,0),

   SHIPPER_ID           decimal(10,0),

   EMP_ID               decimal(10,0),

   ADDR_TYP_CODE        string(10),

   ADDR_LINE_1          string(40),

   ADDR_LINE_2          string(40),

   ZIP_CODE             string(10),

   CITY                 string(40),

   ARRAY_EXAMPLE        array < decimal(10,0) >,

   MAP_EXAMPLE            map < int, decimal(10,0) >

)

   partitioned by (STATE string(40), CNTRY string(40));

I change the partition by to be CNTRY only and then I applied changes to db.

Thanks.

former_member200945
Contributor
0 Kudos

Will open a bug report.

0 Kudos

Thank you.