Fix redundant eval and hash on HashTable::Insert. Fixed HT build timer.

Change-Id: I855f714e2545aa7a77284996d54dcd743e52f974
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4263
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>
Handle analytic functions in subqueries

With this commit we add proper checks to examine if a subquery
containing an analytic function is eligible for rewrite by transforming
it into a join.

Change-Id: Icf87c3040cf83ca0676d292ce81ea2c3e03cf7b3
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4277
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
IMPALA-1220: NPE in AnalyticWindow during cloning and thrift serialization

Change-Id: Id2d7aa1542a186da941b8c0b723ff5698243f5cd
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4278
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
Codegen PartitionedHashJoinNode

This also reverts back to using CRC hash since FNV is not codegen'd
yet. The perf is not as good as the original HJ in a microbenchmark; I
haven't run a cluster run yet.

Change-Id: Ie4dc983f31631fbc78720425a0e354dd1d3342a6
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4219
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
IMPALA-1186: Use verbose explain level in the query profile.

The fix for IMPALA-921 had broken our existing behavior because it set
a default value for the explain_level query option in the .thrift file.
This patch now forces a verbose explain level in the query profile for
all non-explain statements.

Change-Id: I7b0f6a73ab85bdcd8b70f08115f5b2c4238e5993
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4236
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
IMPALA-1212 Accept subquery as LHS or RHS of between operator

This commit fixes the issue where an error was thrown if a subquery was
used in either side of a between predicate. Between predicates with
subqueries are replaced by their corresponding compound predicates
during query rewrite.

Change-Id: I4315a6e91c9306c6817bf6aa6bc1d0b586a1a067
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4246
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
PA: Update hash table to allocate memory from the block mgr.

Change-Id: I1e34120fbd55a06db839ce54b3ec147badcdeab1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4243
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>
Wrapping up planning of analytic functions.

This patch adds support for:
- analytic functions in inline views
- analytic functions referencing inline views
- analytic functions in unions
- analytic functions in subqueries/joins
- avoid generating plan for non-materialized analytic exprs
- predicate assignment and propagation onto and through
  analytic eval nodes

Change-Id: I195d32606af670f216b88e1145177fd1d66456eb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4173
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Renaming counter_update() to more intuitive counter_add()

Change-Id: I57b6e74ecca7f0f89d0e974a8af229627c638e48
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4217
Reviewed-by: Ippokratis Pandis <ipandis@cloudera.com>
Tested-by: jenkins
Remove stray ImpalaServer::CreateDataSink() declaration.

The definition doesn't exist. The real one is DataSink::CreateDataSink.

Change-Id: I1f2174ff66e2196b363658eb36ed0eb78f8462a5
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4310
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Reviewed-by: Henry Robinson <henry@cloudera.com>
Tested-by: jenkins
Set canonical window/ordering/function when analyzing an AnalyticExpr.

Change-Id: I8f3cef32cbf67bd96abca02cd79468c2c30e6f48
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4218
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
CHAR: adding support for CHAR(N)

Support for CHAR is implemented as a StringVal in the backend.

TODO:
  1. Parquet Reader/writer
  2. Codegen slot ref
  3. Codegen text reader
  4. Don't inline large chars
  5. update impala-hs2-server.cc with CHAR support

Change-Id: Ibba2c89cea971cb740001ea7975bf3e929150471
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4075
Reviewed-by: Nong Li <nong@cloudera.com>
Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com>
Tested-by: jenkins
Fix a few bugs in the AnalyticEvalNode

IMPALA-1233: Crash running query with analytic in WITH clause
IMPALA-1232: Analytic eval node crashes if cancelling query before Open()

Change-Id: I9a263775b8ef670d0f819ed53d0af1eb96edf5c7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4313
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Add SHOW ANALYTIC FUNCTIONS and additional analysis checks.

Change-Id: Ic1aac60fb9b094349b9cfbec68608ac50fc5660c
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4298
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Fix and add spilling test.

More tests coming.

Change-Id: I09e98adb6b011575572051eff1cd52e7be689fe8
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4311
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
Add agg fns for remaining analytic ranking fns

Adds agg fns for FIRST_VALUE, LAST_VALUE, LAG, LEAD. Also adds
support for ROWS windows with the end bound as unbounded following
as long as the start bound is unbounded preceding.

Change-Id: I4856ae580164d17a1bbf7d45010b61f5afa5db50
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4249
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Switch to using FNV hash. Crc doesn't work with different seeds.

Change-Id: Id74d7e84bd82d5d882d07195b6292c1a1d352005
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4302
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
[CDH5] Merge conflict from COUNTER_UPDATE rename.

Change-Id: Ic6727c74564589804bb02912d44c241cc737cd8a