Skip to content

[CALCITE-3346] Enable some ignored tests in RelOptRuleTests#1453

Merged
hsyuan merged 1 commit into
apache:masterfrom
yanlin-Lynn:tests
Oct 3, 2019
Merged

[CALCITE-3346] Enable some ignored tests in RelOptRuleTests#1453
hsyuan merged 1 commit into
apache:masterfrom
yanlin-Lynn:tests

Conversation

@yanlin-Lynn

Copy link
Copy Markdown
Contributor

This PR tries to re-enable some ignored tests in RelOptRuleTests.

@amaliujia

Copy link
Copy Markdown
Contributor

To re-enable ignored tests is definitely a good idea. I will spend some time to check how those ignored tests in PR work(I see some changes on tests and not sure if they have changed intentions of original tests).

Meanwhile, I am seeing other style fixes in this PR. Maybe it's better to send a hot fix PR to fix those styles than mixing with CALCITE-3346?

@yanlin-Lynn

Copy link
Copy Markdown
Contributor Author

To re-enable ignored tests is definitely a good idea. I will spend some time to check how those ignored tests in PR work(I see some changes on tests and not sure if they have changed intentions of original tests).

Meanwhile, I am seeing other style fixes in this PR. Maybe it's better to send a hot fix PR to fix those styles than mixing with CALCITE-3346?

Thanks @amaliujia . It will be helpful with someone to check again.
And I remove the style related fixs.

@amaliujia amaliujia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@danny0405

Do you have recommendation on who could be better person to review this PR?

Comment thread core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml Outdated
</Resource>
<Resource name="planBefore">
<![CDATA[
LogicalTableModify(table=[[CATALOG, SALES, DEPT]], operation=[INSERT], flattened=[false])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see what's being tested here, but not sure if it is the original intention of that ignored test as you have added a SELECT there. I guess the original test is used to test if NULL works when applying ValuesReduceRule, and the new test does not include it.

Will need a committer who is more familiar with optimization to take a look then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I update the PR, add the NULL case.

<Resource name="planAfter">
<![CDATA[
LogicalCalc(expr#0..10=[{inputs}], expr#11=[=($t7, $t9)], expr#12=['Propane':VARCHAR(10)], expr#13=[=($t10, $t12)], expr#14=[AND($t11, $t13)], DNAME=[$t10], ENAME=[$t1], $condition=[$t14])
LogicalJoin(condition=[true], joinType=[inner])

@amaliujia amaliujia Sep 19, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure when this optimization could be useful: it change a inner equi-join to cross join and move the filter to Calc. So it's doing a filter moving up.

Also need a better person to check this one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, that's the purpose of JoinExtractFilterRule. It isn't widely used, but it is a valid transformation. Don't worry too much about whether these are "optimizations"; just ask whether they are semantically valid rewrites.

There are quite a few rules that are useful in matching materialized views that do not seem to make the plan cheaper.

@danny0405

Copy link
Copy Markdown
Contributor

@danny0405

Do you have recommendation on who could be better person to review this PR?

I can help to review, but maybe the weekend, i'm so busy this week days.

Comment thread core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java
@yanlin-Lynn
yanlin-Lynn force-pushed the tests branch 2 times, most recently from 8cc1568 to 46c0bb2 Compare September 23, 2019 08:17

@danny0405 danny0405 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

Comment thread core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml Outdated
Comment thread core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java Outdated
@yanlin-Lynn
yanlin-Lynn force-pushed the tests branch 2 times, most recently from b840a1b to f53952e Compare September 24, 2019 09:03
@danny0405 danny0405 added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Sep 24, 2019
@julianhyde

Copy link
Copy Markdown
Contributor

The transitiveInference method was always a bit weird, and different from other tests. But at least it made things concise. After these changes, adding a sql parameter, it is no longer concise. Can we get rid of it, so that the tests look like other tests?

Use your judgment to create tests that are readable, clear, maintainable, without too much redundancy.

@yanlin-Lynn

Copy link
Copy Markdown
Contributor Author

@danny0405 , what do you think?
Should I change transitiveInference back to the old way, without sql parameter, as @julianhyde suggested?

@danny0405

Copy link
Copy Markdown
Contributor

@danny0405 , what do you think?
Should I change transitiveInference back to the old way, without sql parameter, as @julianhyde suggested?

If i understand correctly, Julian means to do more refactoring for the method so it looks more concise ? Or we should revert the change @julianhyde ?

@yanlin-Lynn

Copy link
Copy Markdown
Contributor Author

how about this time, I make a refactor.

@danny0405

Copy link
Copy Markdown
Contributor

how about this time, I make a refactor.

Thanks for the effort, now the tests looks the same as others, which is more intuitive, i'm +1 for this. @julianhyde , do you have any objections ?

@julianhyde

Copy link
Copy Markdown
Contributor

+1

Looks great after refactor.

@hsyuan
hsyuan merged commit 87c5bd2 into apache:master Oct 3, 2019
@yanlin-Lynn
yanlin-Lynn deleted the tests branch October 3, 2019 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants