This is an automated email from the ASF dual-hosted git repository.
jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 634d93d HIVE-21968: Remove index related codes (Miklos Gergely,
reviewed by Jesus Camacho Rodriguez)
634d93d is described below
commit 634d93d2b3ab8b4387a8e36a13430222205a7396
Author: Miklos Gergely <[email protected]>
AuthorDate: Wed Jul 10 18:18:22 2019 -0700
HIVE-21968: Remove index related codes (Miklos Gergely, reviewed by Jesus
Camacho Rodriguez)
Close apache/hive#707
---
.../TestDDLWithRemoteMetastoreSecondNamenode.java | 6 -
.../test/resources/testconfiguration.properties | 10 +-
.../authorization/plugin/HiveOperationType.java | 9 +-
.../plugin/sqlstd/Operation2Privilege.java | 393 +++++++++-----------
.../queries/clientpositive/ql_rewrite_gbtoidx.q | 177 ---------
.../clientpositive/ql_rewrite_gbtoidx_cbo_1.q | 175 ---------
.../clientpositive/ql_rewrite_gbtoidx_cbo_2.q | 394 ---------------------
7 files changed, 162 insertions(+), 1002 deletions(-)
diff --git
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDDLWithRemoteMetastoreSecondNamenode.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDDLWithRemoteMetastoreSecondNamenode.java
index de33833..a56802c 100644
---
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDDLWithRemoteMetastoreSecondNamenode.java
+++
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/TestDDLWithRemoteMetastoreSecondNamenode.java
@@ -50,8 +50,6 @@ public class TestDDLWithRemoteMetastoreSecondNamenode extends
TestCase {
private static final String Table5Name = "table5_nondefault_nn";
private static final String Table6Name = "table6_nondefault_nn";
private static final String Table7Name = "table7_nondefault_nn";
- private static final String Index1Name = "index1_table1_nondefault_nn";
- private static final String Index2Name = "index2_table1_nondefault_nn";
private static final String tmpdir = System.getProperty("test.tmp.dir");
private static final String tmpdirFs2 = "/" +
TestDDLWithRemoteMetastoreSecondNamenode.class.getName();
private static final Path tmppath = new Path(tmpdir);
@@ -141,10 +139,6 @@ public class TestDDLWithRemoteMetastoreSecondNamenode
extends TestCase {
}
private void cleanup() throws Exception {
- String[] srcidx = {Index1Name, Index2Name};
- for (String src : srcidx) {
- driver.run("DROP INDEX IF EXISTS " + src + " ON " + Table1Name);
- }
String[] srctables = {Table1Name, Table2Name, Database1Name + "." +
Table3Name,
Database1Name + "." + Table4Name, Table5Name, Table6Name};
for (String src : srctables) {
diff --git a/itests/src/test/resources/testconfiguration.properties
b/itests/src/test/resources/testconfiguration.properties
index 9eb5bf6..3ccba2b 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -4,12 +4,9 @@
minimr.query.files=doesnotexist.q\
# Tests that are not enabled for CLI Driver
-disabled.query.files=ql_rewrite_gbtoidx.q,\
- ql_rewrite_gbtoidx_cbo_1.q,\
- cbo_rp_subq_in.q,\
+disabled.query.files=cbo_rp_subq_in.q,\
cbo_rp_subq_not_in.q,\
cbo_rp_subq_exists.q,\
- ql_rewrite_gbtoidx_cbo_2.q,\
rcfile_merge1.q,\
stats_filemetadata.q,\
cbo_rp_insert.q,\
@@ -1754,11 +1751,6 @@ miniSparkOnYarn.query.files=auto_sortmerge_join_16.q,\
vector_outer_join4.q,\
vector_outer_join5.q
-# These tests are removed from miniSparkOnYarn.query.files
-# ql_rewrite_gbtoidx.q,\
-# ql_rewrite_gbtoidx_cbo_1.q,\
-# smb_mapjoin_8.q,\
-
localSpark.only.query.files=spark_local_queries.q
spark.query.negative.files=groupby2_map_skew_multi_distinct.q,\
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
index 09c15f0..0b2080a 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
@@ -38,7 +38,7 @@ public enum HiveOperationType {
SWITCHDATABASE,
LOCKDB,
UNLOCKDB,
- DROPTABLE ,
+ DROPTABLE,
DESCTABLE,
DESCFUNCTION,
MSCK,
@@ -76,7 +76,6 @@ public enum HiveOperationType {
SHOW_CREATEDATABASE,
SHOW_CREATETABLE,
SHOWFUNCTIONS,
- SHOWINDEXES,
SHOWPARTITIONS,
SHOWLOCKS,
SHOWCONF,
@@ -91,9 +90,6 @@ public enum HiveOperationType {
CREATE_MATERIALIZED_VIEW,
DROPVIEW,
DROP_MATERIALIZED_VIEW,
- CREATEINDEX,
- DROPINDEX,
- ALTERINDEX_REBUILD,
ALTERVIEW_PROPERTIES,
DROPVIEW_PROPERTIES,
LOCKTABLE,
@@ -118,7 +114,6 @@ public enum HiveOperationType {
TRUNCATETABLE,
CREATETABLE_AS_SELECT,
QUERY,
- ALTERINDEX_PROPS,
ALTERDATABASE,
ALTERDATABASE_OWNER,
ALTERDATABASE_LOCATION,
@@ -177,7 +172,7 @@ public enum HiveOperationType {
GET_FUNCTIONS, // getFunctions(String catalog, String schemaPattern, String
functionNamePattern)
GET_SCHEMAS, // getSchemas()
GET_TABLES, // getTables(String catalog, String schemaPattern, String
tableNamePattern, String[] types)
- GET_TABLETYPES,// getTableTypes()
+ GET_TABLETYPES, // getTableTypes()
GET_TYPEINFO // getTypeInfo()
// ==== HiveServer2 metadata api types ends here ==== //
diff --git
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
index 6137983..f3c8cc5 100644
---
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
+++
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
@@ -134,162 +134,140 @@ public class Operation2Privilege {
adminPrivOps = new ArrayList<HiveOperationType>();
op2Priv = new HashMap<HiveOperationType, List<PrivRequirement>>();
- op2Priv.put(HiveOperationType.EXPLAIN, PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR,
- SEL_NOGRANT_AR)); //??
+ op2Priv.put(HiveOperationType.EXPLAIN,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, SEL_NOGRANT_AR)); //??
op2Priv.put(HiveOperationType.CREATEDATABASE,
PrivRequirement.newPrivRequirementList(
new PrivRequirement(INS_SEL_DEL_NOGRANT_AR,
HivePrivilegeObjectType.DFS_URI),
new PrivRequirement(INS_SEL_DEL_NOGRANT_AR,
HivePrivilegeObjectType.LOCAL_URI)));
- op2Priv.put(HiveOperationType.DROPDATABASE,
PrivRequirement.newIOPrivRequirement
-(null, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROPDATABASE,
PrivRequirement.newIOPrivRequirement(null, OWNER_PRIV_AR));
// this should be database usage privilege once it is supported
- op2Priv.put(HiveOperationType.SWITCHDATABASE,
PrivRequirement.newIOPrivRequirement
-(null, null));
+ op2Priv.put(HiveOperationType.SWITCHDATABASE,
PrivRequirement.newIOPrivRequirement(null, null));
// lock operations not controlled for now
- op2Priv.put(HiveOperationType.LOCKDB, PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.UNLOCKDB,
PrivRequirement.newIOPrivRequirement
-(null, null));
-
- op2Priv.put(HiveOperationType.DROPTABLE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, null));
- op2Priv.put(HiveOperationType.DESCTABLE,
PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR, null));
- op2Priv.put(HiveOperationType.SHOWPARTITIONS,
PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR, null));
- op2Priv.put(HiveOperationType.DESCFUNCTION,
PrivRequirement.newIOPrivRequirement
-(null, null));
+ op2Priv.put(HiveOperationType.LOCKDB,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.UNLOCKDB,
PrivRequirement.newIOPrivRequirement(null, null));
+
+ op2Priv.put(HiveOperationType.DROPTABLE,
PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, null));
+ op2Priv.put(HiveOperationType.DESCTABLE,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOWPARTITIONS,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.DESCFUNCTION,
PrivRequirement.newIOPrivRequirement(null, null));
// meta store check command - equivalent to add partition command
// no input objects are passed to it currently, but keeping admin priv
// requirement on inputs just in case some input object like file
// uri is added later
- op2Priv.put(HiveOperationType.MSCK, PrivRequirement.newIOPrivRequirement
-(ADMIN_PRIV_AR, INS_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.MSCK,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, INS_NOGRANT_AR));
//alter table commands require table ownership
// There should not be output object, but just in case the table is
incorrectly added
// to output instead of input, adding owner requirement on output will
catch that as well
- op2Priv.put(HiveOperationType.ALTERTABLE_ADDCOLS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_REPLACECOLS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_RENAMECOL,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_RENAMEPART,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_RENAME,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_UPDATETABLESTATS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_UPDATEPARTSTATS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_TOUCH,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_ARCHIVE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_UNARCHIVE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_PROPERTIES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_OWNER,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_SERIALIZER,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_PARTCOLTYPE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_SERIALIZER,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_SERDEPROPERTIES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_SERDEPROPERTIES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_CLUSTER_SORT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_BUCKETNUM,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_BUCKETNUM,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_PROTECTMODE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_PROTECTMODE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_FILEFORMAT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_FILEFORMAT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_LOCATION,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, INS_SEL_DEL_NOGRANT_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_LOCATION,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, INS_SEL_DEL_NOGRANT_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_MERGEFILES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERPARTITION_MERGEFILES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_SKEWED,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTBLPART_SKEWED_LOCATION,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, INS_SEL_DEL_NOGRANT_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_COMPACT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_UPDATECOLUMNS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.TRUNCATETABLE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_DROPCONSTRAINT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERTABLE_ADDCONSTRAINT,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
-
- //table ownership for create/drop/alter index
- op2Priv.put(HiveOperationType.CREATEINDEX,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, INS_SEL_DEL_NOGRANT_AR));
- op2Priv.put(HiveOperationType.DROPINDEX,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERINDEX_REBUILD,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERINDEX_PROPS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_ADDCOLS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_REPLACECOLS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_RENAMECOL,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_RENAMEPART,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_RENAME,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_UPDATETABLESTATS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_UPDATEPARTSTATS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_TOUCH,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_ARCHIVE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_UNARCHIVE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_PROPERTIES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_OWNER,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_SERIALIZER,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_PARTCOLTYPE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_SERIALIZER,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_SERDEPROPERTIES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_SERDEPROPERTIES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_CLUSTER_SORT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_BUCKETNUM,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_BUCKETNUM,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_PROTECTMODE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_PROTECTMODE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_FILEFORMAT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_FILEFORMAT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_LOCATION,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR,
INS_SEL_DEL_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_LOCATION,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR,
INS_SEL_DEL_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_MERGEFILES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERPARTITION_MERGEFILES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_SKEWED,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTBLPART_SKEWED_LOCATION,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR,
INS_SEL_DEL_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_COMPACT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_UPDATECOLUMNS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.TRUNCATETABLE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_DROPCONSTRAINT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_ADDCONSTRAINT,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
// require view ownership for alter/drop view
- op2Priv.put(HiveOperationType.ALTERVIEW_PROPERTIES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.DROPVIEW_PROPERTIES,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERVIEW_RENAME,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERVIEW_AS,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.DROPVIEW,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTER_MATERIALIZED_VIEW_REWRITE,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
- op2Priv.put(HiveOperationType.DROP_MATERIALIZED_VIEW,
PrivRequirement.newIOPrivRequirement
-(OWNER_PRIV_AR, OWNER_PRIV_AR));
-
- op2Priv.put(HiveOperationType.ANALYZE_TABLE,
PrivRequirement.newIOPrivRequirement
-(arr(SQLPrivTypeGrant.SELECT_NOGRANT, SQLPrivTypeGrant.INSERT_NOGRANT), null));
- op2Priv.put(HiveOperationType.CACHE_METADATA,
PrivRequirement.newIOPrivRequirement
-(arr(SQLPrivTypeGrant.SELECT_NOGRANT, SQLPrivTypeGrant.INSERT_NOGRANT), null));
- op2Priv.put(HiveOperationType.SHOWDATABASES,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWTABLES,
PrivRequirement.newIOPrivRequirement
-(null, null));
+ op2Priv.put(HiveOperationType.ALTERVIEW_PROPERTIES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROPVIEW_PROPERTIES,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERVIEW_RENAME,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERVIEW_AS,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROPVIEW,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTER_MATERIALIZED_VIEW_REWRITE,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROP_MATERIALIZED_VIEW,
+ PrivRequirement.newIOPrivRequirement(OWNER_PRIV_AR, OWNER_PRIV_AR));
+
+ op2Priv.put(HiveOperationType.ANALYZE_TABLE,
+
PrivRequirement.newIOPrivRequirement(arr(SQLPrivTypeGrant.SELECT_NOGRANT,
SQLPrivTypeGrant.INSERT_NOGRANT),
+ null));
+ op2Priv.put(HiveOperationType.CACHE_METADATA,
+
PrivRequirement.newIOPrivRequirement(arr(SQLPrivTypeGrant.SELECT_NOGRANT,
SQLPrivTypeGrant.INSERT_NOGRANT),
+ null));
+ op2Priv.put(HiveOperationType.SHOWDATABASES,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOWTABLES,
PrivRequirement.newIOPrivRequirement(null, null));
// operations that require insert/delete privileges
- op2Priv.put(HiveOperationType.ALTERTABLE_DROPPARTS,
PrivRequirement.newIOPrivRequirement
-(DEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.ALTERTABLE_DROPPARTS,
PrivRequirement.newIOPrivRequirement(DEL_NOGRANT_AR, null));
// in alter-table-add-partition, the table is output, and location is input
- op2Priv.put(HiveOperationType.ALTERTABLE_ADDPARTS,
PrivRequirement.newIOPrivRequirement
-(INS_SEL_DEL_NOGRANT_AR, INS_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.ALTERTABLE_ADDPARTS,
+ PrivRequirement.newIOPrivRequirement(INS_SEL_DEL_NOGRANT_AR,
INS_NOGRANT_AR));
// select with grant for exporting contents
- op2Priv.put(HiveOperationType.EXPORT, PrivRequirement.newIOPrivRequirement
-(SEL_GRANT_AR, INS_SEL_DEL_NOGRANT_AR));
+ op2Priv.put(HiveOperationType.EXPORT,
+ PrivRequirement.newIOPrivRequirement(SEL_GRANT_AR,
INS_SEL_DEL_NOGRANT_AR));
// For import statement, require uri rwx+owner privileges on input uri, and
// necessary privileges on the output table and database
// NOTE : privileges are only checked if the object of that type is marked
as part of ReadEntity or WriteEntity
@@ -307,12 +285,9 @@ public class Operation2Privilege {
// for a broad privilege such as this is the best route forward. REPL
STATUS
// should use privileges similar to DESCRIBE DB/TABLE, and so, it asks for
no
// output privileges, and asks for select-no-grant on input.
- op2Priv.put(HiveOperationType.REPLDUMP,
PrivRequirement.newIOPrivRequirement(
- ADMIN_PRIV_AR, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.REPLLOAD,
PrivRequirement.newIOPrivRequirement(
- ADMIN_PRIV_AR, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.REPLSTATUS,
PrivRequirement.newIOPrivRequirement(
- SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.REPLDUMP,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.REPLLOAD,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.REPLSTATUS,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
adminPrivOps.add(HiveOperationType.REPLDUMP);
adminPrivOps.add(HiveOperationType.REPLLOAD);
adminPrivOps.add(HiveOperationType.KILL_QUERY);
@@ -333,12 +308,9 @@ public class Operation2Privilege {
adminPrivOps.add(HiveOperationType.DROPFUNCTION);
// operations require select priv
- op2Priv.put(HiveOperationType.SHOWCOLUMNS,
PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR, null));
- op2Priv.put(HiveOperationType.SHOW_TABLESTATUS,
PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR, null));
- op2Priv.put(HiveOperationType.SHOW_TBLPROPERTIES,
PrivRequirement.newIOPrivRequirement
-(SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOWCOLUMNS,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOW_TABLESTATUS,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOW_TBLPROPERTIES,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
op2Priv.put(HiveOperationType.CREATETABLE_AS_SELECT,
PrivRequirement.newPrivRequirementList(
new PrivRequirement(SEL_NOGRANT_AR, IOType.INPUT),
new PrivRequirement(INS_SEL_DEL_NOGRANT_AR,
HivePrivilegeObjectType.DFS_URI),
@@ -360,16 +332,13 @@ public class Operation2Privilege {
)
);
- op2Priv.put(HiveOperationType.LOAD, PrivRequirement.newIOPrivRequirement
-(INS_SEL_DEL_NOGRANT_AR,
+ op2Priv.put(HiveOperationType.LOAD,
PrivRequirement.newIOPrivRequirement(INS_SEL_DEL_NOGRANT_AR,
arr(SQLPrivTypeGrant.INSERT_NOGRANT,
SQLPrivTypeGrant.DELETE_NOGRANT)));
// show create table is more sensitive information, includes table
properties etc
// for now require select WITH GRANT
- op2Priv.put(HiveOperationType.SHOW_CREATETABLE,
PrivRequirement.newIOPrivRequirement
-(SEL_GRANT_AR, null));
- op2Priv.put(HiveOperationType.SHOW_CREATEDATABASE,
PrivRequirement.newIOPrivRequirement
-(SEL_GRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOW_CREATETABLE,
PrivRequirement.newIOPrivRequirement(SEL_GRANT_AR, null));
+ op2Priv.put(HiveOperationType.SHOW_CREATEDATABASE,
PrivRequirement.newIOPrivRequirement(SEL_GRANT_AR, null));
// for now allow only create-view with 'select with grant'
// the owner will also have select with grant privileges on new view
@@ -381,112 +350,68 @@ public class Operation2Privilege {
new PrivRequirement(SEL_GRANT_AR, IOType.INPUT),
new PrivRequirement(OWNER_PRIV_AR, HivePrivilegeObjectType.DATABASE)));
- op2Priv.put(HiveOperationType.SHOWFUNCTIONS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWINDEXES,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWLOCKS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.CREATEFUNCTION,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.DROPFUNCTION,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.RELOADFUNCTION,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.CREATEMACRO,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.DROPMACRO,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.SHOW_COMPACTIONS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOW_TRANSACTIONS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWCONF,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWVIEWS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOWMATERIALIZEDVIEWS,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.LOCKTABLE,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.UNLOCKTABLE,
PrivRequirement.newIOPrivRequirement
-(null, null));
+ op2Priv.put(HiveOperationType.SHOWFUNCTIONS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOWLOCKS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.CREATEFUNCTION,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROPFUNCTION,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.RELOADFUNCTION,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.CREATEMACRO,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.DROPMACRO,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.SHOW_COMPACTIONS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOW_TRANSACTIONS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOWCONF,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOWVIEWS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOWMATERIALIZEDVIEWS,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.LOCKTABLE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.UNLOCKTABLE,
PrivRequirement.newIOPrivRequirement(null, null));
// require db ownership, if there is a file require SELECT , INSERT, and
DELETE
op2Priv.put(HiveOperationType.CREATETABLE,
PrivRequirement.newPrivRequirementList(
new PrivRequirement(INS_SEL_DEL_NOGRANT_AR, IOType.INPUT),
new PrivRequirement(OWNER_PRIV_AR, HivePrivilegeObjectType.DATABASE)));
- op2Priv.put(HiveOperationType.ALTERDATABASE,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERDATABASE_OWNER,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.ALTERDATABASE_LOCATION,
PrivRequirement.newIOPrivRequirement
-(null, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.DESCDATABASE,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.DFS, PrivRequirement.newIOPrivRequirement
-(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.RESET, PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.COMPILE, PrivRequirement.newIOPrivRequirement
-(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.ADD, PrivRequirement.newIOPrivRequirement
-(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
- op2Priv.put(HiveOperationType.DELETE, PrivRequirement.newIOPrivRequirement
-(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERDATABASE,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERDATABASE_OWNER,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.ALTERDATABASE_LOCATION,
PrivRequirement.newIOPrivRequirement(null, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.DESCDATABASE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.DFS,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.RESET,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.COMPILE,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.ADD,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
+ op2Priv.put(HiveOperationType.DELETE,
PrivRequirement.newIOPrivRequirement(ADMIN_PRIV_AR, ADMIN_PRIV_AR));
// set command is currently not authorized through the API
- op2Priv.put(HiveOperationType.SET, PrivRequirement.newIOPrivRequirement
-(null, null));
+ op2Priv.put(HiveOperationType.SET,
PrivRequirement.newIOPrivRequirement(null, null));
// The following actions are authorized through SQLStdHiveAccessController,
// and it is not using this privilege mapping, but it might make sense to
move it here
- op2Priv.put(HiveOperationType.CREATEROLE,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.DROPROLE,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.GRANT_PRIVILEGE,
PrivRequirement.newIOPrivRequirement
-(null,
- null));
- op2Priv.put(HiveOperationType.REVOKE_PRIVILEGE,
PrivRequirement.newIOPrivRequirement
-(null,
- null));
- op2Priv.put(HiveOperationType.SHOW_GRANT,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.GRANT_ROLE,
PrivRequirement.newIOPrivRequirement
- (null, null));
- op2Priv.put(HiveOperationType.REVOKE_ROLE,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOW_ROLES,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOW_ROLE_GRANT,
PrivRequirement.newIOPrivRequirement
-(null, null));
- op2Priv.put(HiveOperationType.SHOW_ROLE_PRINCIPALS,
- PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.CREATEROLE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.DROPROLE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.GRANT_PRIVILEGE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.REVOKE_PRIVILEGE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOW_GRANT,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.GRANT_ROLE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.REVOKE_ROLE,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOW_ROLES,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOW_ROLE_GRANT,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SHOW_ROLE_PRINCIPALS,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_CATALOGS,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_SCHEMAS,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_TABLES,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_FUNCTIONS,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_TABLETYPES,
PrivRequirement.newIOPrivRequirement(null, null));
op2Priv.put(HiveOperationType.GET_TYPEINFO,
PrivRequirement.newIOPrivRequirement(null, null));
- op2Priv.put(HiveOperationType.GET_COLUMNS,
- PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
-
- op2Priv.put(HiveOperationType.START_TRANSACTION,
PrivRequirement.newIOPrivRequirement
- (null, null));
- op2Priv.put(HiveOperationType.COMMIT, PrivRequirement.newIOPrivRequirement
- (null, null));
- op2Priv.put(HiveOperationType.ROLLBACK,
PrivRequirement.newIOPrivRequirement
- (null, null));
- op2Priv.put(HiveOperationType.SET_AUTOCOMMIT,
PrivRequirement.newIOPrivRequirement
- (null, null));
+ op2Priv.put(HiveOperationType.GET_COLUMNS,
PrivRequirement.newIOPrivRequirement(SEL_NOGRANT_AR, null));
+
+ op2Priv.put(HiveOperationType.START_TRANSACTION,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.COMMIT,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.ROLLBACK,
PrivRequirement.newIOPrivRequirement(null, null));
+ op2Priv.put(HiveOperationType.SET_AUTOCOMMIT,
PrivRequirement.newIOPrivRequirement(null, null));
// For alter table exchange partition, we need select & delete on input &
insert on output
op2Priv.put(
HiveOperationType.ALTERTABLE_EXCHANGEPARTITION,
PrivRequirement.newIOPrivRequirement(
arr(SQLPrivTypeGrant.SELECT_NOGRANT,
SQLPrivTypeGrant.DELETE_NOGRANT), INS_NOGRANT_AR));
- op2Priv.put(HiveOperationType.ABORT_TRANSACTIONS,
PrivRequirement.newIOPrivRequirement
- (null, null));
+ op2Priv.put(HiveOperationType.ABORT_TRANSACTIONS,
PrivRequirement.newIOPrivRequirement(null, null));
// Handled via adminPrivOps (see above).
op2Priv.put(HiveOperationType.KILL_QUERY,
PrivRequirement.newIOPrivRequirement(null, null));
diff --git a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx.q
b/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx.q
deleted file mode 100644
index e3996e3..0000000
--- a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx.q
+++ /dev/null
@@ -1,177 +0,0 @@
---! qt:dataset:srcpart
---! qt:dataset:lineitem
-set hive.stats.dbclass=fs;
-set hive.stats.autogather=true;
-set hive.cbo.enable=false;
-
-DROP TABLE IF EXISTS lineitem_ix_n1;
-CREATE TABLE lineitem_ix_n1 (L_ORDERKEY INT,
- L_PARTKEY INT,
- L_SUPPKEY INT,
- L_LINENUMBER INT,
- L_QUANTITY DOUBLE,
- L_EXTENDEDPRICE DOUBLE,
- L_DISCOUNT DOUBLE,
- L_TAX DOUBLE,
- L_RETURNFLAG STRING,
- L_LINESTATUS STRING,
- l_shipdate STRING,
- L_COMMITDATE STRING,
- L_RECEIPTDATE STRING,
- L_SHIPINSTRUCT STRING,
- L_SHIPMODE STRING,
- L_COMMENT STRING)
-ROW FORMAT DELIMITED
-FIELDS TERMINATED BY '|';
-
-LOAD DATA LOCAL INPATH '../../data/files/lineitem.txt' OVERWRITE INTO TABLE
lineitem_ix_n1;
-
-CREATE INDEX lineitem_ix_lshipdate_idx ON TABLE lineitem_ix_n1(l_shipdate) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(l_shipdate)");
-ALTER INDEX lineitem_ix_lshipdate_idx ON lineitem_ix_n1 REBUILD;
-
-explain select l_shipdate, count(l_shipdate)
-from lineitem_ix_n1
-group by l_shipdate;
-
-select l_shipdate, count(l_shipdate)
-from lineitem_ix_n1
-group by l_shipdate
-order by l_shipdate;
-
-set hive.optimize.index.groupby=true;
-
-explain select l_shipdate, count(l_shipdate)
-from lineitem_ix_n1
-group by l_shipdate;
-
-select l_shipdate, count(l_shipdate)
-from lineitem_ix_n1
-group by l_shipdate
-order by l_shipdate;
-
-set hive.optimize.index.groupby=false;
-
-
-explain select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix_n1
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix_n1
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-set hive.optimize.index.groupby=true;
-
-explain select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix_n1
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix_n1
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-explain select lastyear.month,
- thisyear.month,
- (thisyear.monthly_shipments - lastyear.monthly_shipments) /
-lastyear.monthly_shipments as monthly_shipments_delta
- from (select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
- from lineitem_ix_n1
- where year(l_shipdate) = 1997
- group by year(l_shipdate), month(l_shipdate)
- ) lastyear join
- (select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
- from lineitem_ix_n1
- where year(l_shipdate) = 1998
- group by year(l_shipdate), month(l_shipdate)
- ) thisyear
- on lastyear.month = thisyear.month;
-
-explain select l_shipdate, cnt
-from (select l_shipdate, count(l_shipdate) as cnt from lineitem_ix_n1 group by
l_shipdate
-union all
-select l_shipdate, l_orderkey as cnt
-from lineitem_ix_n1) dummy;
-
-CREATE TABLE tbl_n2(key int, value int);
-CREATE INDEX tbl_key_idx ON TABLE tbl_n2(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-ALTER INDEX tbl_key_idx ON tbl_n2 REBUILD;
-
-EXPLAIN select key, count(key) from tbl_n2 where key = 1 group by key;
-EXPLAIN select key, count(key) from tbl_n2 group by key;
-
-EXPLAIN select count(1) from tbl_n2;
-EXPLAIN select count(key) from tbl_n2;
-
-EXPLAIN select key FROM tbl_n2 GROUP BY key;
-EXPLAIN select key FROM tbl_n2 GROUP BY value, key;
-EXPLAIN select key FROM tbl_n2 WHERE key = 3 GROUP BY key;
-EXPLAIN select key FROM tbl_n2 WHERE value = 2 GROUP BY key;
-EXPLAIN select key FROM tbl_n2 GROUP BY key, substr(key,2,3);
-
-EXPLAIN select key, value FROM tbl_n2 GROUP BY value, key;
-EXPLAIN select key, value FROM tbl_n2 WHERE value = 1 GROUP BY key, value;
-
-EXPLAIN select DISTINCT key FROM tbl_n2;
-EXPLAIN select DISTINCT key FROM tbl_n2;
-EXPLAIN select DISTINCT key FROM tbl_n2;
-EXPLAIN select DISTINCT key, value FROM tbl_n2;
-EXPLAIN select DISTINCT key, value FROM tbl_n2 WHERE value = 2;
-EXPLAIN select DISTINCT key, value FROM tbl_n2 WHERE value = 2 AND key = 3;
-EXPLAIN select DISTINCT key, value FROM tbl_n2 WHERE value = key;
-EXPLAIN select DISTINCT key, substr(value,2,3) FROM tbl_n2 WHERE value = key;
-EXPLAIN select DISTINCT key, substr(value,2,3) FROM tbl_n2;
-
-EXPLAIN select * FROM (select DISTINCT key, value FROM tbl_n2) v1 WHERE
v1.value = 2;
-
-DROP TABLE tbl_n2;
-
-CREATE TABLE tblpart_n0 (key int, value string) PARTITIONED BY (ds string, hr
int);
-INSERT OVERWRITE TABLE tblpart_n0 PARTITION (ds='2008-04-08', hr=11) SELECT
key, value FROM srcpart WHERE ds = '2008-04-08' AND hr = 11;
-INSERT OVERWRITE TABLE tblpart_n0 PARTITION (ds='2008-04-08', hr=12) SELECT
key, value FROM srcpart WHERE ds = '2008-04-08' AND hr = 12;
-INSERT OVERWRITE TABLE tblpart_n0 PARTITION (ds='2008-04-09', hr=11) SELECT
key, value FROM srcpart WHERE ds = '2008-04-09' AND hr = 11;
-INSERT OVERWRITE TABLE tblpart_n0 PARTITION (ds='2008-04-09', hr=12) SELECT
key, value FROM srcpart WHERE ds = '2008-04-09' AND hr = 12;
-
-CREATE INDEX tbl_part_index ON TABLE tblpart_n0(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-
-ALTER INDEX tbl_part_index ON tblpart_n0 PARTITION (ds='2008-04-08', hr=11)
REBUILD;
-EXPLAIN SELECT key, count(key) FROM tblpart_n0 WHERE ds='2008-04-09' AND hr=12
AND key < 10 GROUP BY key;
-
-ALTER INDEX tbl_part_index ON tblpart_n0 PARTITION (ds='2008-04-08', hr=12)
REBUILD;
-ALTER INDEX tbl_part_index ON tblpart_n0 PARTITION (ds='2008-04-09', hr=11)
REBUILD;
-ALTER INDEX tbl_part_index ON tblpart_n0 PARTITION (ds='2008-04-09', hr=12)
REBUILD;
-EXPLAIN SELECT key, count(key) FROM tblpart_n0 WHERE ds='2008-04-09' AND hr=12
AND key < 10 GROUP BY key;
-
-DROP INDEX tbl_part_index on tblpart_n0;
-DROP TABLE tblpart_n0;
-
-CREATE TABLE tbl_n2(key int, value int) ROW FORMAT DELIMITED FIELDS TERMINATED
BY '|';
-LOAD DATA LOCAL INPATH '../../data/files/tbl.txt' OVERWRITE INTO TABLE tbl_n2;
-
-CREATE INDEX tbl_key_idx ON TABLE tbl_n2(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-ALTER INDEX tbl_key_idx ON tbl_n2 REBUILD;
-
-set hive.optimize.index.groupby=false;
-explain select key, count(key) from tbl_n2 group by key order by key;
-select key, count(key) from tbl_n2 group by key order by key;
-set hive.optimize.index.groupby=true;
-explain select key, count(key) from tbl_n2 group by key order by key;
-select key, count(key) from tbl_n2 group by key order by key;
-DROP TABLE tbl_n2;
-
-reset hive.cbo.enable;
diff --git a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_1.q
b/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_1.q
deleted file mode 100644
index 0941493..0000000
--- a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_1.q
+++ /dev/null
@@ -1,175 +0,0 @@
---! qt:dataset:srcpart
---! qt:dataset:lineitem
-set hive.stats.dbclass=fs;
-set hive.stats.autogather=true;
-set hive.cbo.enable=true;
-
-DROP TABLE IF EXISTS lineitem_ix;
-CREATE TABLE lineitem_ix (L_ORDERKEY INT,
- L_PARTKEY INT,
- L_SUPPKEY INT,
- L_LINENUMBER INT,
- L_QUANTITY DOUBLE,
- L_EXTENDEDPRICE DOUBLE,
- L_DISCOUNT DOUBLE,
- L_TAX DOUBLE,
- L_RETURNFLAG STRING,
- L_LINESTATUS STRING,
- l_shipdate STRING,
- L_COMMITDATE STRING,
- L_RECEIPTDATE STRING,
- L_SHIPINSTRUCT STRING,
- L_SHIPMODE STRING,
- L_COMMENT STRING)
-ROW FORMAT DELIMITED
-FIELDS TERMINATED BY '|';
-
-LOAD DATA LOCAL INPATH '../../data/files/lineitem.txt' OVERWRITE INTO TABLE
lineitem_ix;
-
-CREATE INDEX lineitem_ix_lshipdate_idx ON TABLE lineitem_ix(l_shipdate) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(l_shipdate)");
-ALTER INDEX lineitem_ix_lshipdate_idx ON lineitem_ix REBUILD;
-
-explain select l_shipdate, count(l_shipdate)
-from lineitem_ix
-group by l_shipdate;
-
-select l_shipdate, count(l_shipdate)
-from lineitem_ix
-group by l_shipdate
-order by l_shipdate;
-
-set hive.optimize.index.groupby=true;
-
-explain select l_shipdate, count(l_shipdate)
-from lineitem_ix
-group by l_shipdate;
-
-select l_shipdate, count(l_shipdate)
-from lineitem_ix
-group by l_shipdate
-order by l_shipdate;
-
-set hive.optimize.index.groupby=false;
-
-
-explain select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-set hive.optimize.index.groupby=true;
-
-explain select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
-from lineitem_ix
-group by year(l_shipdate), month(l_shipdate)
-order by year, month;
-
-explain select lastyear.month,
- thisyear.month,
- (thisyear.monthly_shipments - lastyear.monthly_shipments) /
-lastyear.monthly_shipments as monthly_shipments_delta
- from (select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
- from lineitem_ix
- where year(l_shipdate) = 1997
- group by year(l_shipdate), month(l_shipdate)
- ) lastyear join
- (select year(l_shipdate) as year,
- month(l_shipdate) as month,
- count(l_shipdate) as monthly_shipments
- from lineitem_ix
- where year(l_shipdate) = 1998
- group by year(l_shipdate), month(l_shipdate)
- ) thisyear
- on lastyear.month = thisyear.month;
-
-explain select l_shipdate, cnt
-from (select l_shipdate, count(l_shipdate) as cnt from lineitem_ix group by
l_shipdate
-union all
-select l_shipdate, l_orderkey as cnt
-from lineitem_ix) dummy;
-
-CREATE TABLE tbl(key int, value int);
-CREATE INDEX tbl_key_idx ON TABLE tbl(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-ALTER INDEX tbl_key_idx ON tbl REBUILD;
-
-EXPLAIN select key, count(key) from tbl where key = 1 group by key;
-EXPLAIN select key, count(key) from tbl group by key;
-
-EXPLAIN select count(1) from tbl;
-EXPLAIN select count(key) from tbl;
-
-EXPLAIN select key FROM tbl GROUP BY key;
-EXPLAIN select key FROM tbl GROUP BY value, key;
-EXPLAIN select key FROM tbl WHERE key = 3 GROUP BY key;
-EXPLAIN select key FROM tbl WHERE value = 2 GROUP BY key;
-EXPLAIN select key FROM tbl GROUP BY key, substr(key,2,3);
-
-EXPLAIN select key, value FROM tbl GROUP BY value, key;
-EXPLAIN select key, value FROM tbl WHERE value = 1 GROUP BY key, value;
-
-EXPLAIN select DISTINCT key FROM tbl;
-EXPLAIN select DISTINCT key FROM tbl;
-EXPLAIN select DISTINCT key FROM tbl;
-EXPLAIN select DISTINCT key, value FROM tbl;
-EXPLAIN select DISTINCT key, value FROM tbl WHERE value = 2;
-EXPLAIN select DISTINCT key, value FROM tbl WHERE value = 2 AND key = 3;
-EXPLAIN select DISTINCT key, value FROM tbl WHERE value = key;
-EXPLAIN select DISTINCT key, substr(value,2,3) FROM tbl WHERE value = key;
-EXPLAIN select DISTINCT key, substr(value,2,3) FROM tbl;
-
-EXPLAIN select * FROM (select DISTINCT key, value FROM tbl) v1 WHERE v1.value
= 2;
-
-DROP TABLE tbl;
-
-CREATE TABLE tblpart (key int, value string) PARTITIONED BY (ds string, hr
int);
-INSERT OVERWRITE TABLE tblpart PARTITION (ds='2008-04-08', hr=11) SELECT key,
value FROM srcpart WHERE ds = '2008-04-08' AND hr = 11;
-INSERT OVERWRITE TABLE tblpart PARTITION (ds='2008-04-08', hr=12) SELECT key,
value FROM srcpart WHERE ds = '2008-04-08' AND hr = 12;
-INSERT OVERWRITE TABLE tblpart PARTITION (ds='2008-04-09', hr=11) SELECT key,
value FROM srcpart WHERE ds = '2008-04-09' AND hr = 11;
-INSERT OVERWRITE TABLE tblpart PARTITION (ds='2008-04-09', hr=12) SELECT key,
value FROM srcpart WHERE ds = '2008-04-09' AND hr = 12;
-
-CREATE INDEX tbl_part_index ON TABLE tblpart(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-
-ALTER INDEX tbl_part_index ON tblpart PARTITION (ds='2008-04-08', hr=11)
REBUILD;
-EXPLAIN SELECT key, count(key) FROM tblpart WHERE ds='2008-04-09' AND hr=12
AND key < 10 GROUP BY key;
-
-ALTER INDEX tbl_part_index ON tblpart PARTITION (ds='2008-04-08', hr=12)
REBUILD;
-ALTER INDEX tbl_part_index ON tblpart PARTITION (ds='2008-04-09', hr=11)
REBUILD;
-ALTER INDEX tbl_part_index ON tblpart PARTITION (ds='2008-04-09', hr=12)
REBUILD;
-EXPLAIN SELECT key, count(key) FROM tblpart WHERE ds='2008-04-09' AND hr=12
AND key < 10 GROUP BY key;
-
-DROP INDEX tbl_part_index on tblpart;
-DROP TABLE tblpart;
-
-CREATE TABLE tbl(key int, value int) ROW FORMAT DELIMITED FIELDS TERMINATED BY
'|';
-LOAD DATA LOCAL INPATH '../../data/files/tbl.txt' OVERWRITE INTO TABLE tbl;
-
-CREATE INDEX tbl_key_idx ON TABLE tbl(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-ALTER INDEX tbl_key_idx ON tbl REBUILD;
-
-set hive.optimize.index.groupby=false;
-explain select key, count(key) from tbl group by key order by key;
-select key, count(key) from tbl group by key order by key;
-set hive.optimize.index.groupby=true;
-explain select key, count(key) from tbl group by key order by key;
-select key, count(key) from tbl group by key order by key;
-DROP TABLE tbl;
\ No newline at end of file
diff --git a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_2.q
b/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_2.q
deleted file mode 100644
index cd42548..0000000
--- a/ql/src/test/queries/clientpositive/ql_rewrite_gbtoidx_cbo_2.q
+++ /dev/null
@@ -1,394 +0,0 @@
---! qt:dataset:src
---! qt:dataset:lineitem
-set hive.stats.dbclass=fs;
-set hive.stats.autogather=true;
-set hive.cbo.enable=true;
-set hive.optimize.index.groupby=true;
-
-DROP TABLE IF EXISTS lineitem_ix_n0;
-DROP INDEX IF EXISTS lineitem_ix_L_ORDERKEY_idx on lineitem_ix_n0;
-DROP INDEX IF EXISTS lineitem_ix_L_PARTKEY_idx on lineitem_ix_n0;
-
-
-CREATE TABLE lineitem_ix_n0 (L_ORDERKEY INT,
- L_PARTKEY INT,
- L_SUPPKEY INT,
- L_LINENUMBER INT,
- L_QUANTITY DOUBLE,
- L_EXTENDEDPRICE DOUBLE,
- L_DISCOUNT DOUBLE,
- L_TAX DOUBLE,
- L_RETURNFLAG STRING,
- L_LINESTATUS STRING,
- l_shipdate STRING,
- L_COMMITDATE STRING,
- L_RECEIPTDATE STRING,
- L_SHIPINSTRUCT STRING,
- L_SHIPMODE STRING,
- L_COMMENT STRING)
-ROW FORMAT DELIMITED
-FIELDS TERMINATED BY '|';
-
-LOAD DATA LOCAL INPATH '../../data/files/lineitem.txt' OVERWRITE INTO TABLE
lineitem_ix_n0;
-
-CREATE INDEX lineitem_ix_L_ORDERKEY_idx ON TABLE lineitem_ix_n0(L_ORDERKEY) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(L_ORDERKEY)");
-ALTER INDEX lineitem_ix_L_ORDERKEY_idx ON lineitem_ix_n0 REBUILD;
-
-CREATE INDEX lineitem_ix_L_PARTKEY_idx ON TABLE lineitem_ix_n0(L_PARTKEY) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(L_PARTKEY)");
-ALTER INDEX lineitem_ix_L_PARTKEY_idx ON lineitem_ix_n0 REBUILD;
-
-explain
-select count(1)
-from lineitem_ix_n0;
-
-select count(1)
-from lineitem_ix_n0;
-
-explain
-select count(L_ORDERKEY)
-from lineitem_ix_n0;
-
-select count(L_ORDERKEY)
-from lineitem_ix_n0;
-
-explain select L_ORDERKEY+L_PARTKEY as keysum,
-count(L_ORDERKEY), count(L_PARTKEY)
-from lineitem_ix_n0
-group by L_ORDERKEY, L_PARTKEY;
-
-select L_ORDERKEY+L_PARTKEY as keysum,
-count(L_ORDERKEY), count(L_PARTKEY)
-from lineitem_ix_n0
-group by L_ORDERKEY, L_PARTKEY;
-
-explain
-select L_ORDERKEY, count(L_ORDERKEY)
-from lineitem_ix_n0
-where L_ORDERKEY = 7
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(L_ORDERKEY)
-from lineitem_ix_n0
-where L_ORDERKEY = 7
-group by L_ORDERKEY;
-
-explain
-select L_ORDERKEY, count(1)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(1)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-explain
-select count(L_ORDERKEY+1)
-from lineitem_ix_n0;
-
-select count(L_ORDERKEY+1)
-from lineitem_ix_n0;
-
-explain
-select L_ORDERKEY, count(L_ORDERKEY+1)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(L_ORDERKEY+1)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-explain
-select L_ORDERKEY, count(L_ORDERKEY+1+L_ORDERKEY+2)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(L_ORDERKEY+1+L_ORDERKEY+2)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-explain
-select L_ORDERKEY, count(1+L_ORDERKEY+2)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(1+L_ORDERKEY+2)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-
-explain
-select L_ORDERKEY as a, count(1) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY;
-
-select L_ORDERKEY as a, count(1) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY;
-
-explain
-select L_ORDERKEY, count(keysum), sum(keysum)
-from
-(select L_ORDERKEY, L_ORDERKEY+L_PARTKEY as keysum from lineitem_ix_n0) tabA
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(keysum), sum(keysum)
-from
-(select L_ORDERKEY, L_ORDERKEY+L_PARTKEY as keysum from lineitem_ix_n0) tabA
-group by L_ORDERKEY;
-
-
-explain
-select L_ORDERKEY, count(L_ORDERKEY), sum(L_ORDERKEY)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-select L_ORDERKEY, count(L_ORDERKEY), sum(L_ORDERKEY)
-from lineitem_ix_n0
-group by L_ORDERKEY;
-
-explain
-select colA, count(colA)
-from (select L_ORDERKEY as colA from lineitem_ix_n0) tabA
-group by colA;
-
-select colA, count(colA)
-from (select L_ORDERKEY as colA from lineitem_ix_n0) tabA
-group by colA;
-
-explain
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+L_PARTKEY as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+L_PARTKEY as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-explain
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-
-explain
-select keysum, count(1)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-select keysum, count(1)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0) tabA
-group by keysum;
-
-
-explain
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0 where L_ORDERKEY = 7) tabA
-group by keysum;
-
-select keysum, count(keysum)
-from
-(select L_ORDERKEY+1 as keysum from lineitem_ix_n0 where L_ORDERKEY = 7) tabA
-group by keysum;
-
-
-explain
-select ckeysum, count(ckeysum)
-from
-(select keysum, count(keysum) as ckeysum
-from
- (select L_ORDERKEY+1 as keysum from lineitem_ix_n0 where L_ORDERKEY =
7) tabA
-group by keysum) tabB
-group by ckeysum;
-
-select ckeysum, count(ckeysum)
-from
-(select keysum, count(keysum) as ckeysum
-from
- (select L_ORDERKEY+1 as keysum from lineitem_ix_n0 where L_ORDERKEY =
7) tabA
-group by keysum) tabB
-group by ckeysum;
-
-explain
-select keysum, count(keysum) as ckeysum
-from
-(select L_ORDERKEY, count(L_ORDERKEY) as keysum
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY)tabA
-group by keysum;
-
-select keysum, count(keysum) as ckeysum
-from
-(select L_ORDERKEY, count(L_ORDERKEY) as keysum
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY)tabA
-group by keysum;
-
-
-DROP INDEX IF EXISTS src_key_idx on src;
-CREATE INDEX src_key_idx ON TABLE src(key) AS
'org.apache.hadoop.hive.ql.index.AggregateIndexHandler' WITH DEFERRED REBUILD
IDXPROPERTIES("AGGREGATES"="count(key)");
-ALTER INDEX src_key_idx ON src REBUILD;
-
-explain
-select tabA.a, tabA.b, tabB.a, tabB.b
-from
-(select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY) tabA
-join
-(select key as a, count(key) as b
-from src
-group by key
-) tabB
-on (tabA.b=tabB.b);
-
-select tabA.a, tabA.b, tabB.a, tabB.b
-from
-(select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY) tabA
-join
-(select key as a, count(key) as b
-from src
-group by key
-) tabB
-on (tabA.b=tabB.b);
-
-
-explain
-select tabA.a, tabA.b, tabB.a, tabB.b
-from
-(select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY) tabA
-join
-(select key as a, count(key) as b
-from src
-group by key
-) tabB
-on (tabA.b=tabB.b and tabB.a < '2');
-
-select tabA.a, tabA.b, tabB.a, tabB.b
-from
-(select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY) tabA
-join
-(select key as a, count(key) as b
-from src
-group by key
-) tabB
-on (tabA.b=tabB.b and tabB.a < '2');
-
-EXPLAIN
-select L_ORDERKEY FROM lineitem_ix_n0 GROUP BY L_ORDERKEY, L_ORDERKEY+1;
-
-select L_ORDERKEY FROM lineitem_ix_n0 GROUP BY L_ORDERKEY, L_ORDERKEY+1;
-
-EXPLAIN
-select L_ORDERKEY, L_ORDERKEY+1, count(L_ORDERKEY) FROM lineitem_ix_n0 GROUP
BY L_ORDERKEY, L_ORDERKEY+1;
-
-select L_ORDERKEY, L_ORDERKEY+1, count(L_ORDERKEY) FROM lineitem_ix_n0 GROUP
BY L_ORDERKEY, L_ORDERKEY+1;
-
-EXPLAIN
-select L_ORDERKEY+2, count(L_ORDERKEY) FROM lineitem_ix_n0 GROUP BY
L_ORDERKEY+2;
-
-select L_ORDERKEY+2, count(L_ORDERKEY) FROM lineitem_ix_n0 GROUP BY
L_ORDERKEY+2;
-
---with cbo on, the following query can use idx
-
-explain
-select b, count(b) as ckeysum
-from
-(
-select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY
-union all
-select L_PARTKEY as a, count(L_PARTKEY) as b
-from lineitem_ix_n0
-where L_PARTKEY < 10
-group by L_PARTKEY
-) tabA
-group by b;
-
-select b, count(b) as ckeysum
-from
-(
-select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY
-union all
-select L_PARTKEY as a, count(L_PARTKEY) as b
-from lineitem_ix_n0
-where L_PARTKEY < 10
-group by L_PARTKEY
-) tabA
-group by b;
-
---with cbo on, the following query can not use idx because AggFunc is empty
here
-
-explain
-select a, count(a) as ckeysum
-from
-(
-select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY
-union all
-select L_PARTKEY as a, count(L_PARTKEY) as b
-from lineitem_ix_n0
-where L_PARTKEY < 10
-group by L_PARTKEY
-) tabA
-group by a;
-
-select a, count(a) as ckeysum
-from
-(
-select L_ORDERKEY as a, count(L_ORDERKEY) as b
-from lineitem_ix_n0
-where L_ORDERKEY < 7
-group by L_ORDERKEY
-union all
-select L_PARTKEY as a, count(L_PARTKEY) as b
-from lineitem_ix_n0
-where L_PARTKEY < 10
-group by L_PARTKEY
-) tabA
-group by a;
-
-explain
-select a, count(a)
-from (
-select case L_ORDERKEY when null then 1 else 1 END as a
-from lineitem_ix_n0)tab
-group by a;
-
-select a, count(a)
-from (
-select case L_ORDERKEY when null then 1 else 1 END as a
-from lineitem_ix_n0)tab
-group by a;
-