Source:
private DataStream<RowData> createStreamSourceForNonPartitionTable( StreamExecutionEnvironment execEnv, TypeInformation<RowData> typeInfo, HiveTableInputFormat inputFormat, HiveTablePartition hiveTable) { HiveTableFileInputFormat fileInputFormat = new HiveTableFileInputFormat( inputFormat, hiveTable); fileInputFormat.setFilePath(getFilePath()); final Map<String, String> properties = catalogTable.getOptions(); String consumeOrderStr = properties.getOrDefault( STREAMING_SOURCE_CONSUME_ORDER.key(), STREAMING_SOURCE_CONSUME_ORDER.defaultValue()); ConsumeOrder consumeOrder = ConsumeOrder.getConsumeOrder(consumeOrderStr); if (consumeOrder != ConsumeOrder.CREATE_TIME_ORDER) { throw new UnsupportedOperationException("Unsupported consumer order: " + consumeOrder); } String consumeOffset = properties.getOrDefault( STREAMING_SOURCE_CONSUME_START_OFFSET.key(), STREAMING_SOURCE_CONSUME_START_OFFSET.defaultValue()); long currentReadTime = Long.MIN_VALUE; if (consumeOffset != null) { currentReadTime = toMills(consumeOffset); } String monitorIntervalStr = properties.get(STREAMING_SOURCE_MONITOR_INTERVAL.key()); Duration monitorInterval = monitorIntervalStr != null ? TimeUtils.parseDuration(monitorIntervalStr) : STREAMING_SOURCE_MONITOR_INTERVAL.defaultValue(); ContinuousFileMonitoringFunction<RowData> monitoringFunction = new ContinuousFileMonitoringFunction<>( fileInputFormat, FileProcessingMode.PROCESS_CONTINUOUSLY, execEnv.getParallelism(), monitorInterval.toMillis(), currentReadTime); ContinuousFileReaderOperatorFactory<RowData, TimestampedFileInputSplit> factory = new ContinuousFileReaderOperatorFactory<>(fileInputFormat); String sourceName = "HiveFileMonitoringFunction"; SingleOutputStreamOperator<RowData> source = execEnv.addSource(monitoringFunction, sourceName) .transform("Split Reader: " + sourceName, typeInfo, factory); return new DataStreamSource<>(source); }

Target:
private DataStream<RowData> createStreamSourceForNonPartitionTable( StreamExecutionEnvironment execEnv, TypeInformation<RowData> typeInfo, HiveTableInputFormat inputFormat, HiveTablePartition hiveTable) { HiveTableFileInputFormat fileInputFormat = new HiveTableFileInputFormat(inputFormat, hiveTable); Configuration configuration = new Configuration(); catalogTable.getOptions().forEach(configuration::setString); String consumeOrderStr = configuration.get(STREAMING_SOURCE_CONSUME_ORDER); ConsumeOrder consumeOrder = ConsumeOrder.getConsumeOrder(consumeOrderStr); if (consumeOrder != ConsumeOrder.CREATE_TIME_ORDER) { throw new UnsupportedOperationException( "Only " + ConsumeOrder.CREATE_TIME_ORDER + " is supported for non partition table."); } String consumeOffset = configuration.get(STREAMING_SOURCE_CONSUME_START_OFFSET); long currentReadTime = toMills(consumeOffset); Duration monitorInterval = configuration.get(STREAMING_SOURCE_MONITOR_INTERVAL); ContinuousFileMonitoringFunction<RowData> monitoringFunction = new ContinuousFileMonitoringFunction<>( fileInputFormat, FileProcessingMode.PROCESS_CONTINUOUSLY, execEnv.getParallelism(), monitorInterval.toMillis(), currentReadTime); ContinuousFileReaderOperatorFactory<RowData, TimestampedFileInputSplit> factory = new ContinuousFileReaderOperatorFactory<>(fileInputFormat); String sourceName = "HiveFileMonitoringFunction"; SingleOutputStreamOperator<RowData> source = execEnv.addSource(monitoringFunction, sourceName) .transform("Split Reader: " + sourceName, typeInfo, factory); return new DataStreamSource<>(source); }