Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Duplicate
-
Impala 2.0
-
None
-
commit 7cfed977263d89d2faf04409965a6ee349f3e6e5
Author: Nong Li <nong@cloudera.com>
Date: Wed Sep 24 11:24:03 2014 -0700
Update distinctpc/pcsa to return bigint.
Description
The first query below has incorrect results. The second query is the same except "straight_join" was added and the results are correct. It's interesting that the incorrect values returned by the top query are not from the column in the select list (the values should be dates).
[localhost.localdomain:21000] > select t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col; Query: select t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col +--------------+ | string_col_1 | +--------------+ | 1 | | NULL | | 1 | | NULL | | 1 | | NULL | | 1 | | NULL | +--------------+ Fetched 8 row(s) in 0.45s [localhost.localdomain:21000] > select straight_join t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col; Query: select straight_join t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col +--------------+ | string_col_1 | +--------------+ | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | | NULL | +--------------+ Fetched 8 row(s) in 0.17s [localhost.localdomain:21000] > explain select t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col; Query: explain select t2.date_string_col AS string_col_1 FROM alltypestiny t1 LEFT JOIN alltypestiny t2 ON t2.date_string_col = t1.string_col LEFT JOIN alltypesagg t3 ON t3.string_col = t1.date_string_col +-----------------------------------------------------------+ | Explain String | +-----------------------------------------------------------+ | Estimated Per-Host Requirements: Memory=80.00MB VCores=3 | | | | 09:EXCHANGE [UNPARTITIONED] | | | hosts=3 per-host-mem=unavailable | | | tuple-ids=2N,0,1N row-size=84B cardinality=40000 | | | | | 04:HASH JOIN [RIGHT OUTER JOIN, PARTITIONED] | | | hash predicates: t3.string_col = t1.date_string_col | | | hosts=3 per-host-mem=381B | | | tuple-ids=2N,0,1N row-size=84B cardinality=40000 | | | | | |--08:EXCHANGE [HASH(t1.date_string_col)] | | | | hosts=3 per-host-mem=0B | | | | tuple-ids=0,1N row-size=65B cardinality=16 | | | | | | | 03:HASH JOIN [LEFT OUTER JOIN, PARTITIONED] | | | | hash predicates: t1.string_col = t2.date_string_col | | | | hosts=3 per-host-mem=70B | | | | tuple-ids=0,1N row-size=65B cardinality=16 | | | | | | | |--06:EXCHANGE [HASH(t2.date_string_col)] | | | | | hosts=3 per-host-mem=0B | | | | | tuple-ids=1 row-size=24B cardinality=8 | | | | | | | | | 01:SCAN HDFS [functional.alltypestiny t2, RANDOM] | | | | partitions=4/4 size=460B | | | | table stats: 8 rows total | | | | column stats: all | | | | hosts=3 per-host-mem=32.00MB | | | | tuple-ids=1 row-size=24B cardinality=8 | | | | | | | 05:EXCHANGE [HASH(t1.string_col)] | | | | hosts=3 per-host-mem=0B | | | | tuple-ids=0 row-size=41B cardinality=8 | | | | | | | 00:SCAN HDFS [functional.alltypestiny t1, RANDOM] | | | partitions=4/4 size=460B | | | table stats: 8 rows total | | | column stats: all | | | hosts=3 per-host-mem=32.00MB | | | tuple-ids=0 row-size=41B cardinality=8 | | | | | 07:EXCHANGE [HASH(t3.string_col)] | | | hosts=3 per-host-mem=0B | | | tuple-ids=2 row-size=19B cardinality=10000 | | | | | 02:SCAN HDFS [functional.alltypesagg t3, RANDOM] | | partitions=11/11 size=814.73KB | | table stats: 11000 rows total | | column stats: all | | hosts=3 per-host-mem=80.00MB | | tuple-ids=2 row-size=19B cardinality=10000 | +-----------------------------------------------------------+ Fetched 52 row(s) in 0.04s