mihaibudiu commented on code in PR #4301:
URL: https://github.com/apache/calcite/pull/4301#discussion_r2043176782


##########
core/src/test/resources/sql/planner.iq:
##########
@@ -0,0 +1,84 @@
+# planner.iq - planner tests can customizable optimization rules
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+!use post
+!set outputformat mysql
+!set update-rules 
"-INTERSECT_TO_DISTINCT,-EnumerableRules.ENUMERABLE_INTERSECT_RULE,+CoreRules.INTERSECT_TO_SEMI_JOIN"
+
+# Test INTERSECT_TO_SEMI_JOIN
+with t (i) as (values (0), (1))
+select * from t as t1
+intersect
+select * from t as t2 where t2.i > 0;
++---+
+| I |
++---+
+| 1 |
++---+
+(1 row)
+
+!ok
+
+EnumerableNestedLoopJoin(condition=[IS NOT DISTINCT FROM($0, $1)], 
joinType=[semi])
+  EnumerableValues(tuples=[[{ 0 }, { 1 }]])
+  EnumerableCalc(expr#0=[{inputs}], expr#1=[0], expr#2=[>($t0, $t1)], 
EXPR$0=[$t0], $condition=[$t2])
+    EnumerableValues(tuples=[[{ 0 }, { 1 }]])
+!plan
+
+# Test no reset-rules can keep rules
+with t (i) as (values (0), (1))
+select * from t as t1
+intersect
+select * from t as t2 where t2.i > 0;
++---+
+| I |
++---+
+| 1 |
++---+
+(1 row)
+
+!ok
+
+EnumerableNestedLoopJoin(condition=[IS NOT DISTINCT FROM($0, $1)], 
joinType=[semi])
+  EnumerableValues(tuples=[[{ 0 }, { 1 }]])
+  EnumerableCalc(expr#0=[{inputs}], expr#1=[0], expr#2=[>($t0, $t1)], 
EXPR$0=[$t0], $condition=[$t2])
+    EnumerableValues(tuples=[[{ 0 }, { 1 }]])
+!plan
+
+!set reset-rules ""

Review Comment:
   this is a bit ugly
   if you want to reuse "!set", maybe you can say "!set planner-rules 
original". 
   Here "original" is not the name of any rule



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to