Au-Miner commented on code in PR #26649:
URL: https://github.com/apache/flink/pull/26649#discussion_r2153814026


##########
flink-table/flink-table-runtime/src/test/java/org/apache/flink/table/runtime/operators/join/deltajoin/StreamingDeltaJoinOperatorTest.java:
##########
@@ -0,0 +1,838 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.table.runtime.operators.join.deltajoin;
+
+import org.apache.flink.api.common.functions.OpenContext;
+import org.apache.flink.runtime.checkpoint.OperatorSubtaskState;
+import org.apache.flink.streaming.api.functions.async.ResultFuture;
+import org.apache.flink.streaming.api.functions.async.RichAsyncFunction;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+import org.apache.flink.streaming.runtime.tasks.StreamTaskActionExecutor;
+import org.apache.flink.streaming.runtime.tasks.TestProcessingTimeService;
+import org.apache.flink.streaming.runtime.tasks.mailbox.MailboxExecutorImpl;
+import org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor;
+import org.apache.flink.streaming.runtime.tasks.mailbox.TaskMailbox;
+import org.apache.flink.streaming.runtime.tasks.mailbox.TaskMailboxImpl;
+import org.apache.flink.streaming.util.KeyedTwoInputStreamOperatorTestHarness;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.conversion.DataStructureConverter;
+import org.apache.flink.table.data.conversion.DataStructureConverters;
+import org.apache.flink.table.runtime.collector.TableFunctionCollector;
+import org.apache.flink.table.runtime.collector.TableFunctionResultFuture;
+import org.apache.flink.table.runtime.generated.GeneratedFunctionWrapper;
+import org.apache.flink.table.runtime.generated.GeneratedResultFutureWrapper;
+import org.apache.flink.table.runtime.keyselector.RowDataKeySelector;
+import 
org.apache.flink.table.runtime.operators.join.lookup.keyordered.AecRecord;
+import 
org.apache.flink.table.runtime.operators.join.lookup.keyordered.RecordsBuffer;
+import 
org.apache.flink.table.runtime.operators.join.lookup.keyordered.TableAsyncExecutionController;
+import org.apache.flink.table.runtime.typeutils.InternalTypeInfo;
+import org.apache.flink.table.runtime.util.RowDataHarnessAssertor;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.VarCharType;
+import org.apache.flink.table.utils.HandwrittenSelectorUtil;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import javax.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Stream;
+
+import static 
org.apache.flink.table.runtime.util.StreamRecordUtils.insertRecord;
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Test class for {@link StreamingDeltaJoinOperator}. */
+public class StreamingDeltaJoinOperatorTest {
+
+    private KeyedTwoInputStreamOperatorTestHarness<RowData, RowData, RowData, 
RowData> testHarness;
+
+    private static final int AEC_CAPACITY = 100;
+
+    // the data snapshot of the left/right table when joining
+    // <pk, value>
+    private static final LinkedHashMap<RowData, RowData> leftTableCurrentData =
+            new LinkedHashMap<>();
+    private static final LinkedHashMap<RowData, RowData> rightTableCurrentData 
=
+            new LinkedHashMap<>();
+
+    /**
+     * Mock sql like the following.
+     *
+     * <pre>
+     *      CREATE TABLE leftSrc(
+     *          left_value INT,
+     *          left_jk1 BOOLEAN,
+     *          left_jk2_lk VARCHAR,
+     *          left_pk BIGINT PRIMARY KEY NOT ENFORCED,
+     *          INDEX(left_jk2_lk)
+     *      )
+     * </pre>
+     *
+     * <pre>
+     *      CREATE TABLE rightSrc(
+     *          right_jk2 STRING,
+     *          right_value INT,
+     *          right_jk1_lk VARCHAR,
+     *          INDEX(right_jk1_lk)
+     *      )
+     * </pre>
+     *
+     * <pre>
+     *     select * from leftSrc join rightSrc
+     *      on leftSrc.left_jk1 = rightSrc.right_jk1_lk
+     *      and leftSrc.left_jk2_lk = rightSrc.right_jk2
+     * </pre>
+     *
+     * <p>For right lookup table(left stream side delta join right table), the 
join key is
+     * [right_jk1_lk, right_jk2], and it will be split into lookup key 
[right_jk1_lk] and {@code
+     * DeltaJoinSpec#remainingCondition} [right_jk2].
+     *
+     * <p>For left lookup table(right stream side delta join left table), the 
join key is [left_jk1,
+     * left_jk2_lk], and it will be split into lookup key [left_jk2_lk] and 
{@code
+     * DeltaJoinSpec#remainingCondition} [left_jk1].
+     */
+
+    // left join key: <left_jk1, left_jk2_lk>
+    // left lookup key: <left_jk2_lk>
+    // left table primary key: <left_pk>
+    private static final InternalTypeInfo<RowData> leftTypeInfo =
+            InternalTypeInfo.of(
+                    RowType.of(
+                            new LogicalType[] {
+                                new IntType(),
+                                new BooleanType(),
+                                VarCharType.STRING_TYPE,
+                                new BigIntType()
+                            },
+                            new String[] {"left_value", "left_jk1", 
"left_jk2_lk", "left_pk"}));
+
+    private static final int[] leftJoinKeyIndices = new int[] {1, 2};
+    private static final int[] leftPrimaryKeyIndices = new int[] {3};

Review Comment:
   Indeed, it's a useless column and I will remove 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]

Reply via email to