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 2013/03/02 22:00:03 UTC
svn commit: r1451941 - in /hive/branches/ptf-windowing/ql/src:
java/org/apache/hadoop/hive/ql/parse/ test/queries/clientpositive/
test/results/clientnegative/ test/results/clientpositive/
Author: hashutosh
Date: Sat Mar 2 21:00:03 2013
New Revision: 1451941
URL: http://svn.apache.org/r1451941
Log:
HIVE-4073 : Make partition by optional in over clause (Brock Noland via Ashutosh Chauhan)
Added:
hive/branches/ptf-windowing/ql/src/test/queries/clientpositive/ptf_over_no_partition_by.q
hive/branches/ptf-windowing/ql/src/test/results/clientpositive/ptf_over_no_partition_by.q.out
Modified:
hive/branches/ptf-windowing/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_AggrFuncsWithNoGBYNoPartDef.q.out
hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_NoSortNoDistByClause.q.out
Modified: hive/branches/ptf-windowing/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/branches/ptf-windowing/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1451941&r1=1451940&r2=1451941&view=diff
==============================================================================
--- hive/branches/ptf-windowing/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/branches/ptf-windowing/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Sat Mar 2 21:00:03 2013
@@ -35,6 +35,7 @@ import java.util.TreeSet;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import org.antlr.runtime.CommonToken;
import org.antlr.runtime.tree.BaseTree;
import org.antlr.runtime.tree.Tree;
import org.antlr.runtime.tree.TreeWizard;
@@ -9885,7 +9886,7 @@ public class SemanticAnalyzer extends Ba
PartitionSpec pSpec = qSpec.getQueryPartitionSpec();
if ( pSpec == null ) {
throw new SemanticException(generateErrorMessage(node,
- "No partition specification associated with Windowing "));
+ "No partition specification associated with Windowing"));
}
}
@@ -10330,6 +10331,15 @@ public class SemanticAnalyzer extends Ba
ASTNode partNode = (ASTNode) node.getChild(partIdx);
PartitioningSpec partitioning = processPTFPartitionSpec(partNode);
ws.setPartitioning(partitioning);
+ } else if(node.getChildCount() == 0){
+ // no partition information was specified so partition by a constant
+ PartitioningSpec partitioningSpec = new PartitioningSpec();
+ PartitionSpec partitionSpec = new PartitionSpec();
+ PartitionExpression partExpr = new PartitionExpression();
+ partExpr.setExpression(new ASTNode(new CommonToken(HiveParser.Number, "0")));
+ partitionSpec.addExpression(partExpr);
+ partitioningSpec.setPartSpec(partitionSpec);
+ ws.setPartitioning(partitioningSpec);
}
if ( hasWF)
Added: hive/branches/ptf-windowing/ql/src/test/queries/clientpositive/ptf_over_no_partition_by.q
URL: http://svn.apache.org/viewvc/hive/branches/ptf-windowing/ql/src/test/queries/clientpositive/ptf_over_no_partition_by.q?rev=1451941&view=auto
==============================================================================
--- hive/branches/ptf-windowing/ql/src/test/queries/clientpositive/ptf_over_no_partition_by.q (added)
+++ hive/branches/ptf-windowing/ql/src/test/queries/clientpositive/ptf_over_no_partition_by.q Sat Mar 2 21:00:03 2013
@@ -0,0 +1,31 @@
+DROP TABLE part;
+
+-- data setup
+CREATE TABLE part(
+ p_partkey INT,
+ p_name STRING,
+ p_mfgr STRING,
+ p_brand STRING,
+ p_type STRING,
+ p_size INT,
+ p_container STRING,
+ p_retailprice DOUBLE,
+ p_comment STRING
+);
+
+LOAD DATA LOCAL INPATH '../data/files/part_tiny.txt' overwrite into table part;
+
+-- 1. single aggregate
+
+select p_name, p_retailprice,
+avg(p_retailprice) over()
+from part
+order by p_name;
+
+-- 2. multiple aggregates
+
+select p_name, p_retailprice,
+lead(p_retailprice) as l1 over(),
+lag(p_retailprice) as l2 over()
+from part
+order by p_name;
Modified: hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_AggrFuncsWithNoGBYNoPartDef.q.out
URL: http://svn.apache.org/viewvc/hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_AggrFuncsWithNoGBYNoPartDef.q.out?rev=1451941&r1=1451940&r2=1451941&view=diff
==============================================================================
--- hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_AggrFuncsWithNoGBYNoPartDef.q.out (original)
+++ hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_AggrFuncsWithNoGBYNoPartDef.q.out Sat Mar 2 21:00:03 2013
@@ -33,4 +33,4 @@ PREHOOK: Output: default@part
POSTHOOK: query: LOAD DATA LOCAL INPATH '../data/files/part_tiny.txt' overwrite into table part
POSTHOOK: type: LOAD
POSTHOOK: Output: default@part
-FAILED: SemanticException 6:5 No partition specification associated with Windowing . Error encountered near token 's1'
+FAILED: SemanticException 6:5 No partition specification associated with Windowing. Error encountered near token 's1'
Modified: hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_NoSortNoDistByClause.q.out
URL: http://svn.apache.org/viewvc/hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_NoSortNoDistByClause.q.out?rev=1451941&r1=1451940&r2=1451941&view=diff
==============================================================================
--- hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_NoSortNoDistByClause.q.out (original)
+++ hive/branches/ptf-windowing/ql/src/test/results/clientnegative/ptf_negative_NoSortNoDistByClause.q.out Sat Mar 2 21:00:03 2013
@@ -33,4 +33,4 @@ PREHOOK: Output: default@part
POSTHOOK: query: LOAD DATA LOCAL INPATH '../data/files/part_tiny.txt' overwrite into table part
POSTHOOK: type: LOAD
POSTHOOK: Output: default@part
-FAILED: SemanticException 6:5 No partition specification associated with Windowing . Error encountered near token '2'
+FAILED: SemanticException 6:5 No partition specification associated with Windowing. Error encountered near token '2'
Added: hive/branches/ptf-windowing/ql/src/test/results/clientpositive/ptf_over_no_partition_by.q.out
URL: http://svn.apache.org/viewvc/hive/branches/ptf-windowing/ql/src/test/results/clientpositive/ptf_over_no_partition_by.q.out?rev=1451941&view=auto
==============================================================================
--- hive/branches/ptf-windowing/ql/src/test/results/clientpositive/ptf_over_no_partition_by.q.out (added)
+++ hive/branches/ptf-windowing/ql/src/test/results/clientpositive/ptf_over_no_partition_by.q.out Sat Mar 2 21:00:03 2013
@@ -0,0 +1,127 @@
+PREHOOK: query: DROP TABLE part
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: DROP TABLE part
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: -- data setup
+CREATE TABLE part(
+ p_partkey INT,
+ p_name STRING,
+ p_mfgr STRING,
+ p_brand STRING,
+ p_type STRING,
+ p_size INT,
+ p_container STRING,
+ p_retailprice DOUBLE,
+ p_comment STRING
+)
+PREHOOK: type: CREATETABLE
+POSTHOOK: query: -- data setup
+CREATE TABLE part(
+ p_partkey INT,
+ p_name STRING,
+ p_mfgr STRING,
+ p_brand STRING,
+ p_type STRING,
+ p_size INT,
+ p_container STRING,
+ p_retailprice DOUBLE,
+ p_comment STRING
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: default@part
+PREHOOK: query: LOAD DATA LOCAL INPATH '../data/files/part_tiny.txt' overwrite into table part
+PREHOOK: type: LOAD
+PREHOOK: Output: default@part
+POSTHOOK: query: LOAD DATA LOCAL INPATH '../data/files/part_tiny.txt' overwrite into table part
+POSTHOOK: type: LOAD
+POSTHOOK: Output: default@part
+PREHOOK: query: -- 1. single aggregate
+
+select p_name, p_retailprice,
+avg(p_retailprice) over()
+from part
+order by p_name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+#### A masked pattern was here ####
+POSTHOOK: query: -- 1. single aggregate
+
+select p_name, p_retailprice,
+avg(p_retailprice) over()
+from part
+order by p_name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+#### A masked pattern was here ####
+almond antique blue firebrick mint 1789.69 1546.7784615384621
+almond antique burnished rose metallic 1173.15 1546.7784615384621
+almond antique burnished rose metallic 1173.15 1546.7784615384621
+almond antique chartreuse khaki white 1671.68 1546.7784615384621
+almond antique chartreuse lavender yellow 1753.76 1546.7784615384621
+almond antique forest lavender goldenrod 1190.27 1546.7784615384621
+almond antique gainsboro frosted violet 1620.67 1546.7784615384621
+almond antique medium spring khaki 1611.66 1546.7784615384621
+almond antique metallic orange dim 1410.39 1546.7784615384621
+almond antique misty red olive 1922.98 1546.7784615384621
+almond antique olive coral navajo 1337.29 1546.7784615384621
+almond antique salmon chartreuse burlywood 1602.59 1546.7784615384621
+almond antique sky peru orange 1788.73 1546.7784615384621
+almond antique violet chocolate turquoise 1690.68 1546.7784615384621
+almond antique violet mint lemon 1375.42 1546.7784615384621
+almond antique violet turquoise frosted 1800.7 1546.7784615384621
+almond aquamarine burnished black steel 1414.42 1546.7784615384621
+almond aquamarine dodger light gainsboro 1018.1 1546.7784615384621
+almond aquamarine floral ivory bisque 1206.26 1546.7784615384621
+almond aquamarine midnight light salmon 2031.98 1546.7784615384621
+almond aquamarine pink moccasin thistle 1632.66 1546.7784615384621
+almond aquamarine rose maroon antique 1698.66 1546.7784615384621
+almond aquamarine sandy cyan gainsboro 1701.6 1546.7784615384621
+almond aquamarine yellow dodger mint 1844.92 1546.7784615384621
+almond azure aquamarine papaya violet 1290.35 1546.7784615384621
+almond azure blanched chiffon midnight 1464.48 1546.7784615384621
+PREHOOK: query: -- 2. multiple aggregates
+
+select p_name, p_retailprice,
+lead(p_retailprice) as l1 over(),
+lag(p_retailprice) as l2 over()
+from part
+order by p_name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+#### A masked pattern was here ####
+POSTHOOK: query: -- 2. multiple aggregates
+
+select p_name, p_retailprice,
+lead(p_retailprice) as l1 over(),
+lag(p_retailprice) as l2 over()
+from part
+order by p_name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+#### A masked pattern was here ####
+almond antique blue firebrick mint 1789.69 1611.66 1290.35
+almond antique burnished rose metallic 1173.15 1753.76 1173.15
+almond antique burnished rose metallic 1173.15 1173.15 NULL
+almond antique chartreuse khaki white 1671.68 1190.27 1701.6
+almond antique chartreuse lavender yellow 1753.76 1602.59 1173.15
+almond antique forest lavender goldenrod 1190.27 1410.39 1671.68
+almond antique gainsboro frosted violet 1620.67 1375.42 1337.29
+almond antique medium spring khaki 1611.66 1788.73 1789.69
+almond antique metallic orange dim 1410.39 1922.98 1190.27
+almond antique misty red olive 1922.98 1337.29 1410.39
+almond antique olive coral navajo 1337.29 1620.67 1922.98
+almond antique salmon chartreuse burlywood 1602.59 1414.42 1753.76
+almond antique sky peru orange 1788.73 1018.1 1611.66
+almond antique violet chocolate turquoise 1690.68 1800.7 1632.66
+almond antique violet mint lemon 1375.42 1206.26 1620.67
+almond antique violet turquoise frosted 1800.7 2031.98 1690.68
+almond aquamarine burnished black steel 1414.42 1632.66 1602.59
+almond aquamarine dodger light gainsboro 1018.1 1464.48 1788.73
+almond aquamarine floral ivory bisque 1206.26 1844.92 1375.42
+almond aquamarine midnight light salmon 2031.98 1698.66 1800.7
+almond aquamarine pink moccasin thistle 1632.66 1690.68 1414.42
+almond aquamarine rose maroon antique 1698.66 1701.6 2031.98
+almond aquamarine sandy cyan gainsboro 1701.6 1671.68 1698.66
+almond aquamarine yellow dodger mint 1844.92 1290.35 1206.26
+almond azure aquamarine papaya violet 1290.35 1789.69 1844.92
+almond azure blanched chiffon midnight 1464.48 NULL 1018.1