[ 
https://issues.apache.org/jira/browse/HIVE-22782?focusedWorklogId=482417&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-482417
 ]

ASF GitHub Bot logged work on HIVE-22782:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 12/Sep/20 04:40
            Start Date: 12/Sep/20 04:40
    Worklog Time Spent: 10m 
      Work Description: ashish-kumar-sharma commented on a change in pull 
request #1419:
URL: https://github.com/apache/hive/pull/1419#discussion_r487366996



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -5661,184 +5663,79 @@ public void dropConstraint(String dbName, String 
tableName, String constraintNam
     }
   }
 
-  public List<SQLDefaultConstraint> getDefaultConstraintList(String dbName, 
String tblName) throws HiveException, NoSuchObjectException {
+  public SQLAllTableConstraints getTableConstraints(String dbName, String 
tblName) throws HiveException, NoSuchObjectException {
     try {
-      return getMSC().getDefaultConstraints(new 
DefaultConstraintsRequest(getDefaultCatalog(conf), dbName, tblName));
+      AllTableConstraintsRequest tableConstraintsRequest = new 
AllTableConstraintsRequest();
+      tableConstraintsRequest.setDbName(dbName);
+      tableConstraintsRequest.setTblName(tblName);
+      tableConstraintsRequest.setCatName(getDefaultCatalog(conf));
+      return getMSC().getAllTableConstraints(tableConstraintsRequest);
     } catch (NoSuchObjectException e) {
       throw e;
     } catch (Exception e) {
       throw new HiveException(e);
     }
   }
-
-  public List<SQLCheckConstraint> getCheckConstraintList(String dbName, String 
tblName) throws HiveException, NoSuchObjectException {
-    try {
-      return getMSC().getCheckConstraints(new 
CheckConstraintsRequest(getDefaultCatalog(conf),
-          dbName, tblName));
-    } catch (NoSuchObjectException e) {
-      throw e;
-    } catch (Exception e) {
-      throw new HiveException(e);
-    }
+  public TableConstraintsInfo getAllTableConstraints(String dbName, String 
tblName) throws HiveException {
+    return getTableConstraints(dbName, tblName, false, false);
   }
 
-  /**
-   * Get all primary key columns associated with the table.
-   *
-   * @param dbName Database Name
-   * @param tblName Table Name
-   * @return Primary Key associated with the table.
-   * @throws HiveException
-   */
-  public PrimaryKeyInfo getPrimaryKeys(String dbName, String tblName) throws 
HiveException {
-    return getPrimaryKeys(dbName, tblName, false);
+  public TableConstraintsInfo getReliableAndEnableTableConstraints(String 
dbName, String tblName) throws HiveException {
+    return getTableConstraints(dbName, tblName, true, true);
   }
 
-  /**
-   * Get primary key columns associated with the table that are available for 
optimization.
-   *
-   * @param dbName Database Name
-   * @param tblName Table Name
-   * @return Primary Key associated with the table.
-   * @throws HiveException
-   */
-  public PrimaryKeyInfo getReliablePrimaryKeys(String dbName, String tblName) 
throws HiveException {
-    return getPrimaryKeys(dbName, tblName, true);
-  }
-
-  private PrimaryKeyInfo getPrimaryKeys(String dbName, String tblName, boolean 
onlyReliable)
+  private TableConstraintsInfo getTableConstraints(String dbName, String 
tblName, boolean reliable, boolean enable)

Review comment:
       Update the variable name.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 482417)
    Time Spent: 2h 20m  (was: 2h 10m)

> Consolidate metastore call to fetch constraints
> -----------------------------------------------
>
>                 Key: HIVE-22782
>                 URL: https://issues.apache.org/jira/browse/HIVE-22782
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Planning
>            Reporter: Vineet Garg
>            Assignee: Ashish Sharma
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Currently separate calls are made to metastore to fetch constraints like Pk, 
> fk, not null etc. Since planner always retrieve these constraints we should 
> retrieve all of them in one call.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to