> On June 30, 2014, 6:48 p.m., Alan Gates wrote: > > What will happen if a user tries to create a view over a temp table? I'm > > not sure if the creation will fail (since there's no table in the database) > > or succeed but fail later when the user tries to use the view. Ideally it > > would give a nice error message, e.g. "views not supported over temp > > tables."
Creation will not fail, and for the life of the temp table queries against the view will succeed. If another session tries to use the view and the temp table does not exist in that session, an error will occur when the view is used in a query. This is a similar situation to creating a view on a normal table in Hive, and then deleting the table out from under the view - no error will occur until the view is queried. > On June 30, 2014, 6:48 p.m., Alan Gates wrote: > > ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java, > > line 241 > > <https://reviews.apache.org/r/22996/diff/2/?file=619995#file619995line241> > > > > AFAICT there are no security checks here on who can create tables in > > what database. Not sure how we should handle this, as you'd like users to > > be able to create temp tables even when they don't have a database they own > > and thus can create temp tables in. But explicitly creating them in > > databases they don't have permission on is going to look like a security > > breach. Since create temporary table goes through much of the same initial logic as for normal tables, it runs through the same permissions checks as for non-temp tables. I think that is suitable behavior and makes things look consistent between temp/non-temp tables. Test case temp_table_authorize_create_tbl.q, added as part of the patch, tests that users cannot create a temp table if they do not have owner perms on the DB. - Jason ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/22996/#review47005 ----------------------------------------------------------- On June 28, 2014, 12:35 a.m., Jason Dere wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/22996/ > ----------------------------------------------------------- > > (Updated June 28, 2014, 12:35 a.m.) > > > Review request for hive, Gunther Hagleitner, Navis Ryu, and Harish Butani. > > > Bugs: HIVE-7090 > https://issues.apache.org/jira/browse/HIVE-7090 > > > Repository: hive-git > > > Description > ------- > > Temp tables managed in memory by SessionState. > SessionHiveMetaStoreClient overrides table-related methods in HiveMetaStore > to access the temp tables saved in the SessionState when appropriate. > > > Diffs > ----- > > itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcWithMiniMr.java > 9fb7550 > itests/qtest/testconfiguration.properties 1462ecd > metastore/if/hive_metastore.thrift cc802c6 > metastore/src/java/org/apache/hadoop/hive/metastore/Warehouse.java 9e8d912 > ql/src/java/org/apache/hadoop/hive/ql/Context.java abc4290 > ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java d8d900b > ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 4d35176 > > ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java > PRE-CREATION > ql/src/java/org/apache/hadoop/hive/ql/metadata/Table.java 3df2690 > > ql/src/java/org/apache/hadoop/hive/ql/parse/ColumnStatsSemanticAnalyzer.java > 1270520 > ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g f934ac4 > ql/src/java/org/apache/hadoop/hive/ql/parse/ImportSemanticAnalyzer.java > 71471f4 > ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 83d09c0 > ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableDesc.java 2537b75 > ql/src/java/org/apache/hadoop/hive/ql/plan/CreateTableLikeDesc.java cb5d64c > ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java 2143d0c > ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestTezTask.java 43125f7 > ql/src/test/org/apache/hadoop/hive/ql/lockmgr/TestDbTxnManager.java 98c3cc3 > ql/src/test/org/apache/hadoop/hive/ql/parse/TestMacroSemanticAnalyzer.java > 91de8da > > ql/src/test/org/apache/hadoop/hive/ql/parse/authorization/TestHiveAuthorizationTaskFactory.java > 20d08b3 > ql/src/test/queries/clientnegative/temp_table_authorize_create_tbl.q > PRE-CREATION > ql/src/test/queries/clientnegative/temp_table_column_stats.q PRE-CREATION > ql/src/test/queries/clientnegative/temp_table_create_like_partitions.q > PRE-CREATION > ql/src/test/queries/clientnegative/temp_table_index.q PRE-CREATION > ql/src/test/queries/clientnegative/temp_table_partitions.q PRE-CREATION > ql/src/test/queries/clientnegative/temp_table_rename.q PRE-CREATION > ql/src/test/queries/clientpositive/show_create_table_temp_table.q > PRE-CREATION > ql/src/test/queries/clientpositive/stats19.q 51514bd > ql/src/test/queries/clientpositive/temp_table.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_external.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_gb1.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_join1.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_names.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_options1.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_precedence.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_subquery1.q PRE-CREATION > ql/src/test/queries/clientpositive/temp_table_windowing_expressions.q > PRE-CREATION > ql/src/test/results/clientnegative/temp_table_authorize_create_tbl.q.out > PRE-CREATION > ql/src/test/results/clientnegative/temp_table_column_stats.q.out > PRE-CREATION > ql/src/test/results/clientnegative/temp_table_create_like_partitions.q.out > PRE-CREATION > ql/src/test/results/clientnegative/temp_table_index.q.out PRE-CREATION > ql/src/test/results/clientnegative/temp_table_partitions.q.out PRE-CREATION > ql/src/test/results/clientnegative/temp_table_rename.q.out PRE-CREATION > ql/src/test/results/clientpositive/nullformat.q.out d311825 > ql/src/test/results/clientpositive/nullformatCTAS.q.out cab23d5 > ql/src/test/results/clientpositive/show_create_table_alter.q.out 206f4f8 > ql/src/test/results/clientpositive/show_create_table_db_table.q.out 528dd36 > ql/src/test/results/clientpositive/show_create_table_delimited.q.out > d4ffd53 > ql/src/test/results/clientpositive/show_create_table_serde.q.out a9e92b4 > ql/src/test/results/clientpositive/show_create_table_temp_table.q.out > PRE-CREATION > ql/src/test/results/clientpositive/temp_table.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_external.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_gb1.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_join1.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_names.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_options1.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_precedence.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_subquery1.q.out PRE-CREATION > ql/src/test/results/clientpositive/temp_table_windowing_expressions.q.out > PRE-CREATION > ql/src/test/results/clientpositive/tez/temp_table.q.out PRE-CREATION > > Diff: https://reviews.apache.org/r/22996/diff/ > > > Testing > ------- > > > Thanks, > > Jason Dere > >