on 09-25-2016 8:23 PM
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.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.