incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1376341 - in /incubator/hcatalog/branches/branch-0.4: CHANGES.txt src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
Date Thu, 23 Aug 2012 01:25:35 GMT
Author: gates
Date: Thu Aug 23 01:25:35 2012
New Revision: 1376341

URL: http://svn.apache.org/viewvc?rev=1376341&view=rev
Log:
HCATALOG-471 Test HCat_ShowDes_1[1-3] fails

Modified:
    incubator/hcatalog/branches/branch-0.4/CHANGES.txt
    incubator/hcatalog/branches/branch-0.4/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java

Modified: incubator/hcatalog/branches/branch-0.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.4/CHANGES.txt?rev=1376341&r1=1376340&r2=1376341&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.4/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.4/CHANGES.txt Thu Aug 23 01:25:35 2012
@@ -61,6 +61,8 @@ Trunk (unreleased changes)
   OPTIMIZATIONS
 
   BUG FIXES
+  HCAT-471 Test HCat_ShowDes_1[1-3] fails (vikram.dixit via gates)
+
   HCAT-451 Partitions are created even when Jobs are aborted (avandana)
 
   HCAT-436 JSON SerDe column misnaming on CTAS (khorgath via gates)

Modified: incubator/hcatalog/branches/branch-0.4/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.4/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java?rev=1376341&r1=1376340&r2=1376341&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.4/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
(original)
+++ incubator/hcatalog/branches/branch-0.4/src/java/org/apache/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
Thu Aug 23 01:25:35 2012
@@ -243,6 +243,19 @@ public class HCatSemanticAnalyzer extend
     }
   }
 
+  private String extractTableName (String compoundName) {
+    /* 
+     * the table name can potentially be a dot-format one with column names
+     * specified as part of the table name. e.g. a.b.c where b is a column in
+     * a and c is a field of the object/column b etc. For authorization 
+     * purposes, we should use only the first part of the dotted name format.
+     *
+     */
+
+   String [] words = compoundName.split("\\.");
+   return words[0];
+  }
+
   @Override
   protected void authorizeDDLWork(HiveSemanticAnalyzerHookContext cntxt, Hive hive, DDLWork
work)
       throws HiveException {
@@ -344,14 +357,19 @@ public class HCatSemanticAnalyzer extend
       //other alter operations are already supported by Hive
     }
 
+    // we should be careful when authorizing table based on just the 
+    // table name. If columns have separate authorization domain, it 
+    // must be honored
     DescTableDesc descTable = work.getDescTblDesc();
     if (descTable != null) {
-      authorizeTable(cntxt.getHive(), descTable.getTableName(), Privilege.SELECT);
+      String tableName = extractTableName(descTable.getTableName());
+      authorizeTable(cntxt.getHive(), tableName, Privilege.SELECT);
     }
 
     ShowPartitionsDesc showParts = work.getShowPartsDesc();
     if (showParts != null) {
-      authorizeTable(cntxt.getHive(), showParts.getTabName(), Privilege.SELECT);
+      String tableName = extractTableName(showParts.getTabName());
+      authorizeTable(cntxt.getHive(), tableName, Privilege.SELECT);
     }
   }
 }



Mime
View raw message