aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Flebbe <of@ofleb.be>2016-01-27 14:36:26 +0100
committerOlaf Flebbe <of@oflebbe.de>2016-01-28 15:17:59 +0100
commit749c39452b08820db660c0db625d065b2484d9f4 (patch)
tree78214d331039bc05780dd362d917acd75320d704
parentd60bfaf9f178f41eafe2a66ff8cd5071c9ff37ee (diff)
downloadbigtop-odpi-749c39452b08820db660c0db625d065b2484d9f4.tar.gz
BIGTOP-2281: Add HIVE-12875 to Bigtop
-rw-r--r--bigtop-packages/src/common/hive/patch1-HIVE-12875.diff60
1 files changed, 60 insertions, 0 deletions
diff --git a/bigtop-packages/src/common/hive/patch1-HIVE-12875.diff b/bigtop-packages/src/common/hive/patch1-HIVE-12875.diff
new file mode 100644
index 00000000..7a6acda3
--- /dev/null
+++ b/bigtop-packages/src/common/hive/patch1-HIVE-12875.diff
@@ -0,0 +1,60 @@
+--- apache-hive-1.2.1-src/ql/src/java/org/apache/hadoop/hive/ql/Driver.java.orig 2015-06-18 22:51:23.000000000 +0200
++++ apache-hive-1.2.1-src/ql/src/java/org/apache/hadoop/hive/ql/Driver.java 2016-01-27 14:34:20.179641745 +0100
+@@ -33,6 +33,7 @@
+ import java.util.Queue;
+ import java.util.Set;
+
++import com.google.common.collect.Sets;
+ import org.apache.commons.lang.StringUtils;
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+@@ -557,12 +558,27 @@
+ */
+ public static void doAuthorization(BaseSemanticAnalyzer sem, String command)
+ throws HiveException, AuthorizationException {
+- HashSet<ReadEntity> inputs = sem.getInputs();
+- HashSet<WriteEntity> outputs = sem.getOutputs();
+ SessionState ss = SessionState.get();
+ HiveOperation op = ss.getHiveOperation();
+ Hive db = sem.getDb();
+
++ Set<ReadEntity> additionalInputs = new HashSet<ReadEntity>();
++ for (Entity e : sem.getInputs()) {
++ if (e.getType() == Entity.Type.PARTITION) {
++ additionalInputs.add(new ReadEntity(e.getTable()));
++ }
++ }
++
++ Set<WriteEntity> additionalOutputs = new HashSet<WriteEntity>();
++ for (Entity e : sem.getOutputs()) {
++ if (e.getType() == Entity.Type.PARTITION) {
++ additionalOutputs.add(new WriteEntity(e.getTable(), WriteEntity.WriteType.DDL_NO_LOCK));
++ }
++ }
++
++ Set<ReadEntity> inputs = Sets.union(sem.getInputs(), additionalInputs);
++ Set<WriteEntity> outputs = Sets.union(sem.getOutputs(), additionalOutputs);
++
+ if (ss.isAuthorizationModeV2()) {
+ // get mapping of tables to columns used
+ ColumnAccessInfo colAccessInfo = sem.getColumnAccessInfo();
+@@ -759,8 +775,8 @@
+
+ }
+
+- private static void doAuthorizationV2(SessionState ss, HiveOperation op, HashSet<ReadEntity> inputs,
+- HashSet<WriteEntity> outputs, String command, Map<String, List<String>> tab2cols,
++ private static void doAuthorizationV2(SessionState ss, HiveOperation op, Set<ReadEntity> inputs,
++ Set<WriteEntity> outputs, String command, Map<String, List<String>> tab2cols,
+ Map<String, List<String>> updateTab2Cols) throws HiveException {
+
+ /* comment for reviewers -> updateTab2Cols needed to be separate from tab2cols because if I
+@@ -780,7 +796,7 @@
+ }
+
+ private static List<HivePrivilegeObject> getHivePrivObjects(
+- HashSet<? extends Entity> privObjects, Map<String, List<String>> tableName2Cols) {
++ Set<? extends Entity> privObjects, Map<String, List<String>> tableName2Cols) {
+ List<HivePrivilegeObject> hivePrivobjs = new ArrayList<HivePrivilegeObject>();
+ if(privObjects == null){
+ return hivePrivobjs;