FIRST_VALUE with row offsets preceding did not produce the correct
results. This fix changes the rewrite for FIRST_VALUE and adds
additional handling for NULLs in the backend.
Change-Id: I03d54c05f63f46e9adb467008fa876ab33812c7b
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4648
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Fixes test failures in exhaustive mode when aggregation tests
are run on table formats that do not support decimal.
Change-Id: Ic5dfb398575770cf318ffcc0ce3a20737bb2f5cd
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4636
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: jenkins
If an error occurred loading a library in LibCache (e.g. by using
CREATE FUNCTION) an error is returned but a cache entry may still
exist which may result in strange errors later when the cache
entry is accessed by subsequent queries.
This changes LibCache::GetCacheEntry to ensure cache entries do
not exist if errors occur. Because GetCacheEntry needs to take
the global lock and then the cache entry lock, but needs to
unlock the global lock before performing slow HDFS operations,
we set the error status on the cache entry so that all locks
can be released when an error occurs. Other threads that attempt
to access the cache entry check the status and return if it is
not OK. The first thread (the thread that got the error) can
then remove the cache entry whenever it is able to again acquire
the global lock_.
Change-Id: I00fd0e2a4611b06fa72ffe0aaaa7d077b7a0c36e
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4642
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
Adding a bitstring at the head of each block in the TupleStream that indicates which
tuples of the appended rows in the block are NULLs. When reading the stream, through
GetNext() or GetTupleRow() calls, the NULL tuples are stitched back to their correct
position.
This fixes crashes in PHJ of bushy plans with NULLs on the build side(s) as well as
similar crashes in PAGG and the analytic node.
For example, it fixes IMPALA-1204, IMPALA-1223, and IMPALA-1249.
Also, adds regression tests for IMPALA-1175, IMPALA-1204, IMPALA-1223, IMPALA-1249
and IMPALA-1306.
Change-Id: I30ad0dbd4dfeabcda8fae444d1c6ec9291f38398
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4596
Reviewed-by: Ippokratis Pandis <ipandis@cloudera.com>
Tested-by: jenkins
With this commit we enable correlated and uncorrelated EXISTS
subqueries with grouping and/or aggregation including analytic
functions. Furthermore, we enable correlated EXISTS subqueries
with a LIMIT clause.
Change-Id: I36c33f80b152b7f175bf803cbe920ce1983d7162
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4583
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
Avro and Sequence writers are only available if query option
ALLOW_UNSUPPORTED_FORMATS is set to true, prints an error otherwise.
Change-Id: I597039f7c68f708fda10f848531eb557d6910f92
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4539
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: jenkins
This adds DECODE functionality into the existing CaseExpr class. There
will be no separate backend impementation for DECODE, it will be sent to
the backend as a CASE expr so the existing codegen function can be used.
Because Oracle does cast checking during execution and Impala cast
checking during analysis, some uses of DECODE that are valid in Oracle
are invalid in Impala.
Ex:
SELECT DECODE(foo, bar, int_col, baz, string_col_containing_only_ints)
FROM ...
would be run on Oracle. If string_col_containing_only_ints actually
contained non-INTs, an error would be thrown during execution and no
results would be returned. In Impala an error is thrown during analysis.
If a CAST was added to the STRING column, a cast failure would result in
NULL.
Change-Id: Ia08cc2389abb6f843bba117e7091c659ad25ff41
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4334
Tested-by: jenkins
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Casey Ching <casey@cloudera.com>
This was always a TODO. We want memory to come from the block mgr and trigger spilling.
Change-Id: I07f1f79fbbb33068fb2df64510a80a9b008ef73d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4466
Tested-by: jenkins
Reviewed-by: Nong Li <nong@cloudera.com>
expr is in both sides of binary predicate
This commit fixes the issue where an invalid rewrite is performed for
scalar uncorrelated subqueries that participated in a binary predicate
in which columns from the outer query block appear in both sides. We fix
this issue by rewritting the subquery using a cross join and placing
binary predicate in the outer's WHERE clause.
Change-Id: Ic5234bd2ee704d5ddead9217a636259e694e3eda
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4512
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Adds fixes and tests for Hive CHAR & VARCHAR compatibility.
Also fixes a bug in tuple materialization for VARCHAR and non in-lined CHAR.
Change-Id: I400b089cb8ddba2e264ef9f2e37956b2ceaaf9fb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4054
Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com>
Tested-by: jenkins
The AnalyticEvalNode had a DCHECK that expected the buffered tuple to
only be set when it was needed (i.e. when there are partition exprs or
order by exprs). However, the FE creates a buffered tuple for an entire
sort group when any AnalyticEvalNodes in the sort group need it and that
tuple is set for all nodes. This reverses the logic so that we DCHECK
the buffered tuple is set when it is needed.
Change-Id: If54b303bc439f235da06a542b46a35c61da9e1bd
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4489
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: jenkins
NULL
This commit fixes a bug in the implementation of the null-aware anti
join that resulted in wrong results being returned from NOT IN correlated
subqueries in the presence of nulls.
Change-Id: I6f2eb326ec7e40d80ec8da94ba33946b9ac9b115
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4506
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
Added several tests for analytical functions
Tests for the following have not been added because it's not implemented yet:
- Lag, Lead functions
- Window clauses
Change-Id: I34546c967a6d29c97327f4cba405006a50867dcb
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4307
Reviewed-by: Taras Bobrovytsky <tbobrovytsky@cloudera.com>
Tested-by: jenkins
The bug: When gathering join predicates, we eliminate redundant ones based on
equivalence classes. However, predicates that reference an outer-joined tuple cannot
be safely removed even if the corresponding equivalence class is already covered by
another predicate because such predicates could imply 'slot IS NOT NULL' and removing
them would allow NULL tuples from outer joins to be incorrectly returned.
The fix: Retain otherwise redundant predicates if they reference a slot of an
outer-joined tuple to maintain that the output of a join satisfies 'slot IS NOT NULL'
(otherwise NULL tuples from preceding outer joins could incorrectly survive).
For each outer-joined slot we only need to retain a single predicate.
TODO: Consider better fixes for outer-joined slots: (1) Create IS NOT NULL
predicates and place them at the lowest possible plan node. (2) Convert outer
joins into inner joins (or full outer joins into left/right outer joins).
Change-Id: Ie4dc20c1db3f3822d4b60e5dfbc00c024a1d3db7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4485
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
outer query
This commit fixes a bug with marking propagated predicates as assigned
during slot materialization. When gathering predicates for the purpose
of slot materialization, no predicates should be marked as assigned.
Change-Id: I5277dc622990b1731db1ecb3ea646e7b72d4e3db
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4496
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: jenkins
Fixes:
IMPALA-1256: Nested analytic: AnalysisException: select list expression not produced by aggregation output
IMPALA-1280: Crash running analytic with LEFT SEMI JOIN
Change-Id: I98b8f90de0079afad5b2d547abc27bcee57651f3
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4500
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
It appears that HBase sometimes ignores an admin.splitRegion() RPC,
which made our region splitting fail. As a workaround, this patch adds
another retry loop such that the split/wait sequence is attempted
multiple times.
Change-Id: I9aa8ab87bba79ea11b79c50f15328b8be844924d
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4557
Reviewed-by: Lenni Kuff <lskuff@cloudera.com>
Tested-by: Alex Behm <alex.behm@cloudera.com>
Defer resizing the columns_ vector until we are sure we will initialize it.
Downstream code doesn't expect any NULLs.
Change-Id: I250cceee5181428fcd3cd1a8b021edb7187ae888
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4465
Reviewed-by: Daniel Hecht <dhecht@cloudera.com>
Tested-by: jenkins
The 'less than' predicate created by AnalyticPlanner used to check if the
previous row was less than the current row is not exactly what we want
to determine when rows in RANGE windows (the default window in this case)
share the same result values. Rows get the same results when the order by
exprs evaluate equally or both null, so it's easiest (and more efficient)
to use a predicate that simply checks equality or both null. We already
create such predicates for checking for partition boundaries, so this is
a trivial change.
When we support arbitrary RANGE window offsets we will likely want to
add similar predicates that compare two tuples plus/minus the offset,
but those will be simpler because there can be only one order by expr
when specifying RANGE offsets with PRECEDING/FOLLOWING.
Change-Id: I52ff6203686832852430e498eca6ad2cc2daee98
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4474
Tested-by: jenkins
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: Matthew Jacobs <mj@cloudera.com>
1) Adds BE support for RANGE windows between UNBOUNDED PRECEDING to
UNBOUNDED FOLLOWING.
2) RANGE windows with offset boundaries fail analysis because they're
not supported by the BE yet.
Change-Id: I734575eb87c909d09d24c4df028023f3b50d3cb5
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4442
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: Matthew Jacobs <mj@cloudera.com>
- determine the partition group that has maximal intersection of its partition exprs with the
preceding grouping exprs
- if that intersection's expected ndv > #nodes, make that partition group the first one in the sequence
to be computed and reduce the hash partition of the preceding aggregation to that intersection
Change-Id: I612b4a260a8975deb495e5d34c32f03db4a7cca7
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4451
Reviewed-by: Marcel Kornacker <marcel@cloudera.com>
Tested-by: jenkins
Fixed a bug when setting the length in reading/write text files for CHAR(N).
Also added chars_tiny table for testing CHAR(N) and VARCHAR(N).
Change-Id: If5d5db30afa4b00cf03c68c6a845f182970329f4
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4415
Reviewed-by: Victor Bittorf <victor.bittorf@cloudera.com>
Tested-by: jenkins
min()/max() do not currently support windows without UNBOUNDED PRECEDING,
so this changes AnalyticExpr to detect this during analysis and throw an
AnalysisException.
Also removed some stale TODOs in the BE
Change-Id: I734b0a5d5399f9bb9d4db6ab1ddc079237b0ac03
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4431
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
Like left/right outer joins, anti joins have a uni-directional value transfer.
Predicates could be pushed into anti joined plan subtrees if the condition
was inverted, but this patch does not implement this optimization.
No special consideration must be made to prevent predicate assignment
into anti-joined branches because anti-joined tuples are invisible outside
of the On-clause, and therefore, all unassigned conjuncts referencing the
invisible tuple must come from the original join's On-clause. The assignment
of such predicates is already handled correctly.
Change-Id: Ic2b94f6eb57e000ea51e253035e713288b205298
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4425
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins
This patch restricts the leftmost table ref candidates of cross joins to the
very first join (like we already do for outer/semi joins). Join inversion
is still considered for cross joins.
While conceptually possible, it is tricky to reason about allowing the rhs of
arbitrary cross-join table refs as the leftmost candidate during join
re-ordering. We would have to carefully change the joinOps of all table refs
in between, and ensure to not make those changes in place to avoid "polluting"
the table refs for the next round of join re-ordering (considering a new
leftmost table ref). The safer fix is to restrict the considered orders.
Change-Id: I5fdc323e4a9c2dada06d9aec81769057f7076299
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4438
Reviewed-by: Alex Behm <alex.behm@cloudera.com>
Tested-by: jenkins