xiedeyantu commented on code in PR #4301: URL: https://github.com/apache/calcite/pull/4301#discussion_r2041292056
########## core/src/test/resources/sql/test.iq: ########## @@ -0,0 +1,63 @@ +# test.iq - Join query tests +# +# 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 rules "-CoreRules.INTERSECT_TO_DISTINCT,-EnumerableRules.ENUMERABLE_INTERSECT_RULE,+CoreRules.INTERSECT_TO_SEMI_JOIN" + +# Test one +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: I took a shortcut here by piggybacking on the existing logic for 'set'. We could probably extend it with custom commands like !update-rules and !reset-rules, though that might be a bit more work. If needed, I can try implementing it! -- 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]
