Review Board 1.7.22


HIVE-5614: Subquery support: allow subquery expressions in having clause

Review Request #15718 - Created Nov. 20, 2013 and submitted

Harish Butani
HIVE-5614
Reviewers
hive
ashutoshc
hive-git
support for subquery predicates in having clause. SubTask of HIVE-784
added new tests: subquery_in_having.q, subquery_notin_having.q, subquery_exists_having.q, subquery_notexists_having.q
ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java
Revision fa111cc New Change
[20] 66 lines
[+20] [+] public class QB {
67

    
   
67

   
68
  /*
68
  /*
69
   * If this QB represents a SubQuery predicate then this will point to the SubQuery object.
69
   * If this QB represents a SubQuery predicate then this will point to the SubQuery object.
70
   */
70
   */
71
  private QBSubQuery subQueryPredicateDef;
71
  private QBSubQuery subQueryPredicateDef;

    
   
72
  

    
   
73
	/*

    
   
74
	 * used to give a unique name to each SubQuery QB Currently there can be at

    
   
75
	 * most 2 SubQueries in a Query: 1 in the Where clause, and 1 in the Having

    
   
76
	 * clause.

    
   
77
	 */

    
   
78
	private int numSubQueryPredicates;

    
   
79
  
72

    
   
80

   
73
  // results
81
  // results
74

    
   
82

   
75
  public void print(String msg) {
83
  public void print(String msg) {
76
    LOG.info(msg + "alias=" + qbp.getAlias());
84
    LOG.info(msg + "alias=" + qbp.getAlias());
[+20] [20] 241 lines
[+20] [+] protected void setSubQueryDef(QBSubQuery subQueryPredicateDef) {
318
  }
326
  }
319

    
   
327

   
320
  protected QBSubQuery getSubQueryPredicateDef() {
328
  protected QBSubQuery getSubQueryPredicateDef() {
321
    return subQueryPredicateDef;
329
    return subQueryPredicateDef;
322
  }
330
  }

    
   
331
  

    
   
332
	protected int getNumSubQueryPredicates() {

    
   
333
		return numSubQueryPredicates;

    
   
334
	}

    
   
335

   

    
   
336
	protected int incrNumSubQueryPredicates() {

    
   
337
		return ++numSubQueryPredicates;

    
   
338
	}
323

    
   
339

   
324
}
340
}
ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java
Revision 3e8215d New Change
 
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
Revision 7979873 New Change
 
ql/src/test/queries/clientpositive/subquery_exists_having.q
New File
 
ql/src/test/queries/clientpositive/subquery_in_having.q
New File
 
ql/src/test/queries/clientpositive/subquery_notexists_having.q
New File
 
ql/src/test/queries/clientpositive/subquery_notin_having.q
New File
 
ql/src/test/results/clientpositive/subquery_exists_having.q.out
New File
 
ql/src/test/results/clientpositive/subquery_in_having.q.out
New File
 
ql/src/test/results/clientpositive/subquery_multiinsert.q.out
Revision 8dfb485 New Change
 
ql/src/test/results/clientpositive/subquery_notexists_having.q.out
New File
 
ql/src/test/results/clientpositive/subquery_notin_having.q.out
New File
 
  1. ql/src/java/org/apache/hadoop/hive/ql/parse/QB.java: Loading...
  2. ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java: Loading...
  4. ql/src/test/queries/clientpositive/subquery_exists_having.q: Loading...
  5. ql/src/test/queries/clientpositive/subquery_in_having.q: Loading...
  6. ql/src/test/queries/clientpositive/subquery_notexists_having.q: Loading...
  7. ql/src/test/queries/clientpositive/subquery_notin_having.q: Loading...
  8. ql/src/test/results/clientpositive/subquery_exists_having.q.out: Loading...
  9. ql/src/test/results/clientpositive/subquery_in_having.q.out: Loading...
  10. ql/src/test/results/clientpositive/subquery_multiinsert.q.out: Loading...
  11. ql/src/test/results/clientpositive/subquery_notexists_having.q.out: Loading...
  12. ql/src/test/results/clientpositive/subquery_notin_having.q.out: Loading...