[
https://issues.apache.org/jira/browse/PHOENIX-6232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17241605#comment-17241605
]
Hadoop QA commented on PHOENIX-6232:
------------------------------------
| (x) *{color:red}-1 overall{color}* |
\\
\\
|| Vote || Subsystem || Runtime || Comment ||
| {color:blue}0{color} | {color:blue} reexec {color} | {color:blue} 0m
41s{color} | {color:blue} Docker mode activated. {color} |
|| || || || {color:brown} Prechecks {color} ||
| {color:green}+1{color} | {color:green} dupname {color} | {color:green} 0m
0s{color} | {color:green} No case conflicting files found. {color} |
| {color:green}+1{color} | {color:green} hbaseanti {color} | {color:green} 0m
0s{color} | {color:green} Patch does not have any anti-patterns. {color} |
| {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m
0s{color} | {color:green} The patch does not contain any @author tags. {color} |
| {color:green}+1{color} | {color:green} test4tests {color} | {color:green} 0m
0s{color} | {color:green} The patch appears to include 2 new or modified test
files. {color} |
|| || || || {color:brown} 4.x Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 5m
59s{color} | {color:green} 4.x passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m
55s{color} | {color:green} 4.x passed {color} |
| {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 1m
27s{color} | {color:green} 4.x passed {color} |
| {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m
41s{color} | {color:green} 4.x passed {color} |
| {color:blue}0{color} | {color:blue} spotbugs {color} | {color:blue} 2m
59s{color} | {color:blue} phoenix-core in 4.x has 950 extant spotbugs warnings.
{color} |
|| || || || {color:brown} Patch Compile Tests {color} ||
| {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 5m
37s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m
53s{color} | {color:green} the patch passed {color} |
| {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m
53s{color} | {color:green} the patch passed {color} |
| {color:red}-1{color} | {color:red} checkstyle {color} | {color:red} 1m
28s{color} | {color:red} phoenix-core: The patch generated 180 new + 2552
unchanged - 142 fixed = 2732 total (was 2694) {color} |
| {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m
0s{color} | {color:green} The patch has no whitespace issues. {color} |
| {color:red}-1{color} | {color:red} javadoc {color} | {color:red} 0m
43s{color} | {color:red} phoenix-core generated 2 new + 98 unchanged - 2 fixed
= 100 total (was 100) {color} |
| {color:green}+1{color} | {color:green} spotbugs {color} | {color:green} 3m
6s{color} | {color:green} the patch passed {color} |
|| || || || {color:brown} Other Tests {color} ||
| {color:red}-1{color} | {color:red} unit {color} | {color:red}143m 9s{color}
| {color:red} phoenix-core in the patch failed. {color} |
| {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m
33s{color} | {color:green} The patch does not generate ASF License warnings.
{color} |
| {color:black}{color} | {color:black} {color} | {color:black}168m 50s{color} |
{color:black} {color} |
\\
\\
|| Reason || Tests ||
| Failed junit tests | phoenix.end2end.AlterTableWithViewsIT |
| | phoenix.end2end.RangeScanIT |
\\
\\
|| Subsystem || Report/Notes ||
| Docker | ClientAPI=1.40 ServerAPI=1.40 base:
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/artifact/patchprocess/Dockerfile
|
| JIRA Issue | PHOENIX-6232 |
| JIRA Patch URL |
https://issues.apache.org/jira/secure/attachment/13016278/PHOENIX-6232_v1-4.x.patch
|
| Optional Tests | dupname asflicense javac javadoc unit spotbugs hbaseanti
checkstyle compile |
| uname | Linux 26b8d3769836 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9
23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux |
| Build tool | maven |
| Personality | dev/phoenix-personality.sh |
| git revision | 4.x / 18b9f76 |
| Default Java | Private Build-1.8.0_242-8u242-b08-0ubuntu3~16.04-b08 |
| checkstyle |
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/artifact/patchprocess/diff-checkstyle-phoenix-core.txt
|
| javadoc |
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/artifact/patchprocess/diff-javadoc-javadoc-phoenix-core.txt
|
| unit |
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/artifact/patchprocess/patch-unit-phoenix-core.txt
|
| Test Results |
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/testReport/ |
| Max. process+thread count | 6458 (vs. ulimit of 30000) |
| modules | C: phoenix-core U: phoenix-core |
| Console output |
https://ci-hadoop.apache.org/job/PreCommit-PHOENIX-Build/230/console |
| versions | git=2.7.4 maven=3.3.9 spotbugs=4.1.3 |
| Powered by | Apache Yetus 0.12.0 https://yetus.apache.org |
This message was automatically generated.
> Same query fails with IllegalArgumentException if part of a join
> ----------------------------------------------------------------
>
> Key: PHOENIX-6232
> URL: https://issues.apache.org/jira/browse/PHOENIX-6232
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.15.0
> Reporter: Mate Szalay-Beko
> Assignee: chenglei
> Priority: Major
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6232_v1-4.x.patch
>
>
> We were facing an interesting problem when a more complex query (with inner
> selects in the WHERE clause) succeeds alone, while the same query fails, if
> it is part of a join. I created a test table / query to reproduce the problem:
> {code:sql}
> DROP TABLE IF EXISTS test;
> CREATE TABLE test (
> id INTEGER NOT NULL,
> test_id INTEGER,
> lastchanged TIMESTAMP,
> CONSTRAINT my_pk PRIMARY KEY (id));
> UPSERT INTO test VALUES(0, 100, '2000-01-01 00:00:00.0');
> UPSERT INTO test VALUES(1, 101, '2000-01-01 00:00:00.0');
> UPSERT INTO test VALUES(2, 100, '2011-11-11 11:11:11.0');
> {code}
> *Query 1:* Example query, running fine in itself:
> {code:sql}
> SELECT id, test_id, lastchanged FROM test T
> WHERE lastchanged = ( SELECT max(lastchanged) FROM test WHERE test_id =
> T.test_id )
> Returns:
> +----+---------+-----------------------+
> | ID | TEST_ID | LASTCHANGED |
> +----+---------+-----------------------+
> | 1 | 101 | 2000-01-01 01:00:00.0 |
> | 2 | 100 | 2011-11-11 12:11:11.0 |
> +----+---------+-----------------------+
> {code}
> *Query 2:* Same query fails on the current master branch, when it is part of
> a larger (implicit) join:
> {code:sql}
> SELECT AAA.*
> FROM
> (
> SELECT id, test_id, lastchanged FROM test T
> WHERE lastchanged = ( SELECT max(lastchanged) FROM test WHERE test_id =
> T.test_id )
> ) as AAA,
> (
> SELECT id FROM test
> ) as BBB
> WHERE AAA.id = BBB.id;
> java.lang.IllegalArgumentException
> at
> org.apache.phoenix.thirdparty.com.google.common.base.Preconditions.checkArgument(Preconditions.java:128)
> at
> org.apache.phoenix.compile.TupleProjectionCompiler.createProjectedTable(TupleProjectionCompiler.java:66)
> at
> org.apache.phoenix.compile.QueryCompiler.compileSingleFlatQuery(QueryCompiler.java:663)
> at
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:404)
> at
> org.apache.phoenix.compile.QueryCompiler.compileJoinQuery(QueryCompiler.java:302)
> at
> org.apache.phoenix.compile.QueryCompiler.compileSelect(QueryCompiler.java:249)
> at
> org.apache.phoenix.compile.QueryCompiler.compile(QueryCompiler.java:176)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:504)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableSelectStatement.compilePlan(PhoenixStatement.java:467)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:309)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:298)
> at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:297)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:290)
> at
> org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1933)
> at sqlline.Commands.executeSingleQuery(Commands.java:1054)
> at sqlline.Commands.execute(Commands.java:1003)
> at sqlline.Commands.sql(Commands.java:967)
> at sqlline.SqlLine.dispatch(SqlLine.java:734)
> at sqlline.SqlLine.begin(SqlLine.java:541)
> at sqlline.SqlLine.start(SqlLine.java:267)
> at sqlline.SqlLine.main(SqlLine.java:206)
> {code}
> I am not sure what the problem is exactly. My guess is that Phoenix tries to
> optimize (flatten) an inner-query, which it shouldn't, if we are inside a
> join (according to the check in the code which throws the exception).
> The best workaround I found was to define an explicit join in the original
> query (Query 1), basically change the inner select into a join. This modified
> query return the same as the original one:
> *Query 3:*
> {code:sql}
> SELECT T.id, T.test_id, T.lastchanged
> FROM
> test T
> LEFT JOIN (
> SELECT max(lastchanged) AS max_timestamp,
> test_id AS max_timestamp_test_id
> FROM test
> GROUP BY test_id
> ) JOIN_TABLE ON JOIN_TABLE.max_timestamp_test_id = T.test_id
> WHERE T.lastchanged = JOIN_TABLE.max_timestamp
> Returns:
> +------+-----------+-----------------------+
> | T.ID | T.TEST_ID | T.LASTCHANGED |
> +------+-----------+-----------------------+
> | 1 | 101 | 2000-01-01 01:00:00.0 |
> | 2 | 100 | 2011-11-11 12:11:11.0 |
> +------+-----------+-----------------------+
> {code}
> *Query 4:* And the same modified query (query 3) now works inside a join:
> {code:sql}
> SELECT AAA.*
> FROM
> (
> SELECT T.id, T.test_id, T.lastchanged
> FROM
> test T
> LEFT JOIN (
> SELECT max(lastchanged) AS max_timestamp,
> test_id AS max_timestamp_test_id
> FROM test
> GROUP BY test_id
> ) JOIN_TABLE ON JOIN_TABLE.max_timestamp_test_id = T.test_id
> WHERE T.lastchanged = JOIN_TABLE.max_timestamp
> ) as AAA,
> (
> SELECT id FROM test
> ) as BBB
> WHERE AAA.id = BBB.id;
> Returns:
> +------+-----------+-----------------------+
> | T.ID | T.TEST_ID | T.LASTCHANGED |
> +------+-----------+-----------------------+
> | 1 | 101 | 2000-01-01 01:00:00.0 |
> | 2 | 100 | 2011-11-11 12:11:11.0 |
> +------+-----------+-----------------------+
> {code}
> I think Query 4 worked, as it is forcing Phoenix to drop the idea of
> optimizing it's inner-query (Query 3). Although, I can be wrong about the
> root cause...
> Anyway, I think the bug should be fixed and Query 2 should run without
> exception.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)