com.datatorrent.lib.streamquery.InnerJoinOperator Maven / Gradle / Ivy
/**
* 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 com.datatorrent.lib.streamquery;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.datatorrent.api.Context.OperatorContext;
import com.datatorrent.api.DefaultInputPort;
import com.datatorrent.api.DefaultOutputPort;
import com.datatorrent.api.Operator;
import com.datatorrent.api.annotation.OperatorAnnotation;
import com.datatorrent.lib.streamquery.condition.Condition;
import com.datatorrent.lib.streamquery.index.Index;
/**
* An implementation of Operator that reads table row data from two table data input ports.
*
* Operator joins row on given condition and selected names, emits
* joined result at output port.
*
* StateFull : Yes, Operator aggregates input over application window.
* Partitions : No, will yield wrong result(s).
*
* Ports :
* inport1 : Input port for table 1, expects HashMap<String, Object>
* inport1 : Input port for table 2, expects HashMap<String, Object>
* outport : Output joined row port, emits HashMap<String, ArrayList<Object>>
*
* Properties :
* joinCondition : Join condition for table rows.
* table1Columns : Columns to be selected from table1.
* table2Columns : Columns to be selected from table2.
*
* @displayName Inner join
* @category Stream Manipulators
* @tags sql, inner join operator
*
* @since 0.3.3
*/
@OperatorAnnotation(partitionable = false)
public class InnerJoinOperator implements Operator
{
/**
* Join Condition;
*/
protected Condition joinCondition;
/**
* Table1 select columns.
*/
private ArrayList table1Columns = new ArrayList();
/**
* Table2 select columns.
*/
private ArrayList table2Columns = new ArrayList();
/**
* Collect data rows from input port 1.
*/
protected ArrayList