You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/04/08 22:49:47 UTC
svn commit: r1672173 [4/8] - in /hive/branches/cbo: ./
cli/src/java/org/apache/hadoop/hive/cli/
cli/src/test/org/apache/hadoop/hive/cli/ common/
common/src/java/org/apache/hadoop/hive/common/jsonexplain/
common/src/java/org/apache/hadoop/hive/conf/ hca...
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowPartitionsDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowPartitionsDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowPartitionsDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowPartitionsDesc.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import java.util.Map;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* ShowPartitionsDesc.
*
*/
-@Explain(displayName = "Show Partitions")
+@Explain(displayName = "Show Partitions", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class ShowPartitionsDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
String tabName;
@@ -71,7 +73,7 @@ public class ShowPartitionsDesc extends
/**
* @return the name of the table.
*/
- @Explain(displayName = "table")
+ @Explain(displayName = "table", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getTabName() {
return tabName;
}
@@ -87,7 +89,7 @@ public class ShowPartitionsDesc extends
/**
* @return the name of the table.
*/
- @Explain(displayName = "partSpec")
+ @Explain(displayName = "partSpec", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public Map<String, String> getPartSpec() {
return partSpec;
}
@@ -102,7 +104,7 @@ public class ShowPartitionsDesc extends
/**
* @return the results file
*/
- @Explain(displayName = "result file", normalExplain = false)
+ @Explain(displayName = "result file", explainLevels = { Level.EXTENDED })
public String getResFile() {
return resFile;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTableStatusDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTableStatusDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTableStatusDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTableStatusDesc.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import java.util.HashMap;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* ShowTableStatusDesc.
*
*/
-@Explain(displayName = "Show Table Status")
+@Explain(displayName = "Show Table Status", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class ShowTableStatusDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
String pattern;
@@ -108,7 +110,7 @@ public class ShowTableStatusDesc extends
return resFile;
}
- @Explain(displayName = "result file", normalExplain = false)
+ @Explain(displayName = "result file", explainLevels = { Level.EXTENDED })
public String getResFileString() {
return getResFile();
}
@@ -124,7 +126,7 @@ public class ShowTableStatusDesc extends
/**
* @return the database name
*/
- @Explain(displayName = "database")
+ @Explain(displayName = "database", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getDbName() {
return dbName;
}
@@ -140,7 +142,7 @@ public class ShowTableStatusDesc extends
/**
* @return the partSpec
*/
- @Explain(displayName = "partition")
+ @Explain(displayName = "partition", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public HashMap<String, String> getPartSpec() {
return partSpec;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTablesDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTablesDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTablesDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTablesDesc.java Wed Apr 8 20:49:44 2015
@@ -21,12 +21,14 @@ package org.apache.hadoop.hive.ql.plan;
import java.io.Serializable;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* ShowTablesDesc.
*
*/
-@Explain(displayName = "Show Tables")
+@Explain(displayName = "Show Tables", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class ShowTablesDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
String pattern;
@@ -98,7 +100,7 @@ public class ShowTablesDesc extends DDLD
/**
* @return the resFile
*/
- @Explain(displayName = "result file", normalExplain = false)
+ @Explain(displayName = "result file", explainLevels = { Level.EXTENDED })
public String getResFile() {
return resFile;
}
@@ -114,7 +116,7 @@ public class ShowTablesDesc extends DDLD
/**
* @return the dbName
*/
- @Explain(displayName = "database name")
+ @Explain(displayName = "database name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getDbName() {
return dbName;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTblPropertiesDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTblPropertiesDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTblPropertiesDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTblPropertiesDesc.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import java.util.HashMap;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* ShowTblPropertiesDesc.
*
*/
-@Explain(displayName = "Show Table Properties")
+@Explain(displayName = "Show Table Properties", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class ShowTblPropertiesDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
String resFile;
@@ -77,7 +79,7 @@ public class ShowTblPropertiesDesc exten
return resFile;
}
- @Explain(displayName = "result file", normalExplain = false)
+ @Explain(displayName = "result file", explainLevels = { Level.EXTENDED })
public String getResFileString() {
return getResFile();
}
@@ -93,7 +95,7 @@ public class ShowTblPropertiesDesc exten
/**
* @return the tableName
*/
- @Explain(displayName = "table name")
+ @Explain(displayName = "table name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getTableName() {
return tableName;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/Statistics.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/Statistics.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/Statistics.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/Statistics.java Wed Apr 8 20:49:44 2015
@@ -22,6 +22,7 @@ import java.io.Serializable;
import java.util.List;
import java.util.Map;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
import org.apache.hadoop.hive.ql.stats.StatsUtils;
import com.google.common.collect.Lists;
@@ -101,7 +102,7 @@ public class Statistics implements Seria
}
@Override
- @Explain(displayName = "Statistics")
+ @Explain(displayName = "Statistics", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Num rows: ");
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsNoJobWork.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsNoJobWork.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsNoJobWork.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsNoJobWork.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.TableSpec;
import org.apache.hadoop.hive.ql.parse.PrunedPartitionList;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* Client-side stats aggregator task.
*/
-@Explain(displayName = "Stats-Aggr Operator")
+@Explain(displayName = "Stats-Aggr Operator", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class StatsNoJobWork implements Serializable {
private static final long serialVersionUID = 1L;
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsWork.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsWork.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsWork.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/StatsWork.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import org.apache.hadoop.hive.ql.exec.Task;
import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.TableSpec;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* ConditionalStats.
*
*/
-@Explain(displayName = "Stats-Aggr Operator")
+@Explain(displayName = "Stats-Aggr Operator", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class StatsWork implements Serializable {
private static final long serialVersionUID = 1L;
@@ -90,7 +92,7 @@ public class StatsWork implements Serial
aggKey = aggK;
}
- @Explain(displayName = "Stats Aggregation Key Prefix", normalExplain = false)
+ @Explain(displayName = "Stats Aggregation Key Prefix", explainLevels = { Level.EXTENDED })
public String getAggKey() {
return aggKey;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/SwitchDatabaseDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/SwitchDatabaseDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/SwitchDatabaseDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/SwitchDatabaseDesc.java Wed Apr 8 20:49:44 2015
@@ -19,12 +19,14 @@
package org.apache.hadoop.hive.ql.plan;
import java.io.Serializable;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* SwitchDatabaseDesc.
*
*/
-@Explain(displayName = "Switch Database")
+@Explain(displayName = "Switch Database", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class SwitchDatabaseDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
@@ -39,7 +41,7 @@ public class SwitchDatabaseDesc extends
this.databaseName = databaseName;
}
- @Explain(displayName = "name")
+ @Explain(displayName = "name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getDatabaseName() {
return databaseName;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableDesc.java Wed Apr 8 20:49:44 2015
@@ -28,6 +28,7 @@ import org.apache.hadoop.conf.Configurat
import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
import org.apache.hadoop.hive.ql.exec.Utilities;
import org.apache.hadoop.hive.ql.io.HiveFileFormatUtils;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.Deserializer;
import org.apache.hadoop.hive.serde2.SerDeUtils;
@@ -117,7 +118,7 @@ public class TableDesc implements Serial
return properties;
}
- @Explain(displayName = "properties", normalExplain = false)
+ @Explain(displayName = "properties", explainLevels = { Level.EXTENDED })
public Map getPropertiesExplain() {
return HiveStringUtils.getPropertiesExplain(getProperties());
}
@@ -130,7 +131,7 @@ public class TableDesc implements Serial
this.jobProperties = jobProperties;
}
- @Explain(displayName = "jobProperties", normalExplain = false)
+ @Explain(displayName = "jobProperties", explainLevels = { Level.EXTENDED })
public Map<String, String> getJobProperties() {
return jobProperties;
}
@@ -138,23 +139,23 @@ public class TableDesc implements Serial
/**
* @return the serdeClassName
*/
- @Explain(displayName = "serde")
+ @Explain(displayName = "serde", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getSerdeClassName() {
return properties.getProperty(serdeConstants.SERIALIZATION_LIB);
}
- @Explain(displayName = "name")
+ @Explain(displayName = "name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getTableName() {
return properties
.getProperty(hive_metastoreConstants.META_TABLE_NAME);
}
- @Explain(displayName = "input format")
+ @Explain(displayName = "input format", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getInputFileFormatClassName() {
return getInputFileFormatClass().getName();
}
- @Explain(displayName = "output format")
+ @Explain(displayName = "output format", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getOutputFileFormatClassName() {
return getOutputFileFormatClass().getName();
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableScanDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableScanDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableScanDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TableScanDesc.java Wed Apr 8 20:49:44 2015
@@ -27,13 +27,15 @@ import org.apache.hadoop.hive.ql.exec.PT
import org.apache.hadoop.hive.ql.metadata.Table;
import org.apache.hadoop.hive.ql.metadata.VirtualColumn;
import org.apache.hadoop.hive.ql.parse.TableSample;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* Table Scan Descriptor Currently, data is only read from a base source as part
* of map-reduce framework. So, nothing is stored in the descriptor. But, more
* things will be added here as table scan is invoked as part of local work.
**/
-@Explain(displayName = "TableScan")
+@Explain(displayName = "TableScan", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class TableScanDesc extends AbstractOperatorDesc {
private static final long serialVersionUID = 1L;
@@ -125,7 +127,7 @@ public class TableScanDesc extends Abstr
return new TableScanDesc(getAlias(), vcs, this.tableMetadata);
}
- @Explain(displayName = "alias")
+ @Explain(displayName = "alias", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getAlias() {
return alias;
}
@@ -193,7 +195,7 @@ public class TableScanDesc extends Abstr
this.gatherStats = gatherStats;
}
- @Explain(displayName = "GatherStats", normalExplain = false)
+ @Explain(displayName = "GatherStats", explainLevels = { Level.EXTENDED })
public boolean isGatherStats() {
return gatherStats;
}
@@ -218,7 +220,7 @@ public class TableScanDesc extends Abstr
statsAggKeyPrefix = k;
}
- @Explain(displayName = "Statistics Aggregation Key Prefix", normalExplain = false)
+ @Explain(displayName = "Statistics Aggregation Key Prefix", explainLevels = { Level.EXTENDED })
public String getStatsAggPrefix() {
return statsAggKeyPrefix;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java Wed Apr 8 20:49:44 2015
@@ -36,6 +36,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.ql.plan.TezEdgeProperty.EdgeType;
import org.apache.hadoop.mapred.JobConf;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* TezWork. This class encapsulates all the work objects that can be executed
@@ -44,7 +46,7 @@ import org.apache.hadoop.mapred.JobConf;
*
*/
@SuppressWarnings("serial")
-@Explain(displayName = "Tez")
+@Explain(displayName = "Tez", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class TezWork extends AbstractOperatorDesc {
public enum VertexType {
@@ -87,7 +89,7 @@ public class TezWork extends AbstractOpe
/**
* getWorkMap returns a map of "vertex name" to BaseWork
*/
- @Explain(displayName = "Vertices")
+ @Explain(displayName = "Vertices", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public Map<String, BaseWork> getWorkMap() {
Map<String, BaseWork> result = new LinkedHashMap<String, BaseWork>();
for (BaseWork w: getAllWork()) {
@@ -286,7 +288,7 @@ public class TezWork extends AbstractOpe
}
}
- @Explain(displayName = "Edges")
+ @Explain(displayName = "Edges", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public Map<String, List<Dependency>> getDependencyMap() {
Map<String, List<Dependency>> result = new LinkedHashMap<String, List<Dependency>>();
for (Map.Entry<BaseWork, List<BaseWork>> entry: invertedWorkGraph.entrySet()) {
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TruncateTableDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TruncateTableDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TruncateTableDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/TruncateTableDesc.java Wed Apr 8 20:49:44 2015
@@ -22,11 +22,13 @@ import java.util.List;
import java.util.Map;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* Truncates managed table or partition
*/
-@Explain(displayName = "Truncate Table or Partition")
+@Explain(displayName = "Truncate Table or Partition", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class TruncateTableDesc extends DDLDesc {
private static final long serialVersionUID = 1L;
@@ -46,7 +48,7 @@ public class TruncateTableDesc extends D
this.partSpec = partSpec;
}
- @Explain(displayName = "TableName")
+ @Explain(displayName = "TableName", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getTableName() {
return tableName;
}
@@ -55,7 +57,7 @@ public class TruncateTableDesc extends D
this.tableName = tableName;
}
- @Explain(displayName = "Partition Spec")
+ @Explain(displayName = "Partition Spec", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public Map<String, String> getPartSpec() {
return partSpec;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UDTFDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UDTFDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UDTFDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UDTFDesc.java Wed Apr 8 20:49:44 2015
@@ -19,6 +19,8 @@
package org.apache.hadoop.hive.ql.plan;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* All member variables should have a setters and getters of the form get<member
@@ -26,7 +28,7 @@ import org.apache.hadoop.hive.ql.udf.gen
* time.
*
*/
-@Explain(displayName = "UDTF Operator")
+@Explain(displayName = "UDTF Operator", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class UDTFDesc extends AbstractOperatorDesc {
private static final long serialVersionUID = 1L;
@@ -49,7 +51,7 @@ public class UDTFDesc extends AbstractOp
this.genericUDTF = genericUDTF;
}
- @Explain(displayName = "function name")
+ @Explain(displayName = "function name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getUDTFName() {
return genericUDTF.toString();
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionDesc.java Wed Apr 8 20:49:44 2015
@@ -17,13 +17,15 @@
*/
package org.apache.hadoop.hive.ql.plan;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* unionDesc is a empty class currently. However, union has more than one input
* (as compared with forward), and therefore, we need a separate class.
**/
-@Explain(displayName = "Union")
+@Explain(displayName = "Union", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class UnionDesc extends AbstractOperatorDesc {
private static final long serialVersionUID = 1L;
private transient int numInputs;
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionWork.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionWork.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionWork.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnionWork.java Wed Apr 8 20:49:44 2015
@@ -25,7 +25,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
+
import org.apache.hadoop.hive.ql.plan.BaseWork;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
import org.apache.hadoop.hive.ql.exec.Operator;
import org.apache.hadoop.hive.ql.exec.UnionOperator;
import org.apache.hadoop.mapred.JobConf;
@@ -47,8 +49,8 @@ public class UnionWork extends BaseWork
super(name);
}
- @Explain(displayName = "Vertex")
@Override
+ @Explain(displayName = "Vertex", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getName() {
return super.getName();
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockDatabaseDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockDatabaseDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockDatabaseDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockDatabaseDesc.java Wed Apr 8 20:49:44 2015
@@ -19,12 +19,14 @@
package org.apache.hadoop.hive.ql.plan;
import java.io.Serializable;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* UnlockDatabaseDesc.
*
*/
-@Explain(displayName = "Unlock Database")
+@Explain(displayName = "Unlock Database", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class UnlockDatabaseDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
@@ -34,7 +36,7 @@ public class UnlockDatabaseDesc extends
this.databaseName = databaseName;
}
- @Explain(displayName = "database")
+ @Explain(displayName = "database", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getDatabaseName() {
return databaseName;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockTableDesc.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockTableDesc.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockTableDesc.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/UnlockTableDesc.java Wed Apr 8 20:49:44 2015
@@ -22,12 +22,14 @@ import java.io.Serializable;
import java.util.Map;
import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
+
/**
* UnlockTableDesc.
*
*/
-@Explain(displayName = "Unlock Table")
+@Explain(displayName = "Unlock Table", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class UnlockTableDesc extends DDLDesc implements Serializable {
private static final long serialVersionUID = 1L;
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFExpressionDef.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFExpressionDef.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFExpressionDef.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFExpressionDef.java Wed Apr 8 20:49:44 2015
@@ -22,6 +22,7 @@ import org.apache.hadoop.hive.ql.exec.Ex
import org.apache.hadoop.hive.ql.exec.PTFUtils;
import org.apache.hadoop.hive.ql.plan.Explain;
import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
public class PTFExpressionDef {
@@ -59,7 +60,7 @@ public class PTFExpressionDef {
this.exprNode = exprNode;
}
- @Explain(displayName = "expr")
+ @Explain(displayName = "expr", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getExprNodeExplain() {
return exprNode == null ? null : exprNode.getExprString();
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFQueryInputDef.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFQueryInputDef.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFQueryInputDef.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PTFQueryInputDef.java Wed Apr 8 20:49:44 2015
@@ -20,13 +20,14 @@ package org.apache.hadoop.hive.ql.plan.p
import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec.PTFQueryInputType;
import org.apache.hadoop.hive.ql.plan.Explain;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
-@Explain(displayName = "Input definition")
+@Explain(displayName = "Input definition", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class PTFQueryInputDef extends PTFInputDef {
private String destination;
private PTFQueryInputType type;
- @Explain(displayName = "destination")
+ @Explain(displayName = "destination", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getDestination() {
return destination;
}
@@ -43,7 +44,7 @@ public class PTFQueryInputDef extends PT
this.type = type;
}
- @Explain(displayName = "type")
+ @Explain(displayName = "type", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getTypeExplain() {
return type.name();
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PartitionedTableFunctionDef.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PartitionedTableFunctionDef.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PartitionedTableFunctionDef.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/plan/ptf/PartitionedTableFunctionDef.java Wed Apr 8 20:49:44 2015
@@ -23,9 +23,10 @@ import java.util.List;
import org.apache.hadoop.hive.ql.parse.PTFInvocationSpec;
import org.apache.hadoop.hive.ql.plan.Explain;
+import org.apache.hadoop.hive.ql.plan.Explain.Level;
import org.apache.hadoop.hive.ql.udf.ptf.TableFunctionEvaluator;
-@Explain(displayName = "Partition table definition")
+@Explain(displayName = "Partition table definition", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public class PartitionedTableFunctionDef extends PTFInputDef {
private String name;
private String resolverClassName;
@@ -40,7 +41,7 @@ public class PartitionedTableFunctionDef
private transient List<String> referencedColumns;
- @Explain(displayName = "name")
+ @Explain(displayName = "name", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getName() {
return name;
}
@@ -83,7 +84,7 @@ public class PartitionedTableFunctionDef
return partition;
}
- @Explain(displayName = "partition by")
+ @Explain(displayName = "partition by", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getPartitionExplain() {
if (partition == null || partition.getExpressions() == null) {
return null;
@@ -110,7 +111,7 @@ public class PartitionedTableFunctionDef
this.order = order;
}
- @Explain(displayName = "order by")
+ @Explain(displayName = "order by", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getOrderExplain() {
if (order == null || order.getExpressions() == null) {
return null;
@@ -144,7 +145,7 @@ public class PartitionedTableFunctionDef
this.args = args;
}
- @Explain(displayName = "arguments")
+ @Explain(displayName = "arguments", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public String getArgsExplain() {
if (args == null) {
return null;
@@ -188,7 +189,7 @@ public class PartitionedTableFunctionDef
this.resolverClassName = resolverClassName;
}
- @Explain(displayName = "referenced columns")
+ @Explain(displayName = "referenced columns", explainLevels = { Level.USER, Level.DEFAULT, Level.EXTENDED })
public List<String> getReferencedColumns() {
return referencedColumns;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDayOfMonth.java Wed Apr 8 20:49:44 2015
@@ -29,6 +29,7 @@ import org.apache.hadoop.hive.ql.exec.ve
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFDayOfMonthLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFDayOfMonthString;
import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -38,9 +39,12 @@ import org.apache.hadoop.io.Text;
*
*/
@Description(name = "day,dayofmonth",
- value = "_FUNC_(date) - Returns the date of the month of date",
- extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or "
- + "'yyyy-MM-dd'.\n"
+ value = "_FUNC_(param) - Returns the day of the month of date/timestamp, or day component of interval",
+ extended = "param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'yyyy-MM-dd'.\n"
+ + "2. A date value\n"
+ + "3. A timestamp value\n"
+ + "4. A day-time interval value"
+ "Example:\n "
+ " > SELECT _FUNC_('2009-07-30') FROM src LIMIT 1;\n" + " 30")
@VectorizedExpressions({VectorUDFDayOfMonthLong.class, VectorUDFDayOfMonthString.class})
@@ -98,4 +102,12 @@ public class UDFDayOfMonth extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalDayTimeWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ result.set(i.getHiveIntervalDayTime().getDays());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFHour.java Wed Apr 8 20:49:44 2015
@@ -28,6 +28,7 @@ import org.apache.hadoop.hive.ql.exec.UD
import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFHourLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFHourString;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -37,9 +38,11 @@ import org.apache.hadoop.io.Text;
*
*/
@Description(name = "hour",
- value = "_FUNC_(date) - Returns the hour of date",
- extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or "
- + "'HH:mm:ss'.\n"
+ value = "_FUNC_(param) - Returns the hour componemnt of the string/timestamp/interval",
+ extended ="param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'HH:mm:ss'.\n"
+ + "2. A timestamp value\n"
+ + "3. A day-time interval value"
+ "Example:\n "
+ " > SELECT _FUNC_('2009-07-30 12:58:59') FROM src LIMIT 1;\n"
+ " 12\n"
@@ -95,4 +98,12 @@ public class UDFHour extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalDayTimeWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ result.set(i.getHiveIntervalDayTime().getHours());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMinute.java Wed Apr 8 20:49:44 2015
@@ -28,6 +28,7 @@ import org.apache.hadoop.hive.ql.exec.UD
import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFMinuteLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFMinuteString;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -37,9 +38,11 @@ import org.apache.hadoop.io.Text;
*
*/
@Description(name = "minute",
- value = "_FUNC_(date) - Returns the minute of date",
- extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or "
- + "'HH:mm:ss'.\n"
+ value = "_FUNC_(param) - Returns the minute component of the string/timestamp/interval",
+ extended = "param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'HH:mm:ss'.\n"
+ + "2. A timestamp value\n"
+ + "3. A day-time interval value"
+ "Example:\n "
+ " > SELECT _FUNC_('2009-07-30 12:58:59') FROM src LIMIT 1;\n"
+ " 58\n"
@@ -95,4 +98,12 @@ public class UDFMinute extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalDayTimeWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ result.set(i.getHiveIntervalDayTime().getMinutes());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFMonth.java Wed Apr 8 20:49:44 2015
@@ -29,6 +29,7 @@ import org.apache.hadoop.hive.ql.exec.ve
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFMonthLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFMonthString;
import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -38,8 +39,13 @@ import org.apache.hadoop.io.Text;
*
*/
@Description(name = "month",
- value = "_FUNC_(date) - Returns the month of date",
- extended = "Example:\n"
+ value = "_FUNC_(param) - Returns the month component of the date/timestamp/interval",
+ extended = "param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'yyyy-MM-dd'.\n"
+ + "2. A date value\n"
+ + "3. A timestamp value\n"
+ + "4. A year-month interval value"
+ + "Example:\n"
+ " > SELECT _FUNC_('2009-07-30') FROM src LIMIT 1;\n" + " 7")
@VectorizedExpressions({VectorUDFMonthLong.class, VectorUDFMonthString.class})
public class UDFMonth extends UDF {
@@ -94,4 +100,12 @@ public class UDFMonth extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalYearMonthWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ result.set(i.getHiveIntervalYearMonth().getMonths());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFSecond.java Wed Apr 8 20:49:44 2015
@@ -23,23 +23,29 @@ import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.hive.ql.exec.vector.VectorizedExpressions;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFSecondLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFSecondString;
+import org.apache.hadoop.hive.serde2.io.DoubleWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
+import org.apache.hive.common.util.DateUtils;
/**
* UDFSecond.
*
*/
@Description(name = "second",
- value = "_FUNC_(date) - Returns the second of date",
- extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or "
- + "'HH:mm:ss'.\n"
+ value = "_FUNC_(date) - Returns the second component of the string/timestamp/interval",
+ extended = "param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'HH:mm:ss'.\n"
+ + "2. A timestamp value\n"
+ + "3. A day-time interval value"
+ "Example:\n "
+ " > SELECT _FUNC_('2009-07-30 12:58:59') FROM src LIMIT 1;\n"
+ " 59\n"
@@ -96,4 +102,13 @@ public class UDFSecond extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalDayTimeWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ HiveIntervalDayTime idt = i.getHiveIntervalDayTime();
+ result.set(idt.getSeconds());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFYear.java Wed Apr 8 20:49:44 2015
@@ -29,6 +29,7 @@ import org.apache.hadoop.hive.ql.exec.ve
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFYearLong;
import org.apache.hadoop.hive.ql.exec.vector.expressions.VectorUDFYearString;
import org.apache.hadoop.hive.serde2.io.DateWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
@@ -38,9 +39,12 @@ import org.apache.hadoop.io.Text;
*
*/
@Description(name = "year",
- value = "_FUNC_(date) - Returns the year of date",
- extended = "date is a string in the format of 'yyyy-MM-dd HH:mm:ss' or "
- + "'yyyy-MM-dd'.\n"
+ value = "_FUNC_(param) - Returns the year component of the date/timestamp/interval",
+ extended = "param can be one of:\n"
+ + "1. A string in the format of 'yyyy-MM-dd HH:mm:ss' or 'yyyy-MM-dd'.\n"
+ + "2. A date value\n"
+ + "3. A timestamp value\n"
+ + "4. A year-month interval value"
+ "Example:\n "
+ " > SELECT _FUNC_('2009-07-30') FROM src LIMIT 1;\n" + " 2009")
@VectorizedExpressions({VectorUDFYearLong.class, VectorUDFYearString.class})
@@ -98,4 +102,12 @@ public class UDFYear extends UDF {
return result;
}
+ public IntWritable evaluate(HiveIntervalYearMonthWritable i) {
+ if (i == null) {
+ return null;
+ }
+
+ result.set(i.getHiveIntervalYearMonth().getYears());
+ return result;
+ }
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDF.java Wed Apr 8 20:49:44 2015
@@ -501,6 +501,10 @@ public abstract class GenericUDF impleme
return null;
}
Object writableValue = converters[i].convert(obj);
+ // if string can not be parsed converter will return null
+ if (writableValue == null) {
+ return null;
+ }
Timestamp ts = ((TimestampWritable) writableValue).getTimestamp();
return ts;
}
Modified: hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java (original)
+++ hive/branches/cbo/ql/src/java/org/apache/hadoop/hive/ql/udf/ptf/WindowingTableFunction.java Wed Apr 8 20:49:44 2015
@@ -20,10 +20,14 @@ package org.apache.hadoop.hive.ql.udf.pt
import java.util.AbstractList;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
@@ -60,10 +64,42 @@ import org.apache.hadoop.hive.serde2.obj
@SuppressWarnings("deprecation")
public class WindowingTableFunction extends TableFunctionEvaluator {
+ public static final Log LOG =LogFactory.getLog(WindowingTableFunction.class.getName());
+ static class WindowingFunctionInfoHelper {
+ private boolean supportsWindow;
+
+ WindowingFunctionInfoHelper() {
+ }
+
+ public WindowingFunctionInfoHelper(boolean supportsWindow) {
+ this.supportsWindow = supportsWindow;
+ }
+
+ public boolean isSupportsWindow() {
+ return supportsWindow;
+ }
+ public void setSupportsWindow(boolean supportsWindow) {
+ this.supportsWindow = supportsWindow;
+ }
+ }
StreamingState streamingState;
RankLimit rnkLimitDef;
+
+ // There is some information about the windowing functions that needs to be initialized
+ // during query compilation time, and made available to during the map/reduce tasks via
+ // plan serialization.
+ Map<String, WindowingFunctionInfoHelper> windowingFunctionHelpers = null;
+ public Map<String, WindowingFunctionInfoHelper> getWindowingFunctionHelpers() {
+ return windowingFunctionHelpers;
+ }
+
+ public void setWindowingFunctionHelpers(
+ Map<String, WindowingFunctionInfoHelper> windowingFunctionHelpers) {
+ this.windowingFunctionHelpers = windowingFunctionHelpers;
+ }
+
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void execute(PTFPartitionIterator<Object> pItr, PTFPartition outP) throws HiveException {
@@ -147,9 +183,8 @@ public class WindowingTableFunction exte
private boolean streamingPossible(Configuration cfg, WindowFunctionDef wFnDef)
throws HiveException {
WindowFrameDef wdwFrame = wFnDef.getWindowFrame();
- WindowFunctionInfo wFnInfo = FunctionRegistry.getWindowFunctionInfo(wFnDef
- .getName());
+ WindowingFunctionInfoHelper wFnInfo = getWindowingFunctionInfoHelper(wFnDef.getName());
if (!wFnInfo.isSupportsWindow()) {
return true;
}
@@ -259,6 +294,45 @@ public class WindowingTableFunction exte
return new int[] {precedingSpan, followingSpan};
}
+ private void initializeWindowingFunctionInfoHelpers() throws SemanticException {
+ // getWindowFunctionInfo() cannot be called during map/reduce tasks. So cache necessary
+ // values during query compilation, and rely on plan serialization to bring this info
+ // to the object during the map/reduce tasks.
+ if (windowingFunctionHelpers != null) {
+ return;
+ }
+
+ windowingFunctionHelpers = new HashMap<String, WindowingFunctionInfoHelper>();
+ WindowTableFunctionDef tabDef = (WindowTableFunctionDef) getTableDef();
+ for (int i = 0; i < tabDef.getWindowFunctions().size(); i++) {
+ WindowFunctionDef wFn = tabDef.getWindowFunctions().get(i);
+ GenericUDAFEvaluator fnEval = wFn.getWFnEval();
+ WindowFunctionInfo wFnInfo = FunctionRegistry.getWindowFunctionInfo(wFn.getName());
+ boolean supportsWindow = wFnInfo.isSupportsWindow();
+ windowingFunctionHelpers.put(wFn.getName(), new WindowingFunctionInfoHelper(supportsWindow));
+ }
+ }
+
+ @Override
+ protected void setOutputOI(StructObjectInspector outputOI) {
+ super.setOutputOI(outputOI);
+ // Call here because at this point the WindowTableFunctionDef has been set
+ try {
+ initializeWindowingFunctionInfoHelpers();
+ } catch (SemanticException err) {
+ throw new RuntimeException("Unexpected error while setting up windowing function", err);
+ }
+ }
+
+ private WindowingFunctionInfoHelper getWindowingFunctionInfoHelper(String fnName) {
+ WindowingFunctionInfoHelper wFnInfoHelper = windowingFunctionHelpers.get(fnName);
+ if (wFnInfoHelper == null) {
+ // Should not happen
+ throw new RuntimeException("No cached WindowingFunctionInfoHelper for " + fnName);
+ }
+ return wFnInfoHelper;
+ }
+
@Override
public void initializeStreaming(Configuration cfg,
StructObjectInspector inputOI, boolean isMapSide) throws HiveException {
@@ -412,8 +486,7 @@ public class WindowingTableFunction exte
if (fnEval instanceof ISupportStreamingModeForWindowing) {
fnEval.terminate(streamingState.aggBuffers[i]);
- WindowFunctionInfo wFnInfo = FunctionRegistry.getWindowFunctionInfo(wFn
- .getName());
+ WindowingFunctionInfoHelper wFnInfo = getWindowingFunctionInfoHelper(wFn.getName());
if (!wFnInfo.isSupportsWindow()) {
numRowsRemaining = ((ISupportStreamingModeForWindowing) fnEval)
.getRowsRemainingAfterTerminate();
Modified: hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java (original)
+++ hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/metadata/TestHive.java Wed Apr 8 20:49:44 2015
@@ -20,6 +20,7 @@ package org.apache.hadoop.hive.ql.metada
import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -28,7 +29,6 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
-import com.google.common.collect.ImmutableMap;
import junit.framework.TestCase;
import org.apache.hadoop.fs.FileStatus;
@@ -56,7 +56,14 @@ import org.apache.hadoop.mapred.Sequence
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
import org.apache.hadoop.mapred.TextInputFormat;
import org.apache.hadoop.util.StringUtils;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.apache.log4j.WriterAppender;
import org.apache.thrift.protocol.TBinaryProtocol;
+import org.junit.Assert;
+
+import com.google.common.collect.ImmutableMap;
/**
* TestHive.
@@ -234,6 +241,46 @@ public class TestHive extends TestCase {
}
}
+
+ /**
+ * Test logging of timing for metastore api calls
+ *
+ * @throws Throwable
+ */
+ public void testMetaStoreApiTiming() throws Throwable {
+ // set log level to DEBUG, as this is logged at debug level
+ Logger logger = Logger.getLogger("hive.ql.metadata.Hive");
+ Level origLevel = logger.getLevel();
+ logger.setLevel(Level.DEBUG);
+
+ // create an appender to capture the logs in a string
+ StringWriter writer = new StringWriter();
+ WriterAppender appender = new WriterAppender(new PatternLayout(), writer);
+
+ try {
+ logger.addAppender(appender);
+
+ hm.clearMetaCallTiming();
+ hm.getAllDatabases();
+ hm.dumpAndClearMetaCallTiming("test");
+ String logStr = writer.toString();
+ String expectedString = "getAllDatabases_()=";
+ Assert.assertTrue(logStr + " should contain <" + expectedString,
+ logStr.contains(expectedString));
+
+ // reset the log buffer, verify new dump without any api call does not contain func
+ writer.getBuffer().setLength(0);
+ hm.dumpAndClearMetaCallTiming("test");
+ logStr = writer.toString();
+ Assert.assertFalse(logStr + " should not contain <" + expectedString,
+ logStr.contains(expectedString));
+
+ } finally {
+ logger.setLevel(origLevel);
+ logger.removeAppender(appender);
+ }
+ }
+
/**
* Gets a table from the metastore and compares it to the original Table
*
Modified: hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/parse/TestUpdateDeleteSemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/parse/TestUpdateDeleteSemanticAnalyzer.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/parse/TestUpdateDeleteSemanticAnalyzer.java (original)
+++ hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/parse/TestUpdateDeleteSemanticAnalyzer.java Wed Apr 8 20:49:44 2015
@@ -297,7 +297,7 @@ public class TestUpdateDeleteSemanticAna
fs.create(tmp);
fs.deleteOnExit(tmp);
ExplainWork work = new ExplainWork(tmp, sem.getParseContext(), sem.getRootTasks(),
- sem.getFetchTask(), astStringTree, sem, true, false, false, false, false);
+ sem.getFetchTask(), astStringTree, sem, true, false, false, false, false, false, null);
ExplainTask task = new ExplainTask();
task.setWork(work);
task.initialize(conf, plan, null);
Modified: hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLastDay.java
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLastDay.java?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLastDay.java (original)
+++ hive/branches/cbo/ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFLastDay.java Wed Apr 8 20:49:44 2015
@@ -17,16 +17,18 @@
*/
package org.apache.hadoop.hive.ql.udf.generic;
+import java.sql.Timestamp;
+
+import junit.framework.TestCase;
+
import org.apache.hadoop.hive.ql.metadata.HiveException;
-import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredJavaObject;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject;
+import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.io.Text;
-import junit.framework.TestCase;
-
public class TestGenericUDFLastDay extends TestCase {
public void testLastDay() throws HiveException {
@@ -65,6 +67,31 @@ public class TestGenericUDFLastDay exten
runAndVerify("2014-01-32 10:30:45", "2014-02-28", udf);
runAndVerify("01/14/2014 10:30:45", null, udf);
runAndVerify("2016-02-28T10:30:45", "2016-02-29", udf);
+ // negative Unix time
+ runAndVerifyTs("1966-01-31 00:00:01", "1966-01-31", udf);
+ runAndVerifyTs("1966-01-31 10:00:01", "1966-01-31", udf);
+ runAndVerifyTs("1966-01-31 23:59:59", "1966-01-31", udf);
+ }
+
+ public void testLastDayTs() throws HiveException {
+ GenericUDFLastDay udf = new GenericUDFLastDay();
+ ObjectInspector valueOI0 = PrimitiveObjectInspectorFactory.writableTimestampObjectInspector;
+ ObjectInspector[] arguments = { valueOI0 };
+
+ udf.initialize(arguments);
+ // positive Unix time
+ runAndVerifyTs("2014-01-01 10:30:45", "2014-01-31", udf);
+ runAndVerifyTs("2014-01-14 10:30:45", "2014-01-31", udf);
+ runAndVerifyTs("2014-01-31 10:30:45.1", "2014-01-31", udf);
+ runAndVerifyTs("2014-02-02 10:30:45.100", "2014-02-28", udf);
+ runAndVerifyTs("2014-02-28 10:30:45.001", "2014-02-28", udf);
+ runAndVerifyTs("2016-02-03 10:30:45.000000001", "2016-02-29", udf);
+ runAndVerifyTs("2016-02-28 10:30:45", "2016-02-29", udf);
+ runAndVerifyTs("2016-02-29 10:30:45", "2016-02-29", udf);
+ // negative Unix time
+ runAndVerifyTs("1966-01-31 00:00:01", "1966-01-31", udf);
+ runAndVerifyTs("1966-01-31 10:00:01", "1966-01-31", udf);
+ runAndVerifyTs("1966-01-31 23:59:59", "1966-01-31", udf);
}
private void runAndVerify(String str, String expResult, GenericUDF udf)
@@ -73,5 +100,13 @@ public class TestGenericUDFLastDay exten
DeferredObject[] args = { valueObj0 };
Text output = (Text) udf.evaluate(args);
assertEquals("last_day() test ", expResult, output != null ? output.toString() : null);
+ }
+
+ private void runAndVerifyTs(String str, String expResult, GenericUDF udf) throws HiveException {
+ DeferredObject valueObj0 = new DeferredJavaObject(str != null ? new TimestampWritable(
+ Timestamp.valueOf(str)) : null);
+ DeferredObject[] args = { valueObj0 };
+ Text output = (Text) udf.evaluate(args);
+ assertEquals("last_day() test ", expResult, output != null ? output.toString() : null);
}
}
Modified: hive/branches/cbo/ql/src/test/results/clientpositive/interval_arithmetic.q.out
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/clientpositive/interval_arithmetic.q.out?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/test/results/clientpositive/interval_arithmetic.q.out (original)
+++ hive/branches/cbo/ql/src/test/results/clientpositive/interval_arithmetic.q.out Wed Apr 8 20:49:44 2015
@@ -102,7 +102,7 @@ limit 2
POSTHOOK: type: QUERY
POSTHOOK: Input: default@interval_arithmetic_1
#### A masked pattern was here ####
-1970-01-01 1967-11-01 1972-03-01 1972-03-01 1967-11-01 1967-11-01 1972-03-01
+1969-12-31 1967-10-31 1972-02-29 1972-02-29 1967-10-31 1967-10-31 1972-02-29
NULL NULL NULL NULL NULL NULL NULL
PREHOOK: query: explain
select
@@ -174,7 +174,7 @@ limit 2
POSTHOOK: type: QUERY
POSTHOOK: Input: default@interval_arithmetic_1
#### A masked pattern was here ####
-1970-01-01 -10748 23:00:00.000000000 10748 23:00:00.000000000 0 00:00:00.000000000
+1969-12-31 -10749 23:00:00.000000000 10749 23:00:00.000000000 0 00:00:00.000000000
NULL NULL NULL NULL
PREHOOK: query: explain
select
@@ -396,7 +396,7 @@ limit 2
POSTHOOK: type: QUERY
POSTHOOK: Input: default@interval_arithmetic_1
#### A masked pattern was here ####
-1970-01-01 1969-09-23 13:37:26.876543211 1970-04-10 11:22:33.123456789 1970-04-10 11:22:33.123456789 1969-09-23 13:37:26.876543211 1969-09-23 13:37:26.876543211 1970-04-10 11:22:33.123456789
+1969-12-31 1969-09-22 13:37:26.876543211 1970-04-09 11:22:33.123456789 1970-04-09 11:22:33.123456789 1969-09-22 13:37:26.876543211 1969-09-22 13:37:26.876543211 1970-04-09 11:22:33.123456789
NULL NULL NULL NULL NULL NULL NULL
PREHOOK: query: explain
select
@@ -472,7 +472,7 @@ limit 2
POSTHOOK: type: QUERY
POSTHOOK: Input: default@interval_arithmetic_1
#### A masked pattern was here ####
-1970-01-01 1969-12-31 15:59:46.674 0 08:00:12.326000000 -0 08:00:12.326000000 0 00:00:00.000000000
+1969-12-31 1969-12-31 15:59:46.674 -0 15:59:47.674000000 0 15:59:47.674000000 0 00:00:00.000000000
NULL NULL NULL NULL NULL
PREHOOK: query: explain
select
Modified: hive/branches/cbo/ql/src/test/results/clientpositive/show_functions.q.out
URL: http://svn.apache.org/viewvc/hive/branches/cbo/ql/src/test/results/clientpositive/show_functions.q.out?rev=1672173&r1=1672172&r2=1672173&view=diff
==============================================================================
--- hive/branches/cbo/ql/src/test/results/clientpositive/show_functions.q.out (original)
+++ hive/branches/cbo/ql/src/test/results/clientpositive/show_functions.q.out Wed Apr 8 20:49:44 2015
@@ -125,6 +125,7 @@ max
min
minute
month
+months_between
named_struct
negative
next_day
@@ -326,6 +327,7 @@ max
min
minute
month
+months_between
xpath
xpath_boolean
xpath_double