You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by kh...@apache.org on 2014/08/25 23:54:56 UTC
svn commit: r1620471 -
/hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
Author: khorgath
Date: Mon Aug 25 21:54:56 2014
New Revision: 1620471
URL: http://svn.apache.org/r1620471
Log:
HIVE-7770 : Undo backward-incompatible behaviour change introduced by HIVE-7341 (Mithun Radhakrishnan via Sushanth Sowmyan)
Modified:
hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
Modified: hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java
URL: http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java?rev=1620471&r1=1620470&r2=1620471&view=diff
==============================================================================
--- hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java (original)
+++ hive/trunk/hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatPartition.java Mon Aug 25 21:54:56 2014
@@ -51,6 +51,7 @@ public class HCatPartition {
private int createTime;
private int lastAccessTime;
private StorageDescriptor sd;
+ private List<HCatFieldSchema> columns; // Cache column-list from this.sd.
private Map<String, String> parameters;
// For use from within HCatClient.getPartitions().
@@ -68,6 +69,7 @@ public class HCatPartition {
}
this.sd = partition.getSd();
+ this.columns = getColumns(this.sd);
}
// For constructing HCatPartitions afresh, as an argument to HCatClient.addPartitions().
@@ -77,6 +79,7 @@ public class HCatPartition {
this.dbName = hcatTable.getDbName();
this.sd = new StorageDescriptor(hcatTable.getSd());
this.sd.setLocation(location);
+ this.columns = getColumns(this.sd);
this.createTime = (int)(System.currentTimeMillis()/1000);
this.lastAccessTime = -1;
this.values = new ArrayList<String>(hcatTable.getPartCols().size());
@@ -98,7 +101,7 @@ public class HCatPartition {
this.dbName = rhs.dbName;
this.sd = new StorageDescriptor(rhs.sd);
this.sd.setLocation(location);
-
+ this.columns = getColumns(this.sd);
this.createTime = (int) (System.currentTimeMillis() / 1000);
this.lastAccessTime = -1;
this.values = new ArrayList<String>(hcatTable.getPartCols().size());
@@ -112,6 +115,14 @@ public class HCatPartition {
}
}
+ private static List<HCatFieldSchema> getColumns(StorageDescriptor sd) throws HCatException {
+ ArrayList<HCatFieldSchema> columns = new ArrayList<HCatFieldSchema>(sd.getColsSize());
+ for (FieldSchema fieldSchema : sd.getCols()) {
+ columns.add(HCatSchemaUtils.getHCatFieldSchema(fieldSchema));
+ }
+ return columns;
+ }
+
// For use from HCatClient.addPartitions(), to construct from user-input.
Partition toHivePartition() throws HCatException {
Partition hivePtn = new Partition();
@@ -172,11 +183,7 @@ public class HCatPartition {
*
* @return the columns
*/
- public List<HCatFieldSchema> getColumns() throws HCatException {
- ArrayList<HCatFieldSchema> columns = new ArrayList<HCatFieldSchema>(sd.getColsSize());
- for (FieldSchema fieldSchema : sd.getCols()) {
- columns.add(HCatSchemaUtils.getHCatFieldSchema(fieldSchema));
- }
+ public List<HCatFieldSchema> getColumns() {
return columns;
}