Review Board 1.7.22


HIVE-4064,Handle db qualified names consistently across all HiveQL statements

Review Request #11755 - Created June 9, 2013 and updated

fangkun cao
hive-trunk
HIVE-4064
Reviewers
hive
hive
https://issues.apache.org/jira/browse/HIVE-4064

 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
Revision 1489269 New Change
[20] 37 lines
[+20]
38
import java.util.Date;
38
import java.util.Date;
39
import java.util.HashMap;
39
import java.util.HashMap;
40
import java.util.Iterator;
40
import java.util.Iterator;
41
import java.util.List;
41
import java.util.List;
42
import java.util.Map;
42
import java.util.Map;

    
   
43
import java.util.Map.Entry;
43
import java.util.Set;
44
import java.util.Set;
44
import java.util.SortedSet;
45
import java.util.SortedSet;
45
import java.util.TreeSet;
46
import java.util.TreeSet;
46
import java.util.Map.Entry;

   
47

    
   
47

   
48
import org.apache.commons.lang.StringEscapeUtils;
48
import org.apache.commons.lang.StringEscapeUtils;
49
import org.apache.commons.lang.StringUtils;
49
import org.apache.commons.lang.StringUtils;
50
import org.apache.commons.logging.Log;
50
import org.apache.commons.logging.Log;
51
import org.apache.commons.logging.LogFactory;
51
import org.apache.commons.logging.LogFactory;
[+20] [20] 59 lines
[+20]
111
import org.apache.hadoop.hive.ql.plan.AddPartitionDesc;
111
import org.apache.hadoop.hive.ql.plan.AddPartitionDesc;
112
import org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc;
112
import org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc;
113
import org.apache.hadoop.hive.ql.plan.AlterIndexDesc;
113
import org.apache.hadoop.hive.ql.plan.AlterIndexDesc;
114
import org.apache.hadoop.hive.ql.plan.AlterTableAlterPartDesc;
114
import org.apache.hadoop.hive.ql.plan.AlterTableAlterPartDesc;
115
import org.apache.hadoop.hive.ql.plan.AlterTableDesc;
115
import org.apache.hadoop.hive.ql.plan.AlterTableDesc;
116
import org.apache.hadoop.hive.ql.plan.AlterTableSimpleDesc;
116
import org.apache.hadoop.hive.ql.plan.AlterTableDesc.AlterTableTypes;
117
import org.apache.hadoop.hive.ql.plan.AlterTableExchangePartition;
117
import org.apache.hadoop.hive.ql.plan.AlterTableExchangePartition;

    
   
118
import org.apache.hadoop.hive.ql.plan.AlterTableSimpleDesc;
118
import org.apache.hadoop.hive.ql.plan.CreateDatabaseDesc;
119
import org.apache.hadoop.hive.ql.plan.CreateDatabaseDesc;
119
import org.apache.hadoop.hive.ql.plan.CreateIndexDesc;
120
import org.apache.hadoop.hive.ql.plan.CreateIndexDesc;
120
import org.apache.hadoop.hive.ql.plan.CreateTableDesc;
121
import org.apache.hadoop.hive.ql.plan.CreateTableDesc;
121
import org.apache.hadoop.hive.ql.plan.CreateTableLikeDesc;
122
import org.apache.hadoop.hive.ql.plan.CreateTableLikeDesc;
122
import org.apache.hadoop.hive.ql.plan.CreateViewDesc;
123
import org.apache.hadoop.hive.ql.plan.CreateViewDesc;
[+20] [20] 27 lines
[+20]
150
import org.apache.hadoop.hive.ql.plan.ShowTablesDesc;
151
import org.apache.hadoop.hive.ql.plan.ShowTablesDesc;
151
import org.apache.hadoop.hive.ql.plan.ShowTblPropertiesDesc;
152
import org.apache.hadoop.hive.ql.plan.ShowTblPropertiesDesc;
152
import org.apache.hadoop.hive.ql.plan.SwitchDatabaseDesc;
153
import org.apache.hadoop.hive.ql.plan.SwitchDatabaseDesc;
153
import org.apache.hadoop.hive.ql.plan.TruncateTableDesc;
154
import org.apache.hadoop.hive.ql.plan.TruncateTableDesc;
154
import org.apache.hadoop.hive.ql.plan.UnlockTableDesc;
155
import org.apache.hadoop.hive.ql.plan.UnlockTableDesc;
155
import org.apache.hadoop.hive.ql.plan.AlterTableDesc.AlterTableTypes;

   
156
import org.apache.hadoop.hive.ql.plan.api.StageType;
156
import org.apache.hadoop.hive.ql.plan.api.StageType;
157
import org.apache.hadoop.hive.ql.security.authorization.Privilege;
157
import org.apache.hadoop.hive.ql.security.authorization.Privilege;
158
import org.apache.hadoop.hive.serde.serdeConstants;
158
import org.apache.hadoop.hive.serde.serdeConstants;
159
import org.apache.hadoop.hive.serde2.Deserializer;
159
import org.apache.hadoop.hive.serde2.Deserializer;
160
import org.apache.hadoop.hive.serde2.MetadataTypedColumnsetSerDe;
160
import org.apache.hadoop.hive.serde2.MetadataTypedColumnsetSerDe;
[+20] [20] 2861 lines
[+20] [+] private int alterTable(Hive db, AlterTableDesc alterTbl) throws HiveException {
3022
    }
3022
    }
3023

    
   
3023

   
3024
    Table oldTbl = tbl.copy();
3024
    Table oldTbl = tbl.copy();
3025

    
   
3025

   
3026
    if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.RENAME) {
3026
    if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.RENAME) {
3027
      tbl.setTableName(alterTbl.getNewName());
3027
      Table tmpTbl = db.newTable(alterTbl.getNewName());

    
   
3028
      tbl.setDbName(tmpTbl.getDbName());

    
   
3029
      tbl.setTableName(tmpTbl.getTableName());
3028
    } else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.ADDCOLS) {
3030
    } else if (alterTbl.getOp() == AlterTableDesc.AlterTableTypes.ADDCOLS) {
3029
      List<FieldSchema> newCols = alterTbl.getNewCols();
3031
      List<FieldSchema> newCols = alterTbl.getNewCols();
3030
      List<FieldSchema> oldCols = tbl.getCols();
3032
      List<FieldSchema> oldCols = tbl.getCols();
3031
      if (tbl.getSerializationLib().equals(
3033
      if (tbl.getSerializationLib().equals(
3032
          "org.apache.hadoop.hive.serde.thrift.columnsetSerDe")) {
3034
          "org.apache.hadoop.hive.serde.thrift.columnsetSerDe")) {
[+20] [20] 1035 lines
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
Revision 1489269 New Change
 
http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
Revision 1489269 New Change
 
  1. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java: Loading...
  2. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java: Loading...
  3. http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g: Loading...