hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hari Sankar Sivarama Subramaniyan (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-13349) Metastore Changes : API calls for retrieving primary keys and foreign keys information
Date Wed, 20 Apr 2016 19:54:25 GMT

    [ https://issues.apache.org/jira/browse/HIVE-13349?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15250587#comment-15250587
] 

Hari Sankar Sivarama Subramaniyan commented on HIVE-13349:
----------------------------------------------------------

[~alangates] 
1. Agree that the naming for the structs should have been better. SQLPrimaryKey = SQLPrimaryKeyColumn

and SQLForeignKey = SQLForeignKeyColumn. Hence they are passed as lists since there can be
multiple columns.
Agree with the redundancy here, this is a trade-off for creating an intermediate structure
which should be mapped to a MConstraint at the server side.
The columns can be  distinguisied using the key_seq values. We expect the client to :
1. Send the key_seq correctly (1, 2, 3, ..) for the 1st, 2nd, 3rd, columns etc in the primary
key. This position is important while retreiving the constraints.
2. Send the key_seq in order while creating the table. for e.g. in case of foreign keys -
f1 = (t1.a, t1.b) f2 = (t1.c, t1.d) we expect the list (column name, key seq) to be as follows
: ((t1.a, 1), (t1.b, 2), (t1.c, 1) (t1.d, 2)) . This way each "composite foreign key" is a
sublist starting with 1 as the key sequence.

In case of foreign keys with same table, the above 2 restrictions are used to distinguish
the foreign key each struct belongs to. While retreiving the keys, the constraint name can
be used to distinguish the foreign key each struct belongs to.

Although, in some of my initial patches, the keys were part of the table struct, they were
moved to a separate MConstraint model  to avoid Table table join with Constraint table each
time the Table is retrieved. Hence the need to create create_table_with_constraints as a separate
API.

Thanks
Hari

> Metastore Changes : API calls for retrieving primary keys and foreign keys information
> --------------------------------------------------------------------------------------
>
>                 Key: HIVE-13349
>                 URL: https://issues.apache.org/jira/browse/HIVE-13349
>             Project: Hive
>          Issue Type: Sub-task
>          Components: CBO, Logical Optimizer
>            Reporter: Hari Sankar Sivarama Subramaniyan
>            Assignee: Hari Sankar Sivarama Subramaniyan
>             Fix For: 2.1.0
>
>         Attachments: 13449.2.patch, HIVE-13349.1.patch, HIVE-13349.3.patch, HIVE-13349.4.patch,
HIVE-13349.5.patch, HIVE-13349.6.patch, HIVE-13349.7.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message