Author: thejas Date: Sat Oct 18 01:15:14 2014 New Revision: 1632716 URL: http://svn.apache.org/r1632716 Log: HIVE-8475 : add test case for use of index from not-current database (Thejas Nair, reviewed by Vaibhav Gumashta)
Added: hive/branches/branch-0.14/ql/src/test/queries/clientpositive/index_in_db.q hive/branches/branch-0.14/ql/src/test/results/clientpositive/index_in_db.q.out Added: hive/branches/branch-0.14/ql/src/test/queries/clientpositive/index_in_db.q URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/queries/clientpositive/index_in_db.q?rev=1632716&view=auto ============================================================================== --- hive/branches/branch-0.14/ql/src/test/queries/clientpositive/index_in_db.q (added) +++ hive/branches/branch-0.14/ql/src/test/queries/clientpositive/index_in_db.q Sat Oct 18 01:15:14 2014 @@ -0,0 +1,13 @@ +set hive.optimize.index.filter=true; +drop database if exists index_test_db cascade; +-- Test selecting selecting from a table that is backed by an index +-- create table, index in a db, then set default db as current db, and try selecting + +create database index_test_db; + +use index_test_db; +create table testtb (id int, name string); +create index id_index on table testtb (id) as 'COMPACT' WITH DEFERRED REBUILD in table testdb_id_idx_tb; + +use default; +select * from index_test_db.testtb where id>2; Added: hive/branches/branch-0.14/ql/src/test/results/clientpositive/index_in_db.q.out URL: http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/clientpositive/index_in_db.q.out?rev=1632716&view=auto ============================================================================== --- hive/branches/branch-0.14/ql/src/test/results/clientpositive/index_in_db.q.out (added) +++ hive/branches/branch-0.14/ql/src/test/results/clientpositive/index_in_db.q.out Sat Oct 18 01:15:14 2014 @@ -0,0 +1,42 @@ +PREHOOK: query: drop database if exists index_test_db cascade +PREHOOK: type: DROPDATABASE +POSTHOOK: query: drop database if exists index_test_db cascade +POSTHOOK: type: DROPDATABASE +PREHOOK: query: -- Test selecting selecting from a table that is backed by an index +-- create table, index in a db, then set default db as current db, and try selecting + +create database index_test_db +PREHOOK: type: CREATEDATABASE +POSTHOOK: query: -- Test selecting selecting from a table that is backed by an index +-- create table, index in a db, then set default db as current db, and try selecting + +create database index_test_db +POSTHOOK: type: CREATEDATABASE +PREHOOK: query: use index_test_db +PREHOOK: type: SWITCHDATABASE +POSTHOOK: query: use index_test_db +POSTHOOK: type: SWITCHDATABASE +PREHOOK: query: create table testtb (id int, name string) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:index_test_db +POSTHOOK: query: create table testtb (id int, name string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:index_test_db +POSTHOOK: Output: index_test_db@testtb +PREHOOK: query: create index id_index on table testtb (id) as 'COMPACT' WITH DEFERRED REBUILD in table testdb_id_idx_tb +PREHOOK: type: CREATEINDEX +POSTHOOK: query: create index id_index on table testtb (id) as 'COMPACT' WITH DEFERRED REBUILD in table testdb_id_idx_tb +POSTHOOK: type: CREATEINDEX +POSTHOOK: Output: index_test_db@testdb_id_idx_tb +PREHOOK: query: use default +PREHOOK: type: SWITCHDATABASE +POSTHOOK: query: use default +POSTHOOK: type: SWITCHDATABASE +PREHOOK: query: select * from index_test_db.testtb where id>2 +PREHOOK: type: QUERY +PREHOOK: Input: index_test_db@testtb +#### A masked pattern was here #### +POSTHOOK: query: select * from index_test_db.testtb where id>2 +POSTHOOK: type: QUERY +POSTHOOK: Input: index_test_db@testtb +#### A masked pattern was here ####