Search in sources :

Example 1 with JoinConditionWithNullFilters

use of org.apache.flink.table.runtime.operators.join.JoinConditionWithNullFilters in project flink by apache.

the class WindowJoinOperator method open.

@Override
public void open() throws Exception {
    super.open();
    this.collector = new TimestampedCollector<>(output);
    collector.eraseTimestamp();
    final LongSerializer windowSerializer = LongSerializer.INSTANCE;
    InternalTimerService<Long> internalTimerService = getInternalTimerService("window-timers", windowSerializer, this);
    this.windowTimerService = new WindowTimerServiceImpl(internalTimerService, shiftTimeZone);
    // init join condition
    JoinCondition condition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader());
    this.joinCondition = new JoinConditionWithNullFilters(condition, filterNullKeys, this);
    this.joinCondition.setRuntimeContext(getRuntimeContext());
    this.joinCondition.open(new Configuration());
    // init state
    ListStateDescriptor<RowData> leftRecordStateDesc = new ListStateDescriptor<>(LEFT_RECORDS_STATE_NAME, leftSerializer);
    ListState<RowData> leftListState = getOrCreateKeyedState(windowSerializer, leftRecordStateDesc);
    this.leftWindowState = new WindowListState<>((InternalListState<RowData, Long, RowData>) leftListState);
    ListStateDescriptor<RowData> rightRecordStateDesc = new ListStateDescriptor<>(RIGHT_RECORDS_STATE_NAME, rightSerializer);
    ListState<RowData> rightListState = getOrCreateKeyedState(windowSerializer, rightRecordStateDesc);
    this.rightWindowState = new WindowListState<>((InternalListState<RowData, Long, RowData>) rightListState);
    // metrics
    this.leftNumLateRecordsDropped = metrics.counter(LEFT_LATE_ELEMENTS_DROPPED_METRIC_NAME);
    this.leftLateRecordsDroppedRate = metrics.meter(LEFT_LATE_ELEMENTS_DROPPED_RATE_METRIC_NAME, new MeterView(leftNumLateRecordsDropped));
    this.rightNumLateRecordsDropped = metrics.counter(RIGHT_LATE_ELEMENTS_DROPPED_METRIC_NAME);
    this.rightLateRecordsDroppedRate = metrics.meter(RIGHT_LATE_ELEMENTS_DROPPED_RATE_METRIC_NAME, new MeterView(rightNumLateRecordsDropped));
    this.watermarkLatency = metrics.gauge(WATERMARK_LATENCY_METRIC_NAME, () -> {
        long watermark = windowTimerService.currentWatermark();
        if (watermark < 0) {
            return 0L;
        } else {
            return windowTimerService.currentProcessingTime() - watermark;
        }
    });
}
Also used : LongSerializer(org.apache.flink.api.common.typeutils.base.LongSerializer) Configuration(org.apache.flink.configuration.Configuration) ListStateDescriptor(org.apache.flink.api.common.state.ListStateDescriptor) WindowTimerServiceImpl(org.apache.flink.table.runtime.operators.window.slicing.WindowTimerServiceImpl) MeterView(org.apache.flink.metrics.MeterView) GeneratedJoinCondition(org.apache.flink.table.runtime.generated.GeneratedJoinCondition) JoinCondition(org.apache.flink.table.runtime.generated.JoinCondition) JoinConditionWithNullFilters(org.apache.flink.table.runtime.operators.join.JoinConditionWithNullFilters) GenericRowData(org.apache.flink.table.data.GenericRowData) RowData(org.apache.flink.table.data.RowData) JoinedRowData(org.apache.flink.table.data.utils.JoinedRowData) InternalListState(org.apache.flink.runtime.state.internal.InternalListState)

Example 2 with JoinConditionWithNullFilters

use of org.apache.flink.table.runtime.operators.join.JoinConditionWithNullFilters in project flink by apache.

the class AbstractStreamingJoinOperator method open.

@Override
public void open() throws Exception {
    super.open();
    JoinCondition condition = generatedJoinCondition.newInstance(getRuntimeContext().getUserCodeClassLoader());
    this.joinCondition = new JoinConditionWithNullFilters(condition, filterNullKeys, this);
    this.joinCondition.setRuntimeContext(getRuntimeContext());
    this.joinCondition.open(new Configuration());
    this.collector = new TimestampedCollector<>(output);
}
Also used : JoinConditionWithNullFilters(org.apache.flink.table.runtime.operators.join.JoinConditionWithNullFilters) Configuration(org.apache.flink.configuration.Configuration) GeneratedJoinCondition(org.apache.flink.table.runtime.generated.GeneratedJoinCondition) JoinCondition(org.apache.flink.table.runtime.generated.JoinCondition)

Aggregations

Configuration (org.apache.flink.configuration.Configuration)2 GeneratedJoinCondition (org.apache.flink.table.runtime.generated.GeneratedJoinCondition)2 JoinCondition (org.apache.flink.table.runtime.generated.JoinCondition)2 JoinConditionWithNullFilters (org.apache.flink.table.runtime.operators.join.JoinConditionWithNullFilters)2 ListStateDescriptor (org.apache.flink.api.common.state.ListStateDescriptor)1 LongSerializer (org.apache.flink.api.common.typeutils.base.LongSerializer)1 MeterView (org.apache.flink.metrics.MeterView)1 InternalListState (org.apache.flink.runtime.state.internal.InternalListState)1 GenericRowData (org.apache.flink.table.data.GenericRowData)1 RowData (org.apache.flink.table.data.RowData)1 JoinedRowData (org.apache.flink.table.data.utils.JoinedRowData)1 WindowTimerServiceImpl (org.apache.flink.table.runtime.operators.window.slicing.WindowTimerServiceImpl)1