Author: gates
Date: Fri Oct  3 23:13:21 2014
New Revision: 1629336

URL: http://svn.apache.org/r1629336
Log:
HIVE-8169 Windows: alter table ..set location from hcatalog failed with 
NullPointerException (Xiaobing Zhou via Alan Gates)

Added:
    
hive/branches/branch-0.14/ql/src/test/queries/clientpositive/alter_table_location.q
    
hive/branches/branch-0.14/ql/src/test/results/clientpositive/alter_table_location.q.out
Modified:
    
hive/branches/branch-0.14/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java

Modified: 
hive/branches/branch-0.14/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
URL: 
http://svn.apache.org/viewvc/hive/branches/branch-0.14/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java?rev=1629336&r1=1629335&r2=1629336&view=diff
==============================================================================
--- 
hive/branches/branch-0.14/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
 (original)
+++ 
hive/branches/branch-0.14/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/SemanticAnalysis/HCatSemanticAnalyzer.java
 Fri Oct  3 23:13:21 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/branches/branch-0.14/ql/src/test/queries/clientpositive/alter_table_location.q
URL: 
http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/queries/clientpositive/alter_table_location.q?rev=1629336&view=auto
==============================================================================
--- 
hive/branches/branch-0.14/ql/src/test/queries/clientpositive/alter_table_location.q
 (added)
+++ 
hive/branches/branch-0.14/ql/src/test/queries/clientpositive/alter_table_location.q
 Fri Oct  3 23:13:21 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/branches/branch-0.14/ql/src/test/results/clientpositive/alter_table_location.q.out
URL: 
http://svn.apache.org/viewvc/hive/branches/branch-0.14/ql/src/test/results/clientpositive/alter_table_location.q.out?rev=1629336&view=auto
==============================================================================
--- 
hive/branches/branch-0.14/ql/src/test/results/clientpositive/alter_table_location.q.out
 (added)
+++ 
hive/branches/branch-0.14/ql/src/test/results/clientpositive/alter_table_location.q.out
 Fri Oct  3 23:13:21 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 ####
+


Reply via email to