Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
*
* Licensed 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 com.hazelcast.jet.impl.processor;
import com.hazelcast.function.BiFunctionEx;
import com.hazelcast.jet.Traverser;
import com.hazelcast.jet.core.AbstractProcessor;
import com.hazelcast.jet.datamodel.ItemsByTag;
import com.hazelcast.jet.datamodel.Tag;
import com.hazelcast.jet.function.TriFunction;
import com.hazelcast.jet.impl.pipeline.transform.HashJoinTransform;
import com.hazelcast.jet.impl.processor.HashJoinCollectP.HashJoinArrayList;
import com.hazelcast.jet.pipeline.BatchStage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import static com.hazelcast.internal.util.Preconditions.checkTrue;
import static java.util.Objects.requireNonNull;
/**
* Implements the {@linkplain HashJoinTransform hash-join transform}. On
* all edges except 0 it receives a single item — the lookup table
* for that edge (a {@code Map}) and then it processes edge 0 by joining
* to each item the data from the lookup tables.
*
* It extracts a separate key for each of the lookup tables using the
* functions supplied in the {@code keyFns} argument. Element 0 in that
* list corresponds to the lookup table received at ordinal 1 and so on.
*
* It uses the {@code tags} list to populate the output items. It can be
* {@code null}, in which case {@code keyFns} must have either one or two
* elements, corresponding to the two supported special cases in {@link
* BatchStage} (hash-joining with one or two enriching streams).
*
* After looking up all the joined items the processor calls the supplied
* {@code mapToOutput*Fn} to get the final output item. It uses {@code
* mapToOutputBiFn} both for the single-arity case ({@code tags == null &&
* keyFns.size() == 1}) and the variable-arity case ({@code tags != null}).
* In the latter case the function must expect {@code ItemsByTag} as the
* second argument. It uses {@code mapToOutputTriFn} for the two-arity
* case ({@code tags == null && keyFns.size() == 2}).
*/
@SuppressWarnings("unchecked")
public class HashJoinP extends AbstractProcessor {
private final List> keyFns;
private final List