Standardize EXTRACT and add DATE_PART

The standard EXTRACT syntax is EXTRACT(<TIME UNIT> FROM <TIMESTAMP>) but
it was implemented as a regular function EXTRACT(<STRING>, <TIMESTAMP>).
The existing function will continue to be supported. We could deprecate
it but it doesn't seem like much of a burden to keep.

Adding DATE_PART is easy since it is functionally the same as the EXTRACT
function. The only difference is in the call signature. Besides the
difference in name, the arguments are reversed. Otherwise the two
functions are equivalent.

Change-Id: Ia6f9156624ed901723672469f94205c704839248
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4579
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Initialize block mgr limit based on the query limit, not current consumption.

This was always the intent and the code is wrong. The process mem tracker
is what is responsible for coordinating across queries.

We see this cause failures in the perf runs when we start up the next query
right after the current one finishes. This happens before the current one
has cleaned up, causing the new query to run with very little memory.

Change-Id: I1e25e55959c14c58789eaa38a122470e14761767
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4769
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
Add targted-perf query that makes local expr allocations

Change-Id: Ida40481cb429227058d78c619820de23f5c4a15e
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4772
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
IMPALA-1351: Update NAAJ stream to use io sized buffers and better error handling.

Since we only make one NULL-aware stream per NAAJ (as opposed to one per partition),
we do not care about the memory footprint on this tuple stream. For simplicity,
this will always use io-sized buffers.
Also, improving error handling in PHJ::ProcessProbeBatch(), as status_ was not being
set properly.

Disabling the regression test for this bug, as it takes too long to run. Need to find
a simpler query.

Change-Id: I7572f607199f38b1bc30ae208ece2832522342a1
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4770
Reviewed-by: Ippokratis Pandis <ipandis@cloudera.com>
Tested-by: jenkins
IMPALA-1353: Enforce slot equivalences for inline-view tuples.

Correct elimination of redundant join predicates relies on slot
equivalences being enforced at the lowest possible plan node
possibly by generating new predicates. Previously, we only
enforced such equivalences at scan and aggregation nodes which
is insufficient, explained as follows. Equivalences between
slots of an inline view may not be correctly enforced in the
scans/aggs of the inline-view plan if those inline-view slots
point to complex expressions in the underlying view stmt.
We currently cannot reason about equivalences of complex
expressions. As a result, it is possible that inline-view slots
are known to be equivalent but the underlying expressions are
thought to be non-equivalent.

This patch adds enforcement of equivalent inline-view slots
by generating new predicates that are migrated into the
inline-view plan. This way, our existing expression substitution
logic can be used to indirectly reason about the equivalences
of complex expressions that are part of an inline view.

Change-Id: Id38115c90e2c47d65463380a6f8cb1d0f21134b7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4755
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
IMPALA-1358: fix free buffers check in IO mgr

Change-Id: Iedd61bfc81018e36bfbe47f14c576dde1c1d4c11
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4783
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: jenkins
IMPALA-1102: Clean up and fix removal of redundant join predicates.

Correct elimination of redundant join predicates relies on slot
equivalences being enforced at the lowest possible plan node
possibly by generating new predicates. Previously, we only
enforced such equivalences at scan and aggregation nodes which
is insufficient because join materialize a new tuple combination
which may also require construction of new predicates to establish
known slot equivalences.

This patch generalies the existing helper function for constructing
the minimum spanning tree to cover known slot equivalences for each
equivalence class. The function is intended to be called during
bottom-up plan generation at nodes that change the tuple composition
(scans, joins, aggs, etc.)

Change-Id: I73880310553c63296486b2f77a51618738005167
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4781
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins