text:
<?xml version="1.0" ?>
<!--
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.
-->
<Root>
  <TestCase name="testFullJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A FULL JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[=($0, $3)], joinType=[full])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[FullOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I])
:  +- Calc(select=[a1], changelogMode=[I])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A FULL JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[full])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[FullOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a1, a2, b1, b2], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :  +- Calc(select=[a1, a2], changelogMode=[I])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithEqualPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[=($1, $3)], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[FullOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
   +- GroupAggregate(groupBy=[b1], select=[b1], changelogMode=[I,UA])
      +- Exchange(distribution=[hash[b1]], changelogMode=[I])
         +- Calc(select=[b1, b2], changelogMode=[I])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithEqualPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[AND(=($1, $3), >($0, $2))], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[FullOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b2, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithFullNotPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[=($1, $2)], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[FullOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithFullNotPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[AND(=($1, $2), >($0, $3))], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[FullOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b1, b2], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[=($0, $2)], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[FullOuterJoin], where=[=(a2, b2)], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testFullJoinWithPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) FULL JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2 AND a1 > b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[AND(=($0, $2), >($1, $3))], joinType=[full])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[FullOuterJoin], where=[AND(=(a2, b2), >(a1, b1))], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testInnerJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[=($0, $3)], joinType=[inner])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Join(joinType=[InnerJoin], where=[(a1 = b1)], select=[a1, b1], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
:- Exchange(distribution=[hash[a1]])
:  +- Calc(select=[a1])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3])
+- Exchange(distribution=[hash[b1]])
   +- Calc(select=[b1])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testInnerJoinWithEqualPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[=($1, $3)], joinType=[inner])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[InnerJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
   +- GroupAggregate(groupBy=[b1], select=[b1], changelogMode=[I,UA])
      +- Exchange(distribution=[hash[b1]], changelogMode=[I])
         +- Calc(select=[b1, b2], changelogMode=[I])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithEqualPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[=($1, $3)], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[LeftOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
   +- GroupAggregate(groupBy=[b1], select=[b1], changelogMode=[I,UA])
      +- Exchange(distribution=[hash[b1]], changelogMode=[I])
         +- Calc(select=[b1, b2], changelogMode=[I])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testInnerJoinWithPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[=($0, $2)], joinType=[inner])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA])
+- Join(joinType=[InnerJoin], where=[=(a2, b2)], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testJoinAndSelectOnPartialCompositePrimaryKey">
    <Resource name="sql">
      <![CDATA[SELECT A.a1 FROM A LEFT JOIN tableWithCompositePk T ON A.a1 = T.pk1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0])
+- LogicalJoin(condition=[=($0, $3)], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, tableWithCompositePk]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[a1])
+- Join(joinType=[LeftOuterJoin], where=[(a1 = pk1)], select=[a1, pk1], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a1]])
   :  +- Calc(select=[a1])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3])
   +- Exchange(distribution=[hash[pk1]])
      +- TableSourceScan(table=[[default_catalog, default_database, tableWithCompositePk, project=[pk1]]], fields=[pk1])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testJoinWithSort">
    <Resource name="sql">
      <![CDATA[
SELECT * FROM
  MyTable3 FULL JOIN
  (SELECT * FROM MyTable4 ORDER BY MyTable4.i DESC, MyTable4.k ASC) MyTable4
  ON MyTable3.i = MyTable4.i and MyTable3.i = MyTable4.k
      ]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(i=[$0], j=[$1], t=[$2], i0=[$3], k=[$4])
+- LogicalJoin(condition=[AND(=($0, $3), =($0, $4))], joinType=[full])
   :- LogicalTableScan(table=[[default_catalog, default_database, MyTable3, source: [TestTableSource(i, j, t)]]])
   +- LogicalProject(i=[$0], k=[$1])
      +- LogicalTableScan(table=[[default_catalog, default_database, MyTable4, source: [TestTableSource(i, k)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Join(joinType=[FullOuterJoin], where=[((i = i0) AND (i = k))], select=[i, j, t, i0, k], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
:- Exchange(distribution=[hash[i, i]])
:  +- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable3, source: [TestTableSource(i, j, t)]]], fields=[i, j, t])
+- Exchange(distribution=[hash[i, k]])
   +- LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable4, source: [TestTableSource(i, k)]]], fields=[i, k])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A LEFT JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[=($0, $3)], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[LeftOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I])
:  +- Calc(select=[a1], changelogMode=[I])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A LEFT JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[LeftOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a1, a2, b1, b2], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :  +- Calc(select=[a1, a2], changelogMode=[I])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithEqualPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[AND(=($1, $3), >($0, $2))], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[LeftOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b2, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[=($0, $2)], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[LeftOuterJoin], where=[=(a2, b2)], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2 AND a1 > b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[AND(=($0, $2), >($1, $3))], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[LeftOuterJoin], where=[AND(=(a2, b2), >(a1, b1))], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithRightNotPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[=($1, $2)], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[LeftOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftJoinWithRightNotPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) LEFT JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[AND(=($1, $2), >($0, $3))], joinType=[left])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[LeftOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b1, b2], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftOuterJoinEquiAndLocalPred">
    <Resource name="sql">
      <![CDATA[SELECT b, y FROM t LEFT OUTER JOIN s ON a = z AND b < 2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], y=[$4])
+- LogicalJoin(condition=[AND(=($0, $5), <($1, 2))], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, y])
+- Join(joinType=[LeftOuterJoin], where=[((a = z) AND (b < 2))], select=[a, b, y, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- Calc(select=[y, z])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftOuterJoinEquiAndNonEquiPred">
    <Resource name="sql">
      <![CDATA[SELECT b, y FROM t LEFT OUTER JOIN s ON a = z AND b < x]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], y=[$4])
+- LogicalJoin(condition=[AND(=($0, $5), <($1, $3))], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, y])
+- Join(joinType=[LeftOuterJoin], where=[((a = z) AND (b < x))], select=[a, b, x, y, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A RIGHT JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[AND(=($0, $3), >($1, $4))], joinType=[right])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[RightOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a1, a2, b1, b2], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :  +- Calc(select=[a1, a2], changelogMode=[I])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftOuterJoinEquiPred">
    <Resource name="sql">
      <![CDATA[SELECT b, y FROM t LEFT OUTER JOIN s ON a = z]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], y=[$4])
+- LogicalJoin(condition=[=($0, $5)], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, y])
+- Join(joinType=[LeftOuterJoin], where=[(a = z)], select=[a, b, y, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- Calc(select=[y, z])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightOuterJoinEquiPred">
    <Resource name="sql">
      <![CDATA[SELECT b, y FROM t RIGHT OUTER JOIN s ON a = z]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], y=[$4])
+- LogicalJoin(condition=[=($0, $5)], joinType=[right])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, y])
+- Join(joinType=[RightOuterJoin], where=[(a = z)], select=[a, b, y, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- Calc(select=[y, z])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM A RIGHT JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$0], b1=[$3])
+- LogicalJoin(condition=[=($0, $3)], joinType=[right])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[RightOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I])
:  +- Calc(select=[a1], changelogMode=[I])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithEqualPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) RIGHT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[=($1, $3)], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[RightOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
   +- GroupAggregate(groupBy=[b1], select=[b1], changelogMode=[I,UA])
      +- Exchange(distribution=[hash[b1]], changelogMode=[I])
         +- Calc(select=[b1, b2], changelogMode=[I])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A group by a1) RIGHT JOIN (SELECT SUM(b2) AS b2, b1 FROM B group by b1) ON a2 = b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[=($0, $2)], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[RightOuterJoin], where=[=(a2, b2)], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2, b1, b2 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) RIGHT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a2 = b2 AND a1 > b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], a2=[$0], b1=[$3], b2=[$2])
+- LogicalJoin(condition=[AND(=($0, $2), >($1, $3))], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, a2, b1, b2], changelogMode=[I,UB,UA,D])
+- Join(joinType=[RightOuterJoin], where=[AND(=(a2, b2), >(a1, b1))], select=[a2, a1, b2, b1], leftInputSpec=[HasUniqueKey], rightInputSpec=[HasUniqueKey], changelogMode=[I,UB,UA,D])
   :- Exchange(distribution=[hash[a2]], changelogMode=[I,UB,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UB,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UB,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b2]], changelogMode=[I,UB,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UB,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UB,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithRightNotPk">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A group by a1) RIGHT JOIN B ON a1 = b1]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[=($1, $2)], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[RightOuterJoin], where=[=(a1, b1)], select=[a1, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
:  +- GroupAggregate(groupBy=[a1], select=[a1], changelogMode=[I,UA])
:     +- Exchange(distribution=[hash[a1]], changelogMode=[I])
:        +- Calc(select=[a1, a2], changelogMode=[I])
:           +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
+- Exchange(distribution=[hash[b1]], changelogMode=[I])
   +- Calc(select=[b1], changelogMode=[I])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithRightNotPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) RIGHT JOIN B ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$2])
+- LogicalJoin(condition=[AND(=($1, $2), >($0, $3))], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[RightOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b1, b2], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I])
      +- Calc(select=[b1, b2], changelogMode=[I])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightJoinWithEqualPkNonEqui">
    <Resource name="sql">
      <![CDATA[SELECT a1, b1 FROM (SELECT SUM(a2) AS a2, a1 FROM A GROUP BY a1) RIGHT JOIN (SELECT SUM(b2) AS b2, b1 FROM B GROUP BY b1) ON a1 = b1 AND a2 > b2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(a1=[$1], b1=[$3])
+- LogicalJoin(condition=[AND(=($1, $3), >($0, $2))], joinType=[right])
   :- LogicalProject(a2=[$1], a1=[$0])
   :  +- LogicalAggregate(group=[{0}], a2=[SUM($1)])
   :     +- LogicalProject(a1=[$0], a2=[$1])
   :        +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]])
   +- LogicalProject(b2=[$1], b1=[$0])
      +- LogicalAggregate(group=[{0}], b2=[SUM($1)])
         +- LogicalProject(b1=[$0], b2=[$1])
            +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Calc(select=[a1, b1], changelogMode=[I,UA,D])
+- Join(joinType=[RightOuterJoin], where=[AND(=(a1, b1), >(a2, b2))], select=[a2, a1, b2, b1], leftInputSpec=[JoinKeyContainsUniqueKey], rightInputSpec=[JoinKeyContainsUniqueKey], changelogMode=[I,UA,D])
   :- Exchange(distribution=[hash[a1]], changelogMode=[I,UA])
   :  +- Calc(select=[a2, a1], changelogMode=[I,UA])
   :     +- GroupAggregate(groupBy=[a1], select=[a1, SUM(a2) AS a2], changelogMode=[I,UA])
   :        +- Exchange(distribution=[hash[a1]], changelogMode=[I])
   :           +- Calc(select=[a1, a2], changelogMode=[I])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2, a3)]]], fields=[a1, a2, a3], changelogMode=[I])
   +- Exchange(distribution=[hash[b1]], changelogMode=[I,UA])
      +- Calc(select=[b2, b1], changelogMode=[I,UA])
         +- GroupAggregate(groupBy=[b1], select=[b1, SUM(b2) AS b2], changelogMode=[I,UA])
            +- Exchange(distribution=[hash[b1]], changelogMode=[I])
               +- Calc(select=[b1, b2], changelogMode=[I])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2, b3)]]], fields=[b1, b2, b3], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightOuterJoinEquiAndLocalPred">
    <Resource name="sql">
      <![CDATA[SELECT b, x FROM t RIGHT OUTER JOIN s ON a = z AND x < 2]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], x=[$3])
+- LogicalJoin(condition=[AND(=($0, $5), <($3, 2))], joinType=[right])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, x])
+- Join(joinType=[RightOuterJoin], where=[((a = z) AND (x < 2))], select=[a, b, x, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- Calc(select=[x, z])
         +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightOuterJoinEquiAndNonEquiPred">
    <Resource name="sql">
      <![CDATA[SELECT b, y FROM t RIGHT OUTER JOIN s ON a = z AND b < x]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(b=[$1], y=[$4])
+- LogicalJoin(condition=[AND(=($0, $5), <($1, $3))], joinType=[right])
   :- LogicalTableScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]])
]]>
    </Resource>
    <Resource name="optimized exec plan">
      <![CDATA[
Calc(select=[b, y])
+- Join(joinType=[RightOuterJoin], where=[((a = z) AND (b < x))], select=[a, b, x, y, z], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey])
   :- Exchange(distribution=[hash[a]])
   :  +- Calc(select=[a, b])
   :     +- LegacyTableSourceScan(table=[[default_catalog, default_database, t, source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
   +- Exchange(distribution=[hash[z]])
      +- LegacyTableSourceScan(table=[[default_catalog, default_database, s, source: [TestTableSource(x, y, z)]]], fields=[x, y, z])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testSelfJoinPlan">
    <Resource name="sql">
      <![CDATA[
SELECT * FROM (
  SELECT * FROM src WHERE key = 0) src1
LEFT OUTER JOIN (
  SELECT * FROM src WHERE key = 0) src2
ON (src1.key = src2.key AND src2.key > 10)
       ]]>
    </Resource>
    <Resource name="ast">
      <![CDATA[
LogicalProject(key=[$0], v=[$1], key0=[$2], v0=[$3])
+- LogicalJoin(condition=[AND(=($0, $2), >($2, 10))], joinType=[left])
   :- LogicalProject(key=[$0], v=[$1])
   :  +- LogicalFilter(condition=[=($0, 0)])
   :     +- LogicalTableScan(table=[[default_catalog, default_database, src, source: [TestTableSource(key, v)]]])
   +- LogicalProject(key=[$0], v=[$1])
      +- LogicalFilter(condition=[=($0, 0)])
         +- LogicalTableScan(table=[[default_catalog, default_database, src, source: [TestTableSource(key, v)]]])
]]>
    </Resource>
    <Resource name="optimized rel plan">
      <![CDATA[
Join(joinType=[LeftOuterJoin], where=[=(key, key0)], select=[key, v, key0, v0], leftInputSpec=[NoUniqueKey], rightInputSpec=[NoUniqueKey], changelogMode=[I,UA,D])
:- Exchange(distribution=[hash[key]], changelogMode=[I])
:  +- Calc(select=[CAST(0:BIGINT) AS key, v], where=[=(key, 0:BIGINT)], changelogMode=[I])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, src, source: [TestTableSource(key, v)]]], fields=[key, v], changelogMode=[I])
+- Exchange(distribution=[hash[key]], changelogMode=[I])
   +- Values(tuples=[[]], changelogMode=[I])
]]>
    </Resource>
  </TestCase>
</Root>


text:
import sys
from sfa.client.sfi_commands import Commands
from sfa.rspecs.rspec import RSpec
from sfa.util.xrn import Xrn

command = Commands(usage="%prog [options]",
                   description="List all links in the RSpec. " +
                   "Use this to display the list of available links. " )
command.prep()

if command.opts.infile:
    rspec = RSpec(command.opts.infile)
    links = rspec.version.get_links()
    if command.opts.outfile:
        sys.stdout = open(command.opts.outfile, 'w')

    for link in links:
        ifname1 = Xrn(link['interface1']['component_id']).get_leaf()
        ifname2 = Xrn(link['interface2']['component_id']).get_leaf()
        print "%s %s" % (ifname1, ifname2)

redpajama_set_name: RedPajamaGithub


text:
using MinorShift._Library;
using MinorShift.Emuera.Content;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
namespace MinorShift.Emuera.GameView
{
	class ConsoleImagePart : AConsoleDisplayPart
	{

		public ConsoleImagePart(string resName, string resNameb, int raw_height, int raw_width, int raw_ypos)
		{

			top = 0;
			bottom = Config.FontSize;
			Str = "";
			ResourceName = resName ?? "";
			ButtonResourceName = resNameb;
			StringBuilder sb = new StringBuilder();
			sb.Append("<img src='");
			sb.Append(ResourceName);
			if(ButtonResourceName != null)
			{
				sb.Append("' srcb='");
				sb.Append(ButtonResourceName);
			}
			if(raw_height != 0)
			{
				sb.Append("' height='");
				sb.Append(raw_height.ToString());
			}
			if(raw_width != 0)
			{
				sb.Append("' width='");
				sb.Append(raw_height.ToString());
			}
			if(raw_ypos != 0)
			{
				sb.Append("' ypos='");
				sb.Append(raw_height.ToString());
			}
			sb.Append("'>");
			AltText = sb.ToString();

			cImage = Content.AppContents.GetContent<CroppedImage>(ResourceName);
			if (cImage != null && !cImage.Enabled)
				cImage = null;
			if (cImage == null)
			{
				Str = AltText;
				return;
			}
			int height = 0;
			if (cImage.NoResize)
			{
				height = cImage.Rectangle.Height;
				Width = cImage.Rectangle.Width;
			}
			else
			{

				if (raw_height == 0)
					height = Config.FontSize;
				else
					height = Config.FontSize * raw_height / 100;
				if (raw_width == 0)
				{
					Width = cImage.Rectangle.Width * height / cImage.Rectangle.Height;
					XsubPixel = ((float)cImage.Rectangle.Width * height) / cImage.Rectangle.Height - Width;
				}
				else
				{
					Width = Config.FontSize * raw_width / 100;
					XsubPixel = ((float)Config.FontSize * raw_width / 100f) - Width;
				}
			}
			top = raw_ypos * Config.FontSize / 100;
			destRect = new Rectangle(0, top, Width, height);
			if (destRect.Width < 0)
			{
				destRect.X = -destRect.Width;
				Width = -destRect.Width;
			}
			if (destRect.Height < 0)
			{
				destRect.Y = destRect.Y - destRect.Height;
				height = -destRect.Height;
			}
			bottom = top + height;
			//if(top > 0)
			//	top = 0;
			//if(bottom < Config.FontSize)
			//	bottom = Config.FontSize;
			if (ButtonResourceName != null)
			{
				cImageB = Content.AppContents.GetContent<CroppedImage>(ButtonResourceName);
				if (cImageB != null && !cImageB.Enabled)
					cImageB = null;
			}
		}

		private readonly CroppedImage cImage;
		private readonly CroppedImage cImageB;
		private readonly int top;
		private readonly int bottom;
		private readonly Rectangle destRect;
		private readonly ImageAttributes ia;
		public readonly string ResourceName;
		public readonly string ButtonResourceName;
		public override int Top { get { return top; } }
		public override int Bottom { get { return bottom; } }

		public override bool CanDivide { get { return false; } }
		public override void SetWidth(StringMeasure sm, float subPixel)
		{
			if (this.Error)
			{
				Width = 0;
				return;
			}
			if (cImage != null)
				return;
			Width = sm.GetDisplayLength(Str, Config.Font);
			XsubPixel = subPixel;
		}

		public override string ToString()
		{
			if (AltText == null)
				return "";
			return AltText;
		}

		public override void DrawTo(Graphics graph, int pointY, bool isSelecting, bool isBackLog, TextDrawingMode mode)
		{
			if (this.Error)
				return;
			CroppedImage img = cImage;
			if (isSelecting && cImageB != null)
				img = cImageB;
			Rectangle rect = destRect;
			//PointX微調整
			rect.X = destRect.X + PointX + Config.DrawingParam_ShapePositionShift;
			rect.Y = destRect.Y + pointY;

			if (img != null)
			{
				if(ia == null)
					graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle, GraphicsUnit.Pixel);
				else
					graph.DrawImage(img.BaseImage.Bitmap, rect, img.Rectangle.X,img.Rectangle.Y,img.Rectangle.Width,img.Rectangle.Height , GraphicsUnit.Pixel,ia);
			}
			else
			{
				if (mode == TextDrawingMode.GRAPHICS)
					graph.DrawString(Str, Config.Font, new SolidBrush(Config.ForeColor), new Point(PointX, pointY));
				else
					System.Windows.Forms.TextRenderer.DrawText(graph, Str, Config.Font, new Point(PointX, pointY), Config.ForeColor, System.Windows.Forms.TextFormatFlags.NoPrefix);
			}
		}

		public override void GDIDrawTo(int pointY, bool isSelecting, bool isBackLog)
		{
			if (this.Error)
				return;
			CroppedImage img = cImage;
			if (isSelecting && cImageB != null)
				img = cImageB;
			if (img != null)
				GDI.DrawImage(PointX + destRect.X, pointY+ destRect.Y, Width, destRect.Height, img.BaseImage.GDIhDC, img.Rectangle);
			else
				GDI.TabbedTextOutFull(Config.Font, Config.ForeColor, Str, PointX, pointY);
		}
	}
}


text:
package com.devzb.framework.lang.async;

import java.util.concurrent.Callable;

import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.async.CallableProcessingInterceptorAdapter;

public class TimeoutCallableProcessingInterceptor extends
										CallableProcessingInterceptorAdapter {

	@Override
	public <T> Object handleTimeout(NativeWebRequest request, Callable<T> task) throws Exception {
		throw new IllegalStateException("[" + task.getClass().getName()
												+ "] timed out");
	}

}


text:
<?php
namespace Chamilo\Core\User\Integration\Chamilo\Core\Tracking\Package;

/**
 *
 * @package Chamilo\Core\User\Integration\Chamilo\Core\Tracking\Package
 * @author Hans De Bisschop <hans.de.bisschop@ehb.be>
 * @author Magali Gillard <magali.gillard@ehb.be>
 * @author Eduard Vossen <eduard.vossen@ehb.be>
 */
class Installer extends \Chamilo\Core\Tracking\Action\Installer
{
}


text:
template <class T>
struct singleton : public noncopyable {
	static T & instance() {
		static T sto;
		return sto;
	}
    static T & Instance() {return instance();}
};


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Astragalus eriocephalus Waldst. & Kit.

### Remarks
null


text:
from django.db import models
from taggit.managers import _TaggableManager

from ..core.managers import PublicItemManager

class PhotosManager(models.Manager):
    """Returns public AND PRIVATE Photos posted by one of the Users with
    Accounts here.
    As opposed to just Photos, which includes Photos by any User that
    have been favorited by a User with an Account.
    """

    def get_queryset(self):
        from .models import User

        users = User.objects_with_accounts.all()
        return super().get_queryset().filter(user__in=users)

class PublicPhotosManager(PublicItemManager):
    """Returns public Photos posted by one of the Users with Accounts here.
    As opposed to just public Photos, which includes Photos by any User that
    have been favorited by a User with an Account.
    """

    def get_queryset(self):
        from .models import User

        users = User.objects_with_accounts.all()
        return super().get_queryset().filter(user__in=users)

class WithAccountsManager(models.Manager):
    "Returns Flickr Users who have an Account on Ditto."

    def get_queryset(self):
        from .models import Account

        accounts = Account.objects.exclude(user__isnull=True)
        user_ids = [account.user.id for account in accounts]
        return super().get_queryset().filter(pk__in=user_ids)

class _PhotoTaggableManager(_TaggableManager):
    """Providing some extra features related to private Photos."""

    def most_common(self):
        """Gets the most commonly-used tags but:
            * Doesn't count tags on private Photos
        Overriding django-taggit's standard `most_common()` method.
        """
        extra_filters = {
            "photo__is_private": False,
        }

        return (
            self.get_queryset(extra_filters)
            .annotate(num_times=models.Count(self.through.tag_relname()))
            .order_by("-num_times")
        )


text:
/*
 * Do not modify this file. This file is generated from the kinesis-2013-12-02.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using System.Xml.Serialization;

using Amazon.Kinesis.Model;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Transform;
using Amazon.Runtime.Internal.Util;
using ThirdParty.Json.LitJson;

namespace Amazon.Kinesis.Model.Internal.MarshallTransformations
{
    /// <summary>
    /// Response Unmarshaller for HashKeyRange Object
    /// </summary>
    public class HashKeyRangeUnmarshaller : IUnmarshaller<HashKeyRange, XmlUnmarshallerContext>, IUnmarshaller<HashKeyRange, JsonUnmarshallerContext>
    {
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        HashKeyRange IUnmarshaller<HashKeyRange, XmlUnmarshallerContext>.Unmarshall(XmlUnmarshallerContext context)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public HashKeyRange Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
                return null;

            HashKeyRange unmarshalledObject = new HashKeyRange();

            int targetDepth = context.CurrentDepth;
            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("EndingHashKey", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.EndingHashKey = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("StartingHashKey", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    unmarshalledObject.StartingHashKey = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return unmarshalledObject;
        }

        private static HashKeyRangeUnmarshaller _instance = new HashKeyRangeUnmarshaller();

        /// <summary>
        /// Gets the singleton.
        /// </summary>
        public static HashKeyRangeUnmarshaller Instance
        {
            get
            {
                return _instance;
            }
        }
    }
}


text:
package de.tudarmstadt.lt.aspectCategorization;

import java.io.IOException;

/**
 * Created by krayush on 27-08-2015.
 */
public class UsingJarFile {
    public static void main(String[] args)throws IOException
    {
        Runtime rt = Runtime.getRuntime();
        Process pr = rt.exec("java -cp ./A.jar absa15.Do Eval ./pred.xml ./teGld.xml 1 0");
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Annls mycol. 9: 272 (1911)

#### Original name
Lachnocladium brunneum Bres., 1911

### Remarks
null


text:
package com.coolweather.android.gson;

import com.google.gson.annotations.SerializedName;

/**
 * Created by 董长峰 on 2017/9/19.
 */

public class Forecast {
    public String date;
    @SerializedName( "tmp" )
    public Temperature temperature;
    @SerializedName( "cond" )
    public More more;
    public class Temperature{
        public String max;
        public String min;
    }
    public class More{
        @SerializedName( "txt_d" )
        public String info;
    }
}


text:
package com.aliyuncs.fc.request;

import com.aliyuncs.fc.constants.Const;
import com.aliyuncs.fc.exceptions.ClientException;
import com.aliyuncs.fc.http.HttpRequest;
import com.aliyuncs.fc.response.GetFunctionResponse;
import com.google.common.base.Strings;
import java.util.Map;

/**
 * TODO: add javadoc
 */
public class GetFunctionRequest extends HttpRequest {

    private final String serviceName;
    private final String functionName;
    private String qualifier;

    public GetFunctionRequest(String serviceName, String functionName) {
        this.serviceName = serviceName;
        this.functionName = functionName;
    }

    public String getServiceName() {
        return serviceName;
    }

    public String getFunctionName() {
        return functionName;
    }

    public String getQualifier() {
        return qualifier;
    }

    public GetFunctionRequest setQualifier(String qualifier) {
        this.qualifier = qualifier;
        return this;
    }

    public String getPath() {
        if (Strings.isNullOrEmpty(qualifier)) {
            return String.format(Const.SINGLE_FUNCTION_PATH, Const.API_VERSION, this.serviceName,
                this.functionName);
        } else {
            return String.format(Const.SINGLE_FUNCTION_WITH_QUALIFIER_PATH, Const.API_VERSION,
                this.serviceName, this.qualifier, this.functionName);
        }
    }

    public Map<String, String> getQueryParams() {
        return null;
    }

    public byte[] getPayload() {
        return null;
    }

    public void validate() throws ClientException {
        if (Strings.isNullOrEmpty(serviceName)) {
            throw new ClientException("Service name cannot be blank");
        }
        if (Strings.isNullOrEmpty(functionName)) {
            throw new ClientException("Function name cannot be blank");
        }
    }

    public Class<GetFunctionResponse> getResponseClass() {
        return GetFunctionResponse.class;
    }

}


text:
using System;
using System.Collections.Generic;
using SharpKit.Html;
using SharpKit.JavaScript;

namespace qx.ui.mobile.layout
{
    /// <summary>
	/// <para>Base class for all layout managers.</para>
	/// <para>Custom layout managers must derive from
	/// this class and implement the methods <see cref="#_getCssClasses"/>,
	/// <see cref="#_getSupportedChildLayoutProperties"/> and <see cref="#_setLayoutProperty"/>.</para>
	/// </summary>
	[JsType(JsMode.Prototype, Name = "qx.ui.mobile.layout.Abstract", OmitOptionalParameters = true, Export = false)]
    public abstract partial class Abstract : qx.core.Object
    {
		#region Events

		/// <summary>
		/// <para>Fired when the layout is updated. Data contains the “widget”, “action”, “properties”</para>
		/// </summary>
		public event Action<qx.eventx.type.Data> OnUpdateLayout;

		#endregion Events

		#region Methods

		public Abstract() { throw new NotImplementedException(); }

		/// <summary>
		/// <para>Connects the layout to a given child widget. Can be overridden in a concrete
		/// interface implementation.</para>
		/// </summary>
		/// <param name="widget">The widget to connect to</param>
		[JsMethod(Name = "connectToChildWidget")]
		public void ConnectToChildWidget(qx.ui.mobile.core.Widget widget) { throw new NotImplementedException(); }

		/// <summary>
		/// <para>This method is called by the widget to connect the widget with the layout.</para>
		/// </summary>
		/// <param name="widget">The widget to connect to</param>
		[JsMethod(Name = "connectToWidget")]
		public void ConnectToWidget(qx.ui.mobile.core.Widget widget) { throw new NotImplementedException(); }

		/// <summary>
		/// <para>Disconnects the layout from a given child widget. Can be overridden in a concrete
		/// interface implementation.</para>
		/// </summary>
		/// <param name="widget">The widget to connect to</param>
		[JsMethod(Name = "disconnectFromChildWidget")]
		public void DisconnectFromChildWidget(qx.ui.mobile.core.Widget widget) { throw new NotImplementedException(); }

		/// <summary>
		/// <para>Sets the given layout properties to a widget.</para>
		/// </summary>
		/// <param name="widget">The target widget</param>
		/// <param name="properties">The layout properties to set. Key / value pairs.</param>
		[JsMethod(Name = "setLayoutProperties")]
		public void SetLayoutProperties(qx.ui.mobile.core.Widget widget, object properties) { throw new NotImplementedException(); }

		/// <summary>
		/// <para>Updates the layout. Method is called by a widget, when it changes its state.</para>
		/// </summary>
		/// <param name="widget">The target widget</param>
		/// <param name="action">The causing action that triggered the layout update.</param>
		/// <param name="properties">The animation properties to set. Key / value pairs.</param>
		[JsMethod(Name = "updateLayout")]
		public void UpdateLayout(qx.ui.mobile.core.Widget widget, string action, object properties) { throw new NotImplementedException(); }

		#endregion Methods
    }
}