hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sushanth Sowmyan (JIRA)" <>
Subject [jira] [Commented] (HIVE-10250) Optimize AuthorizationPreEventListener to reuse TableWrapper objects
Date Mon, 20 Apr 2015 21:50:59 GMT


Sushanth Sowmyan commented on HIVE-10250:

I looked into the test failure, and here's what I see:

Using PartitionWrapper(org.apache.hadoop.hive.ql.metadata.Table,org.apache.hadoop.hive.metastore.api.Partition)
expects the Table object to be initialized, and the Partition.getSd() to not be null.
As of the time the preEventListener is fired, the org.apache.hadoop.hive.metastore.api.Partition
has not yet had its sd initialized. So, we might want to add a bit to the PartitionWrapper(org.apache.hadoop.hive.ql.metadata.Table,org.apache.hadoop.hive.metastore.api.Partition)
ctor so that it's similar to the PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition,
 PreEventContext) ctor, and then we can use a TableWrapper instead. Note that if the TableWrapper
itself has a null sd, we have a potential failure condition - fetching using  context.getHandler().get_table_core
is the right call instead of using a TableWrapper then. It might even be worth fetching a
Table once and caching it, instead of creating a TableWrapper and caching it.

> Optimize AuthorizationPreEventListener to reuse TableWrapper objects
> --------------------------------------------------------------------
>                 Key: HIVE-10250
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Authorization
>            Reporter: Mithun Radhakrishnan
>            Assignee: Mithun Radhakrishnan
>         Attachments: HIVE-10250.1.patch
> Here's the {{PartitionWrapper}} class in {{AuthorizationPreEventListener}}:
> {code:java|}
>  public static class PartitionWrapper extends org.apache.hadoop.hive.ql.metadata.Partition
> ...
>     public PartitionWrapper(org.apache.hadoop.hive.metastore.api.Partition mapiPart,
PreEventContext context) throws ... {
>  Partition wrapperApiPart   = mapiPart.deepCopy();
>  Table t = context.getHandler().get_table_core(
>              mapiPart.getDbName(), 
>              mapiPart.getTableName());
> ...
> }
> {code}
> {{PreAddPartitionEvent}} (and soon, {{PreDropPartitionEvent}}) correspond not just to
a single partition, but an entire set of partitions added atomically. When the event is authorized,
{{HMSHandler.get_table_core()}} will be called once for every partition in the Event instance.
> Since we already make the assumption that the partition-sets correspond to a single table,
we might as well make a single call.
> I'll have a patch for this, shortly.

This message was sent by Atlassian JIRA

View raw message