You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kg...@apache.org on 2018/03/07 08:19:24 UTC
[07/22] hive git commit: HIVE-18715: Remove index support from
metastore (Zoltan Haindrich reviewed by Ashutosh Chauhan)
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
index 8438728..29ad1bc 100644
--- a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -982,40 +982,6 @@ class PartitionSpec
::Thrift::Struct.generate_accessors self
end
-class Index
- include ::Thrift::Struct, ::Thrift::Struct_Union
- INDEXNAME = 1
- INDEXHANDLERCLASS = 2
- DBNAME = 3
- ORIGTABLENAME = 4
- CREATETIME = 5
- LASTACCESSTIME = 6
- INDEXTABLENAME = 7
- SD = 8
- PARAMETERS = 9
- DEFERREDREBUILD = 10
-
- FIELDS = {
- INDEXNAME => {:type => ::Thrift::Types::STRING, :name => 'indexName'},
- INDEXHANDLERCLASS => {:type => ::Thrift::Types::STRING, :name => 'indexHandlerClass'},
- DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
- ORIGTABLENAME => {:type => ::Thrift::Types::STRING, :name => 'origTableName'},
- CREATETIME => {:type => ::Thrift::Types::I32, :name => 'createTime'},
- LASTACCESSTIME => {:type => ::Thrift::Types::I32, :name => 'lastAccessTime'},
- INDEXTABLENAME => {:type => ::Thrift::Types::STRING, :name => 'indexTableName'},
- SD => {:type => ::Thrift::Types::STRUCT, :name => 'sd', :class => ::StorageDescriptor},
- PARAMETERS => {:type => ::Thrift::Types::MAP, :name => 'parameters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
- DEFERREDREBUILD => {:type => ::Thrift::Types::BOOL, :name => 'deferredRebuild'}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
-end
-
class BooleanColumnStatsData
include ::Thrift::Struct, ::Thrift::Struct_Union
NUMTRUES = 1
@@ -4482,27 +4448,6 @@ class NoSuchObjectException < ::Thrift::Exception
::Thrift::Struct.generate_accessors self
end
-class IndexAlreadyExistsException < ::Thrift::Exception
- include ::Thrift::Struct, ::Thrift::Struct_Union
- def initialize(message=nil)
- super()
- self.message = message
- end
-
- MESSAGE = 1
-
- FIELDS = {
- MESSAGE => {:type => ::Thrift::Types::STRING, :name => 'message'}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
-end
-
class InvalidOperationException < ::Thrift::Exception
include ::Thrift::Struct, ::Thrift::Struct_Union
def initialize(message=nil)
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
index b0e84d9..4990fed 100644
--- a/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
+++ b/standalone-metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
@@ -1469,107 +1469,6 @@ module ThriftHiveMetastore
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'isPartitionMarkedForEvent failed: unknown result')
end
- def add_index(new_index, index_table)
- send_add_index(new_index, index_table)
- return recv_add_index()
- end
-
- def send_add_index(new_index, index_table)
- send_message('add_index', Add_index_args, :new_index => new_index, :index_table => index_table)
- end
-
- def recv_add_index()
- result = receive_message(Add_index_result)
- return result.success unless result.success.nil?
- raise result.o1 unless result.o1.nil?
- raise result.o2 unless result.o2.nil?
- raise result.o3 unless result.o3.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'add_index failed: unknown result')
- end
-
- def alter_index(dbname, base_tbl_name, idx_name, new_idx)
- send_alter_index(dbname, base_tbl_name, idx_name, new_idx)
- recv_alter_index()
- end
-
- def send_alter_index(dbname, base_tbl_name, idx_name, new_idx)
- send_message('alter_index', Alter_index_args, :dbname => dbname, :base_tbl_name => base_tbl_name, :idx_name => idx_name, :new_idx => new_idx)
- end
-
- def recv_alter_index()
- result = receive_message(Alter_index_result)
- raise result.o1 unless result.o1.nil?
- raise result.o2 unless result.o2.nil?
- return
- end
-
- def drop_index_by_name(db_name, tbl_name, index_name, deleteData)
- send_drop_index_by_name(db_name, tbl_name, index_name, deleteData)
- return recv_drop_index_by_name()
- end
-
- def send_drop_index_by_name(db_name, tbl_name, index_name, deleteData)
- send_message('drop_index_by_name', Drop_index_by_name_args, :db_name => db_name, :tbl_name => tbl_name, :index_name => index_name, :deleteData => deleteData)
- end
-
- def recv_drop_index_by_name()
- result = receive_message(Drop_index_by_name_result)
- return result.success unless result.success.nil?
- raise result.o1 unless result.o1.nil?
- raise result.o2 unless result.o2.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'drop_index_by_name failed: unknown result')
- end
-
- def get_index_by_name(db_name, tbl_name, index_name)
- send_get_index_by_name(db_name, tbl_name, index_name)
- return recv_get_index_by_name()
- end
-
- def send_get_index_by_name(db_name, tbl_name, index_name)
- send_message('get_index_by_name', Get_index_by_name_args, :db_name => db_name, :tbl_name => tbl_name, :index_name => index_name)
- end
-
- def recv_get_index_by_name()
- result = receive_message(Get_index_by_name_result)
- return result.success unless result.success.nil?
- raise result.o1 unless result.o1.nil?
- raise result.o2 unless result.o2.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_index_by_name failed: unknown result')
- end
-
- def get_indexes(db_name, tbl_name, max_indexes)
- send_get_indexes(db_name, tbl_name, max_indexes)
- return recv_get_indexes()
- end
-
- def send_get_indexes(db_name, tbl_name, max_indexes)
- send_message('get_indexes', Get_indexes_args, :db_name => db_name, :tbl_name => tbl_name, :max_indexes => max_indexes)
- end
-
- def recv_get_indexes()
- result = receive_message(Get_indexes_result)
- return result.success unless result.success.nil?
- raise result.o1 unless result.o1.nil?
- raise result.o2 unless result.o2.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_indexes failed: unknown result')
- end
-
- def get_index_names(db_name, tbl_name, max_indexes)
- send_get_index_names(db_name, tbl_name, max_indexes)
- return recv_get_index_names()
- end
-
- def send_get_index_names(db_name, tbl_name, max_indexes)
- send_message('get_index_names', Get_index_names_args, :db_name => db_name, :tbl_name => tbl_name, :max_indexes => max_indexes)
- end
-
- def recv_get_index_names()
- result = receive_message(Get_index_names_result)
- return result.success unless result.success.nil?
- raise result.o2 unless result.o2.nil?
- raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_index_names failed: unknown result')
- end
-
def get_primary_keys(request)
send_get_primary_keys(request)
return recv_get_primary_keys()
@@ -4279,84 +4178,6 @@ module ThriftHiveMetastore
write_result(result, oprot, 'isPartitionMarkedForEvent', seqid)
end
- def process_add_index(seqid, iprot, oprot)
- args = read_args(iprot, Add_index_args)
- result = Add_index_result.new()
- begin
- result.success = @handler.add_index(args.new_index, args.index_table)
- rescue ::InvalidObjectException => o1
- result.o1 = o1
- rescue ::AlreadyExistsException => o2
- result.o2 = o2
- rescue ::MetaException => o3
- result.o3 = o3
- end
- write_result(result, oprot, 'add_index', seqid)
- end
-
- def process_alter_index(seqid, iprot, oprot)
- args = read_args(iprot, Alter_index_args)
- result = Alter_index_result.new()
- begin
- @handler.alter_index(args.dbname, args.base_tbl_name, args.idx_name, args.new_idx)
- rescue ::InvalidOperationException => o1
- result.o1 = o1
- rescue ::MetaException => o2
- result.o2 = o2
- end
- write_result(result, oprot, 'alter_index', seqid)
- end
-
- def process_drop_index_by_name(seqid, iprot, oprot)
- args = read_args(iprot, Drop_index_by_name_args)
- result = Drop_index_by_name_result.new()
- begin
- result.success = @handler.drop_index_by_name(args.db_name, args.tbl_name, args.index_name, args.deleteData)
- rescue ::NoSuchObjectException => o1
- result.o1 = o1
- rescue ::MetaException => o2
- result.o2 = o2
- end
- write_result(result, oprot, 'drop_index_by_name', seqid)
- end
-
- def process_get_index_by_name(seqid, iprot, oprot)
- args = read_args(iprot, Get_index_by_name_args)
- result = Get_index_by_name_result.new()
- begin
- result.success = @handler.get_index_by_name(args.db_name, args.tbl_name, args.index_name)
- rescue ::MetaException => o1
- result.o1 = o1
- rescue ::NoSuchObjectException => o2
- result.o2 = o2
- end
- write_result(result, oprot, 'get_index_by_name', seqid)
- end
-
- def process_get_indexes(seqid, iprot, oprot)
- args = read_args(iprot, Get_indexes_args)
- result = Get_indexes_result.new()
- begin
- result.success = @handler.get_indexes(args.db_name, args.tbl_name, args.max_indexes)
- rescue ::NoSuchObjectException => o1
- result.o1 = o1
- rescue ::MetaException => o2
- result.o2 = o2
- end
- write_result(result, oprot, 'get_indexes', seqid)
- end
-
- def process_get_index_names(seqid, iprot, oprot)
- args = read_args(iprot, Get_index_names_args)
- result = Get_index_names_result.new()
- begin
- result.success = @handler.get_index_names(args.db_name, args.tbl_name, args.max_indexes)
- rescue ::MetaException => o2
- result.o2 = o2
- end
- write_result(result, oprot, 'get_index_names', seqid)
- end
-
def process_get_primary_keys(seqid, iprot, oprot)
args = read_args(iprot, Get_primary_keys_args)
result = Get_primary_keys_result.new()
@@ -8820,246 +8641,6 @@ module ThriftHiveMetastore
::Thrift::Struct.generate_accessors self
end
- class Add_index_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- NEW_INDEX = 1
- INDEX_TABLE = 2
-
- FIELDS = {
- NEW_INDEX => {:type => ::Thrift::Types::STRUCT, :name => 'new_index', :class => ::Index},
- INDEX_TABLE => {:type => ::Thrift::Types::STRUCT, :name => 'index_table', :class => ::Table}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Add_index_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- SUCCESS = 0
- O1 = 1
- O2 = 2
- O3 = 3
-
- FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Index},
- O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::InvalidObjectException},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::AlreadyExistsException},
- O3 => {:type => ::Thrift::Types::STRUCT, :name => 'o3', :class => ::MetaException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Alter_index_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- DBNAME = 1
- BASE_TBL_NAME = 2
- IDX_NAME = 3
- NEW_IDX = 4
-
- FIELDS = {
- DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbname'},
- BASE_TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'base_tbl_name'},
- IDX_NAME => {:type => ::Thrift::Types::STRING, :name => 'idx_name'},
- NEW_IDX => {:type => ::Thrift::Types::STRUCT, :name => 'new_idx', :class => ::Index}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Alter_index_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- O1 = 1
- O2 = 2
-
- FIELDS = {
- O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::InvalidOperationException},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Drop_index_by_name_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- DB_NAME = 1
- TBL_NAME = 2
- INDEX_NAME = 3
- DELETEDATA = 4
-
- FIELDS = {
- DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
- TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
- INDEX_NAME => {:type => ::Thrift::Types::STRING, :name => 'index_name'},
- DELETEDATA => {:type => ::Thrift::Types::BOOL, :name => 'deleteData'}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Drop_index_by_name_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- SUCCESS = 0
- O1 = 1
- O2 = 2
-
- FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
- O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_index_by_name_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- DB_NAME = 1
- TBL_NAME = 2
- INDEX_NAME = 3
-
- FIELDS = {
- DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
- TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
- INDEX_NAME => {:type => ::Thrift::Types::STRING, :name => 'index_name'}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_index_by_name_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- SUCCESS = 0
- O1 = 1
- O2 = 2
-
- FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Index},
- O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::MetaException},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::NoSuchObjectException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_indexes_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- DB_NAME = 1
- TBL_NAME = 2
- MAX_INDEXES = 3
-
- FIELDS = {
- DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
- TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
- MAX_INDEXES => {:type => ::Thrift::Types::I16, :name => 'max_indexes', :default => -1}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_indexes_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- SUCCESS = 0
- O1 = 1
- O2 = 2
-
- FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Index}},
- O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => ::NoSuchObjectException},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_index_names_args
- include ::Thrift::Struct, ::Thrift::Struct_Union
- DB_NAME = 1
- TBL_NAME = 2
- MAX_INDEXES = 3
-
- FIELDS = {
- DB_NAME => {:type => ::Thrift::Types::STRING, :name => 'db_name'},
- TBL_NAME => {:type => ::Thrift::Types::STRING, :name => 'tbl_name'},
- MAX_INDEXES => {:type => ::Thrift::Types::I16, :name => 'max_indexes', :default => -1}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
- class Get_index_names_result
- include ::Thrift::Struct, ::Thrift::Struct_Union
- SUCCESS = 0
- O2 = 1
-
- FIELDS = {
- SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
- O2 => {:type => ::Thrift::Types::STRUCT, :name => 'o2', :class => ::MetaException}
- }
-
- def struct_fields; FIELDS; end
-
- def validate
- end
-
- ::Thrift::Struct.generate_accessors self
- end
-
class Get_primary_keys_args
include ::Thrift::Struct, ::Thrift::Struct_Union
REQUEST = 1
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/DefaultMetaStoreFilterHookImpl.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/DefaultMetaStoreFilterHookImpl.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/DefaultMetaStoreFilterHookImpl.java
index 020bea8..ca63333 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/DefaultMetaStoreFilterHookImpl.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/DefaultMetaStoreFilterHookImpl.java
@@ -22,7 +22,6 @@ import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.api.Database;
-import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
import org.apache.hadoop.hive.metastore.api.Partition;
@@ -84,19 +83,4 @@ public class DefaultMetaStoreFilterHookImpl implements MetaStoreFilterHook {
return partitionNames;
}
- @Override
- public Index filterIndex(Index index) throws NoSuchObjectException {
- return index;
- }
-
- @Override
- public List<String> filterIndexNames(String dbName, String tblName,
- List<String> indexList) throws MetaException {
- return indexList;
- }
-
- @Override
- public List<Index> filterIndexes(List<Index> indexeList) throws MetaException {
- return indexeList;
- }
}
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 2be018b..662de9a 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -74,13 +74,11 @@ import org.apache.hadoop.hive.metastore.events.AddForeignKeyEvent;
import org.apache.hadoop.hive.metastore.cache.CachedStore;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf.ConfVars;
-import org.apache.hadoop.hive.metastore.events.AddIndexEvent;
import org.apache.hadoop.hive.metastore.events.AddNotNullConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AddPrimaryKeyEvent;
import org.apache.hadoop.hive.metastore.events.AddUniqueConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AlterDatabaseEvent;
-import org.apache.hadoop.hive.metastore.events.AlterIndexEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
import org.apache.hadoop.hive.metastore.events.ConfigChangeEvent;
@@ -90,22 +88,18 @@ import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropConstraintEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.DropFunctionEvent;
-import org.apache.hadoop.hive.metastore.events.DropIndexEvent;
import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.hive.metastore.events.InsertEvent;
import org.apache.hadoop.hive.metastore.events.LoadPartitionDoneEvent;
-import org.apache.hadoop.hive.metastore.events.PreAddIndexEvent;
import org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.PreAlterDatabaseEvent;
-import org.apache.hadoop.hive.metastore.events.PreAlterIndexEvent;
import org.apache.hadoop.hive.metastore.events.PreAlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.PreAlterTableEvent;
import org.apache.hadoop.hive.metastore.events.PreAuthorizationCallEvent;
import org.apache.hadoop.hive.metastore.events.PreCreateDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.PreCreateTableEvent;
import org.apache.hadoop.hive.metastore.events.PreDropDatabaseEvent;
-import org.apache.hadoop.hive.metastore.events.PreDropIndexEvent;
import org.apache.hadoop.hive.metastore.events.PreDropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.PreDropTableEvent;
import org.apache.hadoop.hive.metastore.events.PreEventContext;
@@ -284,7 +278,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
static final Logger auditLog = LoggerFactory.getLogger(
HiveMetaStore.class.getName() + ".audit");
-
+
private static void logAuditEvent(String cmd) {
if (cmd == null) {
return;
@@ -834,7 +828,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
timerContexts.get().put(function, timer.time());
}
Counter counter = Metrics.getOrCreateCounter(MetricsConstants.ACTIVE_CALLS + function);
- if (counter != null) counter.inc();
+ if (counter != null) {
+ counter.inc();
+ }
return function;
}
@@ -875,7 +871,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
timerContext.close();
}
Counter counter = Metrics.getOrCreateCounter(MetricsConstants.ACTIVE_CALLS + function);
- if (counter != null) counter.dec();
+ if (counter != null) {
+ counter.dec();
+ }
for (MetaStoreEndFunctionListener listener : endFunctionListeners) {
listener.onEndFunction(function, context);
@@ -2010,25 +2008,6 @@ public class HiveMetaStore extends ThriftHiveMetastore {
firePreEvent(new PreDropTableEvent(tbl, deleteData, this));
- boolean isIndexTable = isIndexTable(tbl);
- if (indexName == null && isIndexTable) {
- throw new RuntimeException(
- "The table " + name + " is an index table. Please do drop index instead.");
- }
-
- if (!isIndexTable) {
- try {
- List<Index> indexes = ms.getIndexes(dbname, name, Short.MAX_VALUE);
- while (indexes != null && indexes.size() > 0) {
- for (Index idx : indexes) {
- this.drop_index_by_name(dbname, name, idx.getIndexName(), true);
- }
- indexes = ms.getIndexes(dbname, name, Short.MAX_VALUE);
- }
- } catch (TException e) {
- throw new MetaException(e.getMessage());
- }
- }
isExternal = isExternal(tbl);
if (tbl.getSd().getLocation() != null) {
tblPath = new Path(tbl.getSd().getLocation());
@@ -2404,10 +2383,6 @@ public class HiveMetaStore extends ThriftHiveMetastore {
return MetaStoreUtils.isExternalTable(table);
}
- private boolean isIndexTable(Table table) {
- return MetaStoreUtils.isIndexTable(table);
- }
-
@Override
@Deprecated
public Table get_table(final String dbname, final String name) throws MetaException,
@@ -2599,7 +2574,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
private boolean doesClientHaveCapability(ClientCapabilities client, ClientCapability value) {
- if (!MetastoreConf.getBoolVar(getConf(), ConfVars.CAPABILITY_CHECK)) return true;
+ if (!MetastoreConf.getBoolVar(getConf(), ConfVars.CAPABILITY_CHECK)) {
+ return true;
+ }
return (client != null && client.isSetValues() && client.getValues().contains(value));
}
@@ -2794,11 +2771,19 @@ public class HiveMetaStore extends ThriftHiveMetastore {
@Override
public boolean equals(Object obj) {
- if (this == obj) return true;
- if (obj == null || !(obj instanceof PartValEqWrapper)) return false;
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || !(obj instanceof PartValEqWrapper)) {
+ return false;
+ }
Partition p1 = this.partition, p2 = ((PartValEqWrapper)obj).partition;
- if (!p1.isSetValues() || !p2.isSetValues()) return p1.isSetValues() == p2.isSetValues();
- if (p1.getValues().size() != p2.getValues().size()) return false;
+ if (!p1.isSetValues() || !p2.isSetValues()) {
+ return p1.isSetValues() == p2.isSetValues();
+ }
+ if (p1.getValues().size() != p2.getValues().size()) {
+ return false;
+ }
for (int i = 0; i < p1.getValues().size(); ++i) {
String v1 = p1.getValues().get(i);
String v2 = p2.getValues().get(i);
@@ -2839,11 +2824,13 @@ public class HiveMetaStore extends ThriftHiveMetastore {
List<String> lhsValues = this.values;
List<String> rhsValues = ((PartValEqWrapperLite)obj).values;
- if (lhsValues == null || rhsValues == null)
+ if (lhsValues == null || rhsValues == null) {
return lhsValues == rhsValues;
+ }
- if (lhsValues.size() != rhsValues.size())
+ if (lhsValues.size() != rhsValues.size()) {
return false;
+ }
for (int i=0; i<lhsValues.size(); ++i) {
String lhsValue = lhsValues.get(i);
@@ -4032,11 +4019,13 @@ public class HiveMetaStore extends ThriftHiveMetastore {
@Override
public boolean equals(Object rhs) {
- if (rhs == this)
+ if (rhs == this) {
return true;
+ }
- if (!(rhs instanceof StorageDescriptorKey))
+ if (!(rhs instanceof StorageDescriptorKey)) {
return false;
+ }
return (hashCodeKey().equals(((StorageDescriptorKey) rhs).hashCodeKey()));
}
@@ -4325,61 +4314,6 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
@Override
- public void alter_index(final String dbname, final String base_table_name,
- final String index_name, final Index newIndex)
- throws InvalidOperationException, MetaException {
- startFunction("alter_index", ": db=" + dbname + " base_tbl=" + base_table_name
- + " idx=" + index_name + " newidx=" + newIndex.getIndexName());
- newIndex.putToParameters(hive_metastoreConstants.DDL_TIME, Long.toString(System
- .currentTimeMillis() / 1000));
- boolean success = false;
- Exception ex = null;
- Index oldIndex = null;
- RawStore ms = getMS();
- Map<String, String> transactionalListenerResponses = Collections.emptyMap();
- try {
- ms.openTransaction();
- oldIndex = get_index_by_name(dbname, base_table_name, index_name);
- firePreEvent(new PreAlterIndexEvent(oldIndex, newIndex, this));
- ms.alterIndex(dbname, base_table_name, index_name, newIndex);
- if (!transactionalListeners.isEmpty()) {
- transactionalListenerResponses =
- MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
- EventType.ALTER_INDEX,
- new AlterIndexEvent(oldIndex, newIndex, true, this));
- }
-
- success = ms.commitTransaction();
- } catch (InvalidObjectException e) {
- ex = e;
- throw new InvalidOperationException(e.getMessage());
- } catch (Exception e) {
- ex = e;
- if (e instanceof MetaException) {
- throw (MetaException) e;
- } else if (e instanceof InvalidOperationException) {
- throw (InvalidOperationException) e;
- } else {
- throw newMetaException(e);
- }
- } finally {
- if (!success) {
- ms.rollbackTransaction();
- }
-
- endFunction("alter_index", success, ex, base_table_name);
-
- if (!listeners.isEmpty()) {
- MetaStoreListenerNotifier.notifyEvent(listeners,
- EventType.ALTER_INDEX,
- new AlterIndexEvent(oldIndex, newIndex, success, this),
- null,
- transactionalListenerResponses, ms);
- }
- }
- }
-
- @Override
public String getVersion() throws TException {
endFunction(startFunction("getVersion"), true, null);
return "3.0";
@@ -4756,7 +4690,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
String toReturn = defaultValue;
try {
toReturn = MetastoreConf.get(conf, name);
- if (toReturn == null) toReturn = defaultValue;
+ if (toReturn == null) {
+ toReturn = defaultValue;
+ }
} catch (RuntimeException e) {
LOG.error(threadLocalId.get().toString() + ": "
+ "RuntimeException thrown in get_config_value - msg: "
@@ -5008,272 +4944,6 @@ public class HiveMetaStore extends ThriftHiveMetastore {
return Warehouse.makeSpecFromName(part_name);
}
- @Override
- public Index add_index(final Index newIndex, final Table indexTable) throws TException {
- String tableName = indexTable != null ? indexTable.getTableName() : "";
- startFunction("add_index", ": " + newIndex.toString() + " " + tableName);
- Index ret = null;
- Exception ex = null;
- try {
- ret = add_index_core(getMS(), newIndex, indexTable);
- } catch (Exception e) {
- ex = e;
- if (e instanceof InvalidObjectException) {
- throw (InvalidObjectException) e;
- } else if (e instanceof AlreadyExistsException) {
- throw (AlreadyExistsException) e;
- } else if (e instanceof MetaException) {
- throw (MetaException) e;
- } else {
- throw newMetaException(e);
- }
- } finally {
- endFunction("add_index", ret != null, ex, tableName);
- }
- return ret;
- }
-
- private Index add_index_core(final RawStore ms, final Index index, final Table indexTable)
- throws InvalidObjectException, AlreadyExistsException, MetaException {
- boolean success = false, indexTableCreated = false;
- String[] qualified =
- MetaStoreUtils.getQualifiedName(index.getDbName(), index.getIndexTableName());
- Map<String, String> transactionalListenerResponses = Collections.emptyMap();
- try {
- ms.openTransaction();
- firePreEvent(new PreAddIndexEvent(index, this));
- Index old_index = null;
- try {
- old_index = get_index_by_name(index.getDbName(), index
- .getOrigTableName(), index.getIndexName());
- } catch (Exception e) {
- }
- if (old_index != null) {
- throw new AlreadyExistsException("Index already exists:" + index);
- }
- Table origTbl = ms.getTable(index.getDbName(), index.getOrigTableName());
- if (origTbl == null) {
- throw new InvalidObjectException(
- "Unable to add index because database or the original table do not exist");
- }
-
- // set create time
- long time = System.currentTimeMillis() / 1000;
- Table indexTbl = indexTable;
- if (indexTbl != null) {
- if (!TableType.INDEX_TABLE.name().equals(indexTbl.getTableType())){
- throw new InvalidObjectException(
- "The table " + indexTbl.getTableName()+ " provided as index table must have "
- + TableType.INDEX_TABLE + " table type");
- }
- try {
- indexTbl = ms.getTable(qualified[0], qualified[1]);
- } catch (Exception e) {
- }
- if (indexTbl != null) {
- throw new InvalidObjectException(
- "Unable to add index because index table already exists");
- }
- this.create_table(indexTable);
- indexTableCreated = true;
- }
-
- index.setCreateTime((int) time);
- index.putToParameters(hive_metastoreConstants.DDL_TIME, Long.toString(time));
- if (ms.addIndex(index)) {
- if (!transactionalListeners.isEmpty()) {
- transactionalListenerResponses =
- MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
- EventType.CREATE_INDEX,
- new AddIndexEvent(index, true, this));
- }
- }
-
- success = ms.commitTransaction();
- return index;
- } finally {
- if (!success) {
- if (indexTableCreated) {
- try {
- drop_table(qualified[0], qualified[1], false);
- } catch (Exception e) {
- }
- }
- ms.rollbackTransaction();
- }
-
- if (!listeners.isEmpty()) {
- MetaStoreListenerNotifier.notifyEvent(listeners,
- EventType.CREATE_INDEX,
- new AddIndexEvent(index, success, this),
- null,
- transactionalListenerResponses, ms);
- }
- }
- }
-
- @Override
- public boolean drop_index_by_name(final String dbName, final String tblName,
- final String indexName, final boolean deleteData) throws TException {
- startFunction("drop_index_by_name", ": db=" + dbName + " tbl="
- + tblName + " index=" + indexName);
-
- boolean ret = false;
- Exception ex = null;
- try {
- ret = drop_index_by_name_core(getMS(), dbName, tblName,
- indexName, deleteData);
- } catch (IOException e) {
- ex = e;
- throw new MetaException(e.getMessage());
- } catch (Exception e) {
- ex = e;
- rethrowException(e);
- } finally {
- endFunction("drop_index_by_name", ret, ex, tblName);
- }
-
- return ret;
- }
-
- private boolean drop_index_by_name_core(final RawStore ms,
- final String dbName, final String tblName,
- final String indexName, final boolean deleteData) throws TException, IOException {
- boolean success = false;
- Index index = null;
- Path tblPath = null;
- List<Path> partPaths = null;
- Map<String, String> transactionalListenerResponses = Collections.emptyMap();
- try {
- ms.openTransaction();
- // drop the underlying index table
- index = get_index_by_name(dbName, tblName, indexName); // throws exception if not exists
- firePreEvent(new PreDropIndexEvent(index, this));
- ms.dropIndex(dbName, tblName, indexName);
- String idxTblName = index.getIndexTableName();
- if (idxTblName != null) {
- String[] qualified = MetaStoreUtils.getQualifiedName(index.getDbName(), idxTblName);
- Table tbl = get_table_core(qualified[0], qualified[1]);
- if (tbl.getSd() == null) {
- throw new MetaException("Table metadata is corrupted");
- }
-
- if (tbl.getSd().getLocation() != null) {
- tblPath = new Path(tbl.getSd().getLocation());
- if (!wh.isWritable(tblPath.getParent())) {
- throw new MetaException("Index table metadata not deleted since " +
- tblPath.getParent() + " is not writable by " +
- SecurityUtils.getUser());
- }
- }
-
- // Drop the partitions and get a list of partition locations which need to be deleted
- partPaths = dropPartitionsAndGetLocations(ms, qualified[0], qualified[1], tblPath,
- tbl.getPartitionKeys(), deleteData);
- if (!ms.dropTable(qualified[0], qualified[1])) {
- throw new MetaException("Unable to drop underlying data table "
- + qualified[0] + "." + qualified[1] + " for index " + indexName);
- }
- }
-
- if (!transactionalListeners.isEmpty()) {
- transactionalListenerResponses =
- MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
- EventType.DROP_INDEX,
- new DropIndexEvent(index, true, this));
- }
-
- success = ms.commitTransaction();
- } finally {
- if (!success) {
- ms.rollbackTransaction();
- } else if (deleteData && tblPath != null) {
- deletePartitionData(partPaths);
- deleteTableData(tblPath);
- // ok even if the data is not deleted
- }
- // Skip the event listeners if the index is NULL
- if (index != null && !listeners.isEmpty()) {
- MetaStoreListenerNotifier.notifyEvent(listeners,
- EventType.DROP_INDEX,
- new DropIndexEvent(index, success, this),
- null,
- transactionalListenerResponses, ms);
- }
- }
- return success;
- }
-
- @Override
- public Index get_index_by_name(final String dbName, final String tblName,
- final String indexName) throws TException {
-
- startFunction("get_index_by_name", ": db=" + dbName + " tbl="
- + tblName + " index=" + indexName);
-
- Index ret = null;
- Exception ex = null;
- try {
- ret = get_index_by_name_core(getMS(), dbName, tblName, indexName);
- } catch (Exception e) {
- ex = e;
- rethrowException(e);
- } finally {
- endFunction("get_index_by_name", ret != null, ex, tblName);
- }
- return ret;
- }
-
- private Index get_index_by_name_core(final RawStore ms, final String db_name,
- final String tbl_name, final String index_name) throws TException {
- Index index = ms.getIndex(db_name, tbl_name, index_name);
-
- if (index == null) {
- throw new NoSuchObjectException(db_name + "." + tbl_name
- + " index=" + index_name + " not found");
- }
- return index;
- }
-
- @Override
- public List<String> get_index_names(final String dbName, final String tblName,
- final short maxIndexes) throws TException {
- startTableFunction("get_index_names", dbName, tblName);
-
- List<String> ret = null;
- Exception ex = null;
- try {
- ret = getMS().listIndexNames(dbName, tblName, maxIndexes);
- } catch (Exception e) {
- ex = e;
- if (e instanceof MetaException) {
- throw (MetaException) e;
- } else {
- throw newMetaException(e);
- }
- } finally {
- endFunction("get_index_names", ret != null, ex, tblName);
- }
- return ret;
- }
-
- @Override
- public List<Index> get_indexes(final String dbName, final String tblName,
- final short maxIndexes) throws TException {
- startTableFunction("get_indexes", dbName, tblName);
-
- List<Index> ret = null;
- Exception ex = null;
- try {
- ret = getMS().getIndexes(dbName, tblName, maxIndexes);
- } catch (Exception e) {
- ex = e;
- rethrowException(e);
- } finally {
- endFunction("get_indexes", ret != null, ex, tblName);
- }
- return ret;
- }
private String lowerCaseConvertPartName(String partName) throws MetaException {
boolean isFirst = true;
@@ -5350,7 +5020,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
try {
List<ColumnStatistics> list = getMS().getPartitionColumnStatistics(dbName, tableName,
Lists.newArrayList(convertedPartName), Lists.newArrayList(colName));
- if (list.isEmpty()) return null;
+ if (list.isEmpty()) {
+ return null;
+ }
if (list.size() != 1) {
throw new MetaException(list.size() + " statistics for single column and partition");
}
@@ -5612,6 +5284,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
}
+ @Override
public int get_num_partitions_by_filter(final String dbName,
final String tblName, final String filter)
throws TException {
@@ -6952,7 +6625,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
newStatsMap.put(partName, csNew);
}
-
+
Map<String, ColumnStatistics> oldStatsMap = new HashMap<>();
Map<String, Partition> mapToPart = new HashMap<>();
if (request.isSetNeedMerge() && request.isNeedMerge()) {
@@ -7117,7 +6790,10 @@ public class HiveMetaStore extends ThriftHiveMetastore {
getMS().getFileMetadataByExpr(fileIds, type, req.getExpr(), metadatas, ppdResults, eliminated);
for (int i = 0; i < fileIds.size(); ++i) {
- if (!eliminated[i] && ppdResults[i] == null) continue; // No metadata => no ppd.
+ if (!eliminated[i] && ppdResults[i] == null)
+ {
+ continue; // No metadata => no ppd.
+ }
MetadataPpdResult mpr = new MetadataPpdResult();
ByteBuffer ppdResult = eliminated[i] ? null : handleReadOnlyBufferForThrift(ppdResults[i]);
mpr.setIncludeBitset(ppdResult);
@@ -7151,7 +6827,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
assert metadatas.length == fileIds.size();
for (int i = 0; i < metadatas.length; ++i) {
ByteBuffer bb = metadatas[i];
- if (bb == null) continue;
+ if (bb == null) {
+ continue;
+ }
bb = handleReadOnlyBufferForThrift(bb);
result.putToMetadata(fileIds.get(i), bb);
}
@@ -7162,7 +6840,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
private ByteBuffer handleReadOnlyBufferForThrift(ByteBuffer bb) {
- if (!bb.isReadOnly()) return bb;
+ if (!bb.isReadOnly()) {
+ return bb;
+ }
// Thrift cannot write read-only buffers... oh well.
// TODO: actually thrift never writes to the buffer, so we could use reflection to
// unset the unnecessary read-only flag if allocation/copy perf becomes a problem.
@@ -8148,7 +7828,9 @@ public class HiveMetaStore extends ThriftHiveMetastore {
try {
// Per the javadocs on Condition, do not depend on the condition alone as a start gate
// since spurious wake ups are possible.
- while (!startedServing.get()) startCondition.await();
+ while (!startedServing.get()) {
+ startCondition.await();
+ }
startCompactorInitiator(conf);
startCompactorWorkers(conf);
startCompactorCleaner(conf);
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index da0d329..3128089 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -1136,9 +1136,6 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
return;
}
- if (MetaStoreUtils.isIndexTable(tbl)) {
- throw new UnsupportedOperationException("Cannot drop index tables");
- }
HiveMetaHook hook = getHook(tbl);
if (hook != null) {
hook.preDropTable(tbl);
@@ -1665,87 +1662,6 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
return fastpath ? fields : deepCopyFieldSchemas(fields);
}
- /**
- * create an index
- * @param index the index object
- * @param indexTable which stores the index data
- * @throws InvalidObjectException
- * @throws MetaException
- * @throws NoSuchObjectException
- * @throws TException
- * @throws AlreadyExistsException
- */
- @Override
- public void createIndex(Index index, Table indexTable) throws AlreadyExistsException, InvalidObjectException, MetaException, NoSuchObjectException, TException {
- client.add_index(index, indexTable);
- }
-
- /**
- * @param dbname
- * @param base_tbl_name
- * @param idx_name
- * @param new_idx
- * @throws InvalidOperationException
- * @throws MetaException
- * @throws TException
- * @see org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore.Iface#alter_index(java.lang.String,
- * java.lang.String, java.lang.String, org.apache.hadoop.hive.metastore.api.Index)
- */
- @Override
- public void alter_index(String dbname, String base_tbl_name, String idx_name, Index new_idx)
- throws InvalidOperationException, MetaException, TException {
- client.alter_index(dbname, base_tbl_name, idx_name, new_idx);
- }
-
- /**
- * @param dbName
- * @param tblName
- * @param indexName
- * @return the index
- * @throws MetaException
- * @throws UnknownTableException
- * @throws NoSuchObjectException
- * @throws TException
- */
- @Override
- public Index getIndex(String dbName, String tblName, String indexName)
- throws MetaException, UnknownTableException, NoSuchObjectException,
- TException {
- return deepCopy(filterHook.filterIndex(client.get_index_by_name(dbName, tblName, indexName)));
- }
-
- /**
- * list indexes of the give base table
- * @param dbName
- * @param tblName
- * @param max
- * @return the list of indexes
- * @throws NoSuchObjectException
- * @throws MetaException
- * @throws TException
- */
- @Override
- public List<String> listIndexNames(String dbName, String tblName, short max)
- throws MetaException, TException {
- return filterHook.filterIndexNames(dbName, tblName, client.get_index_names(dbName, tblName, max));
- }
-
- /**
- * list all the index names of the give base table.
- *
- * @param dbName
- * @param tblName
- * @param max
- * @return list of indexes
- * @throws MetaException
- * @throws TException
- */
- @Override
- public List<Index> listIndexes(String dbName, String tblName, short max)
- throws NoSuchObjectException, MetaException, TException {
- return filterHook.filterIndexes(client.get_indexes(dbName, tblName, max));
- }
-
@Override
public List<SQLPrimaryKey> getPrimaryKeys(PrimaryKeysRequest req)
throws MetaException, NoSuchObjectException, TException {
@@ -1959,14 +1875,6 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
return copy;
}
- private Index deepCopy(Index index) {
- Index copy = null;
- if (index != null) {
- copy = new Index(index);
- }
- return copy;
- }
-
private Type deepCopy(Type type) {
Type copy = null;
if (type != null) {
@@ -2040,13 +1948,6 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
@Override
- public boolean dropIndex(String dbName, String tblName, String name,
- boolean deleteData) throws NoSuchObjectException, MetaException,
- TException {
- return client.drop_index_by_name(dbName, tblName, name, deleteData);
- }
-
- @Override
public boolean grant_role(String roleName, String userName,
PrincipalType principalType, String grantor, PrincipalType grantorType,
boolean grantOption) throws MetaException, TException {
@@ -2361,10 +2262,15 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
public void compact(String dbname, String tableName, String partitionName, CompactionType type)
throws TException {
CompactionRequest cr = new CompactionRequest();
- if (dbname == null) cr.setDbname(DEFAULT_DATABASE_NAME);
- else cr.setDbname(dbname);
+ if (dbname == null) {
+ cr.setDbname(DEFAULT_DATABASE_NAME);
+ } else {
+ cr.setDbname(dbname);
+ }
cr.setTablename(tableName);
- if (partitionName != null) cr.setPartitionname(partitionName);
+ if (partitionName != null) {
+ cr.setPartitionname(partitionName);
+ }
cr.setType(type);
client.compact(cr);
}
@@ -2379,10 +2285,15 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
public CompactionResponse compact2(String dbname, String tableName, String partitionName, CompactionType type,
Map<String, String> tblproperties) throws TException {
CompactionRequest cr = new CompactionRequest();
- if (dbname == null) cr.setDbname(DEFAULT_DATABASE_NAME);
- else cr.setDbname(dbname);
+ if (dbname == null) {
+ cr.setDbname(DEFAULT_DATABASE_NAME);
+ } else {
+ cr.setDbname(dbname);
+ }
cr.setTablename(tableName);
- if (partitionName != null) cr.setPartitionname(partitionName);
+ if (partitionName != null) {
+ cr.setPartitionname(partitionName);
+ }
cr.setType(type);
cr.setProperties(tblproperties);
return client.compact2(cr);
@@ -2439,7 +2350,9 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
NotificationEventResponse filtered = new NotificationEventResponse();
if (rsp != null && rsp.getEvents() != null) {
for (NotificationEvent e : rsp.getEvents()) {
- if (filter.accept(e)) filtered.addToEvents(e);
+ if (filter.accept(e)) {
+ filtered.addToEvents(e);
+ }
}
}
return filtered;
@@ -2589,14 +2502,18 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
private int listIndex = 0;
@Override
protected Map<Long, ByteBuffer> fetchNextBatch() throws TException {
- if (listIndex == fileIds.size()) return null;
+ if (listIndex == fileIds.size()) {
+ return null;
+ }
int endIndex = Math.min(listIndex + fileMetadataBatchSize, fileIds.size());
List<Long> subList = fileIds.subList(listIndex, endIndex);
GetFileMetadataResult resp = sendGetFileMetadataReq(subList);
// TODO: we could remember if it's unsupported and stop sending calls; although, it might
// be a bad idea for HS2+standalone metastore that could be updated with support.
// Maybe we should just remember this for some time.
- if (!resp.isIsSupported()) return null;
+ if (!resp.isIsSupported()) {
+ return null;
+ }
listIndex = endIndex;
return resp.getMetadata();
}
@@ -2615,12 +2532,16 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
private int listIndex = 0;
@Override
protected Map<Long, MetadataPpdResult> fetchNextBatch() throws TException {
- if (listIndex == fileIds.size()) return null;
+ if (listIndex == fileIds.size()) {
+ return null;
+ }
int endIndex = Math.min(listIndex + fileMetadataBatchSize, fileIds.size());
List<Long> subList = fileIds.subList(listIndex, endIndex);
GetFileMetadataByExprResult resp = sendGetFileMetadataBySargReq(
sarg, subList, doGetFooters);
- if (!resp.isIsSupported()) return null;
+ if (!resp.isIsSupported()) {
+ return null;
+ }
listIndex = endIndex;
return resp.getMetadata();
}
@@ -2652,7 +2573,9 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
}
private void ensureCurrentBatch() {
- if (currentIter != null && currentIter.hasNext()) return;
+ if (currentIter != null && currentIter.hasNext()) {
+ return;
+ }
currentIter = null;
Map<K, V> currentBatch;
do {
@@ -2661,7 +2584,10 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
} catch (TException ex) {
throw new RuntimeException(ex);
}
- if (currentBatch == null) return; // No more data.
+ if (currentBatch == null)
+ {
+ return; // No more data.
+ }
} while (currentBatch.isEmpty());
currentIter = currentBatch.entrySet().iterator();
}
@@ -2669,7 +2595,9 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
@Override
public Entry<K, V> next() {
ensureCurrentBatch();
- if (currentIter == null) throw new NoSuchElementException();
+ if (currentIter == null) {
+ throw new NoSuchElementException();
+ }
return currentIter.next();
}
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
index 037331f..46984cb 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -35,7 +35,6 @@ import org.apache.hadoop.hive.common.classification.RetrySemantics;
import org.apache.hadoop.hive.metastore.annotation.NoReconnect;
import org.apache.hadoop.hive.metastore.api.AggrStats;
import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
-import org.apache.hadoop.hive.metastore.api.BasicTxnInfo;
import org.apache.hadoop.hive.metastore.api.CmRecycleRequest;
import org.apache.hadoop.hive.metastore.api.CmRecycleResponse;
import org.apache.hadoop.hive.metastore.api.ColumnStatistics;
@@ -63,7 +62,6 @@ import org.apache.hadoop.hive.metastore.api.GetRoleGrantsForPrincipalResponse;
import org.apache.hadoop.hive.metastore.api.HeartbeatTxnRangeResponse;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
-import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.InvalidInputException;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
@@ -928,7 +926,7 @@ public interface IMetaStoreClient {
* table name of the old partition
* @param newParts
* list of partitions
- * @param environmentContext
+ * @param environmentContext
* @throws InvalidOperationException
* if the old partition does not exist
* @throws MetaException
@@ -1023,77 +1021,6 @@ public interface IMetaStoreClient {
throws MetaException, TException;
/**
- * create an index
- * @param index the index object
- * @throws InvalidObjectException
- * @throws MetaException
- * @throws NoSuchObjectException
- * @throws TException
- * @throws AlreadyExistsException
- */
- void createIndex(Index index, Table indexTable) throws InvalidObjectException,
- MetaException, NoSuchObjectException, TException, AlreadyExistsException;
-
- void alter_index(String dbName, String tblName, String indexName,
- Index index) throws InvalidOperationException, MetaException, TException;
-
- /**
- *
- * @param dbName
- * @param tblName
- * @param indexName
- * @return the index
- * @throws MetaException
- * @throws UnknownTableException
- * @throws NoSuchObjectException
- * @throws TException
- */
- Index getIndex(String dbName, String tblName, String indexName)
- throws MetaException, UnknownTableException, NoSuchObjectException,
- TException;
-
-
- /**
- * list indexes of the give base table
- * @param db_name
- * @param tbl_name
- * @param max
- * @return the list of indexes
- * @throws NoSuchObjectException
- * @throws MetaException
- * @throws TException
- */
- List<Index> listIndexes(String db_name, String tbl_name,
- short max) throws NoSuchObjectException, MetaException, TException;
-
- /**
- * list all the index names of the give base table.
- *
- * @param db_name
- * @param tbl_name
- * @param max
- * @return the list of names
- * @throws MetaException
- * @throws TException
- */
- List<String> listIndexNames(String db_name, String tbl_name,
- short max) throws MetaException, TException;
-
- /**
- * @param db_name
- * @param tbl_name
- * @param name index name
- * @param deleteData
- * @return true on success
- * @throws NoSuchObjectException
- * @throws MetaException
- * @throws TException
- */
- boolean dropIndex(String db_name, String tbl_name,
- String name, boolean deleteData) throws NoSuchObjectException,
- MetaException, TException;
-
- /**
* Write table level column statistics to persistent store
* @param statsObj
* @return boolean indicating the status of the operation
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
index 0e1620d..88d22d6 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreEventListener.java
@@ -24,12 +24,10 @@ import org.apache.hadoop.conf.Configurable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.events.AddForeignKeyEvent;
-import org.apache.hadoop.hive.metastore.events.AddIndexEvent;
import org.apache.hadoop.hive.metastore.events.AddNotNullConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AddPrimaryKeyEvent;
import org.apache.hadoop.hive.metastore.events.AddUniqueConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AlterDatabaseEvent;
-import org.apache.hadoop.hive.metastore.events.AlterIndexEvent;
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
@@ -40,7 +38,6 @@ import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropConstraintEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.DropFunctionEvent;
-import org.apache.hadoop.hive.metastore.events.DropIndexEvent;
import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.hive.metastore.events.InsertEvent;
@@ -140,27 +137,6 @@ public abstract class MetaStoreEventListener implements Configurable {
}
/**
- * @param indexEvent index event
- * @throws MetaException
- */
- public void onAddIndex(AddIndexEvent indexEvent) throws MetaException {
- }
-
- /**
- * @param indexEvent index event
- * @throws MetaException
- */
- public void onDropIndex(DropIndexEvent indexEvent) throws MetaException {
- }
-
- /**
- * @param indexEvent index event
- * @throws MetaException
- */
- public void onAlterIndex(AlterIndexEvent indexEvent) throws MetaException {
- }
-
- /**
* @param fnEvent function event
* @throws MetaException
*/
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreFilterHook.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreFilterHook.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreFilterHook.java
index fb341b2..8522afe 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreFilterHook.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreFilterHook.java
@@ -23,7 +23,6 @@ import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.hive.metastore.api.Database;
-import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
import org.apache.hadoop.hive.metastore.api.Partition;
@@ -110,23 +109,6 @@ public interface MetaStoreFilterHook {
public List<String> filterPartitionNames(String dbName, String tblName,
List<String> partitionNames) throws MetaException;
- public Index filterIndex(Index index) throws MetaException, NoSuchObjectException;
- /**
- * Filter given list of index names
- * @param dbName
- * @param tblName
- * @param indexList
- * @return
- */
- public List<String> filterIndexNames(String dbName, String tblName,
- List<String> indexList) throws MetaException;
-
- /**
- * Filter given list of index objects
- * @param indexeList
- * @return
- */
- public List<Index> filterIndexes(List<Index> indexeList) throws MetaException;
}
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreListenerNotifier.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreListenerNotifier.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreListenerNotifier.java
index a640b34..af01e8a 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreListenerNotifier.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreListenerNotifier.java
@@ -25,13 +25,11 @@ import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
import org.apache.hadoop.hive.metastore.api.MetaException;
import org.apache.hadoop.hive.metastore.events.AddForeignKeyEvent;
-import org.apache.hadoop.hive.metastore.events.AddIndexEvent;
import org.apache.hadoop.hive.metastore.events.AddNotNullConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AddPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AddPrimaryKeyEvent;
import org.apache.hadoop.hive.metastore.events.AddUniqueConstraintEvent;
import org.apache.hadoop.hive.metastore.events.AlterDatabaseEvent;
-import org.apache.hadoop.hive.metastore.events.AlterIndexEvent;
import org.apache.hadoop.hive.metastore.events.AlterPartitionEvent;
import org.apache.hadoop.hive.metastore.events.AlterTableEvent;
import org.apache.hadoop.hive.metastore.events.CreateDatabaseEvent;
@@ -39,7 +37,6 @@ import org.apache.hadoop.hive.metastore.events.CreateFunctionEvent;
import org.apache.hadoop.hive.metastore.events.CreateTableEvent;
import org.apache.hadoop.hive.metastore.events.DropDatabaseEvent;
import org.apache.hadoop.hive.metastore.events.DropFunctionEvent;
-import org.apache.hadoop.hive.metastore.events.DropIndexEvent;
import org.apache.hadoop.hive.metastore.events.DropPartitionEvent;
import org.apache.hadoop.hive.metastore.events.DropTableEvent;
import org.apache.hadoop.hive.metastore.events.InsertEvent;
@@ -137,24 +134,6 @@ public class MetaStoreListenerNotifier {
listener.onDropFunction((DropFunctionEvent)event);
}
})
- .put(EventType.CREATE_INDEX, new EventNotifier() {
- @Override
- public void notify(MetaStoreEventListener listener, ListenerEvent event) throws MetaException {
- listener.onAddIndex((AddIndexEvent)event);
- }
- })
- .put(EventType.DROP_INDEX, new EventNotifier() {
- @Override
- public void notify(MetaStoreEventListener listener, ListenerEvent event) throws MetaException {
- listener.onDropIndex((DropIndexEvent)event);
- }
- })
- .put(EventType.ALTER_INDEX, new EventNotifier() {
- @Override
- public void notify(MetaStoreEventListener listener, ListenerEvent event) throws MetaException {
- listener.onAlterIndex((AlterIndexEvent)event);
- }
- })
.put(EventType.ADD_PRIMARYKEY, new EventNotifier() {
@Override
public void notify(MetaStoreEventListener listener, ListenerEvent event) throws MetaException {
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 11667b7..3633c03 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -92,7 +92,6 @@ import org.apache.hadoop.hive.metastore.api.FunctionType;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
import org.apache.hadoop.hive.metastore.api.HiveObjectRef;
import org.apache.hadoop.hive.metastore.api.HiveObjectType;
-import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.InvalidInputException;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
@@ -156,7 +155,6 @@ import org.apache.hadoop.hive.metastore.model.MDelegationToken;
import org.apache.hadoop.hive.metastore.model.MFieldSchema;
import org.apache.hadoop.hive.metastore.model.MFunction;
import org.apache.hadoop.hive.metastore.model.MGlobalPrivilege;
-import org.apache.hadoop.hive.metastore.model.MIndex;
import org.apache.hadoop.hive.metastore.model.MMasterKey;
import org.apache.hadoop.hive.metastore.model.MMetastoreDBProperties;
import org.apache.hadoop.hive.metastore.model.MNotificationLog;
@@ -3777,37 +3775,6 @@ public class ObjectStore implements RawStore, Configurable {
}
}
- @Override
- public void alterIndex(String dbname, String baseTblName, String name, Index newIndex)
- throws InvalidObjectException, MetaException {
- boolean success = false;
- try {
- openTransaction();
- name = normalizeIdentifier(name);
- baseTblName = normalizeIdentifier(baseTblName);
- dbname = normalizeIdentifier(dbname);
- MIndex newi = convertToMIndex(newIndex);
- if (newi == null) {
- throw new InvalidObjectException("new index is invalid");
- }
-
- MIndex oldi = getMIndex(dbname, baseTblName, name);
- if (oldi == null) {
- throw new MetaException("index " + name + " doesn't exist");
- }
-
- // For now only alter parameters are allowed
- oldi.setParameters(newi.getParameters());
-
- // commit the changes
- success = commitTransaction();
- } finally {
- if (!success) {
- rollbackTransaction();
- }
- }
- }
-
/**
* Alters an existing partition. Initiates copy of SD. Returns the old CD.
* @param dbname
@@ -4633,190 +4600,6 @@ public class ObjectStore implements RawStore, Configurable {
}
@Override
- public boolean addIndex(Index index) throws InvalidObjectException,
- MetaException {
- boolean commited = false;
- try {
- openTransaction();
- MIndex idx = convertToMIndex(index);
- pm.makePersistent(idx);
- commited = commitTransaction();
- return true;
- } finally {
- if (!commited) {
- rollbackTransaction();
- return false;
- }
- }
- }
-
- private MIndex convertToMIndex(Index index) throws InvalidObjectException,
- MetaException {
-
- StorageDescriptor sd = index.getSd();
- if (sd == null) {
- throw new InvalidObjectException("Storage descriptor is not defined for index.");
- }
-
- MStorageDescriptor msd = this.convertToMStorageDescriptor(sd);
- MTable origTable = getMTable(index.getDbName(), index.getOrigTableName());
- if (origTable == null) {
- throw new InvalidObjectException(
- "Original table does not exist for the given index.");
- }
-
- String[] qualified = MetaStoreUtils.getQualifiedName(index.getDbName(), index.getIndexTableName());
- MTable indexTable = getMTable(qualified[0], qualified[1]);
- if (indexTable == null) {
- throw new InvalidObjectException(
- "Underlying index table does not exist for the given index.");
- }
-
- return new MIndex(normalizeIdentifier(index.getIndexName()), origTable, index.getCreateTime(),
- index.getLastAccessTime(), index.getParameters(), indexTable, msd,
- index.getIndexHandlerClass(), index.isDeferredRebuild());
- }
-
- @Override
- public boolean dropIndex(String dbName, String origTableName, String indexName)
- throws MetaException {
- boolean success = false;
- try {
- openTransaction();
- MIndex index = getMIndex(dbName, origTableName, indexName);
- if (index != null) {
- pm.deletePersistent(index);
- }
- success = commitTransaction();
- } finally {
- if (!success) {
- rollbackTransaction();
- }
- }
- return success;
- }
-
- private MIndex getMIndex(String dbName, String originalTblName, String indexName)
- throws MetaException {
- MIndex midx = null;
- boolean commited = false;
- Query query = null;
- try {
- openTransaction();
- dbName = normalizeIdentifier(dbName);
- originalTblName = normalizeIdentifier(originalTblName);
- MTable mtbl = getMTable(dbName, originalTblName);
- if (mtbl == null) {
- commited = commitTransaction();
- return null;
- }
- query =
- pm.newQuery(MIndex.class,
- "origTable.tableName == t1 && origTable.database.name == t2 && indexName == t3");
- query.declareParameters("java.lang.String t1, java.lang.String t2, java.lang.String t3");
- query.setUnique(true);
- midx =
- (MIndex) query.execute(originalTblName, dbName,
- normalizeIdentifier(indexName));
- pm.retrieve(midx);
- commited = commitTransaction();
- } finally {
- rollbackAndCleanup(commited, query);
- }
- return midx;
- }
-
- @Override
- public Index getIndex(String dbName, String origTableName, String indexName)
- throws MetaException {
- openTransaction();
- MIndex mIndex = this.getMIndex(dbName, origTableName, indexName);
- Index ret = convertToIndex(mIndex);
- commitTransaction();
- return ret;
- }
-
- private Index convertToIndex(MIndex mIndex) throws MetaException {
- if (mIndex == null) {
- return null;
- }
-
- MTable origTable = mIndex.getOrigTable();
- MTable indexTable = mIndex.getIndexTable();
-
- return new Index(
- mIndex.getIndexName(),
- mIndex.getIndexHandlerClass(),
- origTable.getDatabase().getName(),
- origTable.getTableName(),
- mIndex.getCreateTime(),
- mIndex.getLastAccessTime(),
- indexTable.getTableName(),
- convertToStorageDescriptor(mIndex.getSd()),
- mIndex.getParameters(),
- mIndex.getDeferredRebuild());
-
- }
-
- @Override
- public List<Index> getIndexes(String dbName, String origTableName, int max)
- throws MetaException {
- boolean success = false;
- Query query = null;
- try {
- LOG.debug("Executing getIndexes");
- openTransaction();
-
- dbName = normalizeIdentifier(dbName);
- origTableName = normalizeIdentifier(origTableName);
- query =
- pm.newQuery(MIndex.class, "origTable.tableName == t1 && origTable.database.name == t2");
- query.declareParameters("java.lang.String t1, java.lang.String t2");
- List<MIndex> mIndexes = (List<MIndex>) query.execute(origTableName, dbName);
- pm.retrieveAll(mIndexes);
-
- List<Index> indexes = new ArrayList<>(mIndexes.size());
- for (MIndex mIdx : mIndexes) {
- indexes.add(this.convertToIndex(mIdx));
- }
- success = commitTransaction();
- LOG.debug("Done retrieving all objects for getIndexes");
-
- return indexes;
- } finally {
- rollbackAndCleanup(success, query);
- }
- }
-
- @Override
- public List<String> listIndexNames(String dbName, String origTableName, short max)
- throws MetaException {
- List<String> pns = new ArrayList<>();
- boolean success = false;
- Query query = null;
- try {
- openTransaction();
- LOG.debug("Executing listIndexNames");
- dbName = normalizeIdentifier(dbName);
- origTableName = normalizeIdentifier(origTableName);
- query =
- pm.newQuery("select indexName from org.apache.hadoop.hive.metastore.model.MIndex "
- + "where origTable.database.name == t1 && origTable.tableName == t2 "
- + "order by indexName asc");
- query.declareParameters("java.lang.String t1, java.lang.String t2");
- query.setResult("indexName");
- Collection names = (Collection) query.execute(dbName, origTableName);
- for (Iterator i = names.iterator(); i.hasNext();) {
- pns.add((String) i.next());
- }
- success = commitTransaction();
- } finally {
- rollbackAndCleanup(success, query);
- }
- return pns;
- }
-
- @Override
public boolean addRole(String roleName, String ownerName)
throws InvalidObjectException, MetaException, NoSuchObjectException {
boolean success = false;
@@ -10117,7 +9900,7 @@ public class ObjectStore implements RawStore, Configurable {
} else {
result = handleSimpleAlter(name, changes, canActivateDisabled, canDeactivate);
}
-
+
commited = commitTransaction();
return result;
} catch (Exception e) {
@@ -10210,7 +9993,9 @@ public class ObjectStore implements RawStore, Configurable {
String copyName = generateOldPlanName(newName, i);
while (true) {
MWMResourcePlan dup = getMWMResourcePlan(copyName, false, false);
- if (dup == null) break;
+ if (dup == null) {
+ break;
+ }
// Note: this can still conflict with parallel transactions. We do not currently handle
// parallel changes from two admins (by design :().
copyName = generateOldPlanName(newName, ++i);
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
index 6a8036f..40a7497 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
@@ -40,7 +40,6 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.FileMetadataExprType;
import org.apache.hadoop.hive.metastore.api.Function;
import org.apache.hadoop.hive.metastore.api.HiveObjectPrivilege;
-import org.apache.hadoop.hive.metastore.api.Index;
import org.apache.hadoop.hive.metastore.api.InvalidInputException;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
@@ -236,22 +235,6 @@ public interface RawStore extends Configurable {
List<List<String>> part_vals_list, List<Partition> new_parts)
throws InvalidObjectException, MetaException;
- boolean addIndex(Index index)
- throws InvalidObjectException, MetaException;
-
- Index getIndex(String dbName, String origTableName, String indexName) throws MetaException;
-
- boolean dropIndex(String dbName, String origTableName, String indexName) throws MetaException;
-
- List<Index> getIndexes(String dbName,
- String origTableName, int max) throws MetaException;
-
- List<String> listIndexNames(String dbName,
- String origTableName, short max) throws MetaException;
-
- void alterIndex(String dbname, String baseTblName, String name, Index newIndex)
- throws InvalidObjectException, MetaException;
-
List<Partition> getPartitionsByFilter(
String dbName, String tblName, String filter, short maxParts)
throws MetaException, NoSuchObjectException;
http://git-wip-us.apache.org/repos/asf/hive/blob/7c22d74c/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/TableType.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/TableType.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/TableType.java
index 629d1d6..33f394d 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/TableType.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/TableType.java
@@ -22,5 +22,5 @@ package org.apache.hadoop.hive.metastore;
* Typesafe enum for types of tables described by the metastore.
*/
public enum TableType {
- MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW, INDEX_TABLE, MATERIALIZED_VIEW
+ MANAGED_TABLE, EXTERNAL_TABLE, VIRTUAL_VIEW, MATERIALIZED_VIEW
}