Skip to content

Conversation

irenjj
Copy link
Contributor

@irenjj irenjj commented Mar 8, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the sqllogictest SQL Logic Tests (.slt) label Mar 8, 2025
let on = self
.on
.iter()
.map(|(c1, c2)| format!("({}, {})", c1, c2))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think formatting this join condition as 'c1 = c1' is easier to understand.
Maybe also concat multiple join condition with '\n' instead of ',' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the render tree, each line is parsed to extract key and value. If we add '\n' in the value, it will be treated as a new line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c1 = c1 is clearer than before! 👍

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @irenjj adn @2010YOUY01

I have some small suggestions but I don't think they are necessary

.join(", ");

writeln!(f, "join_type={:?}", self.join_type)?;
writeln!(f, "on=[{}]", on)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend

  1. we remove [ and ]
  2. don't print join_type if the type is Inner


# Query with hash join.
query TT
explain select * from table1 inner join table2 on table1.int_col = table2.int_col and table1.string_col = table2.string_col;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend testing outer join here:

Suggested change
explain select * from table1 inner join table2 on table1.int_col = table2.int_col and table1.string_col = table2.string_col;
explain select * from table1 outer inner join table2 on table1.int_col = table2.int_col and table1.string_col = table2.string_col;

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@alamb alamb merged commit b0d3736 into apache:main Mar 8, 2025
24 checks passed
@alamb
Copy link
Contributor

alamb commented Mar 8, 2025

Thanks again @irenjj

@irenjj irenjj deleted the explain_hashjoin branch March 8, 2025 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement tree explain for HashJoinExec

3 participants