Author: gates
Date: Fri Oct 3 23:04:56 2014
New Revision: 1629335
URL: http://svn.apache.org/r1629335
Log:
HIVE-8169 Windows: alter table ..set location from hcatalog failed with
NullPointerException (Xiaobing Zhou via Alan Gates)
Added:
hive/trunk/ql/src/test/queries/clientpositive/alter_table_location.q
hive/trunk/ql/src/test/results/clientpositive/alter_table_location.q.out
Modified:
hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
Modified:
hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
URL:
http://svn.apache.org/viewvc/hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java?rev=1629335&r1=1629334&r2=1629335&view=diff
==============================================================================
---
hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
(original)
+++
hive/trunk/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
Fri Oct 3 23:04:56 2014
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.ql.exec.Task;
+import org.apache.hadoop.hive.ql.exec.Utilities;
import org.apache.hadoop.hive.ql.metadata.Hive;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.metadata.Partition;
@@ -360,7 +361,7 @@ public class HCatSemanticAnalyzer extend
AlterTableDesc alterTable = work.getAlterTblDesc();
if (alterTable != null) {
Table table = hive.getTable(SessionState.get().getCurrentDatabase(),
- alterTable.getOldName(), false);
+ Utilities.getDbTableName(alterTable.getOldName())[1], false);
Partition part = null;
if (alterTable.getPartSpec() != null) {
Added: hive/trunk/ql/src/test/queries/clientpositive/alter_table_location.q
URL:
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/alter_table_location.q?rev=1629335&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/alter_table_location.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/alter_table_location.q Fri
Oct 3 23:04:56 2014
@@ -0,0 +1,5 @@
+drop table if exists hcat_altertable_16;
+create table hcat_altertable_16(a int, b string) stored as textfile;
+show table extended like hcat_altertable_16;
+alter table hcat_altertable_16 set location
'file:${system:test.tmp.dir}/hcat_altertable_16';
+show table extended like hcat_altertable_16;
Added: hive/trunk/ql/src/test/results/clientpositive/alter_table_location.q.out
URL:
http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/alter_table_location.q.out?rev=1629335&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/alter_table_location.q.out
(added)
+++ hive/trunk/ql/src/test/results/clientpositive/alter_table_location.q.out
Fri Oct 3 23:04:56 2014
@@ -0,0 +1,55 @@
+PREHOOK: query: drop table if exists hcat_altertable_16
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists hcat_altertable_16
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table hcat_altertable_16(a int, b string) stored as
textfile
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@hcat_altertable_16
+POSTHOOK: query: create table hcat_altertable_16(a int, b string) stored as
textfile
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@hcat_altertable_16
+PREHOOK: query: show table extended like hcat_altertable_16
+PREHOOK: type: SHOW_TABLESTATUS
+POSTHOOK: query: show table extended like hcat_altertable_16
+POSTHOOK: type: SHOW_TABLESTATUS
+tableName:hcat_altertable_16
+#### A masked pattern was here ####
+inputformat:org.apache.hadoop.mapred.TextInputFormat
+outputformat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+columns:struct columns { i32 a, string b}
+partitioned:false
+partitionColumns:
+totalNumberFiles:0
+totalFileSize:0
+maxFileSize:0
+minFileSize:0
+#### A masked pattern was here ####
+
+#### A masked pattern was here ####
+PREHOOK: type: ALTERTABLE_LOCATION
+PREHOOK: Input: default@hcat_altertable_16
+PREHOOK: Output: default@hcat_altertable_16
+#### A masked pattern was here ####
+POSTHOOK: type: ALTERTABLE_LOCATION
+POSTHOOK: Input: default@hcat_altertable_16
+POSTHOOK: Output: default@hcat_altertable_16
+#### A masked pattern was here ####
+PREHOOK: query: show table extended like hcat_altertable_16
+PREHOOK: type: SHOW_TABLESTATUS
+POSTHOOK: query: show table extended like hcat_altertable_16
+POSTHOOK: type: SHOW_TABLESTATUS
+tableName:hcat_altertable_16
+#### A masked pattern was here ####
+inputformat:org.apache.hadoop.mapred.TextInputFormat
+outputformat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+columns:struct columns { i32 a, string b}
+partitioned:false
+partitionColumns:
+totalNumberFiles:unknown
+totalFileSize:unknown
+maxFileSize:unknown
+minFileSize:unknown
+#### A masked pattern was here ####
+