JingsongLi commented on a change in pull request #13963:
URL: https://github.com/apache/flink/pull/13963#discussion_r519241466
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableSource.java
##########
@@ -151,23 +139,63 @@ public boolean isBounded() {
catalogTable,
hiveShim,
remainingPartitions);
+ Configuration configuration =
Configuration.fromMap(catalogTable.getOptions());
- @SuppressWarnings("unchecked")
- TypeInformation<RowData> typeInfo =
- (TypeInformation<RowData>)
TypeInfoDataTypeConverter.fromDataTypeToTypeInfo(getProducedDataType());
+ Duration monitorInterval = null;
+ ContinuousPartitionFetcher<Partition, ?> fetcher = null;
+ HiveContinuousPartitionFetcherContext<?> fetcherContext = null;
+ if (isStreamingSource()) {
+ monitorInterval =
configuration.get(STREAMING_SOURCE_MONITOR_INTERVAL) == null
+ ? DEFAULT_SCAN_MONITOR_INTERVAL
+ :
configuration.get(STREAMING_SOURCE_MONITOR_INTERVAL);
+ fetcher = new HiveContinuousPartitionFetcher();
+
+ final String defaultPartitionName =
jobConf.get(HiveConf.ConfVars.DEFAULTPARTITIONNAME.varname,
+
HiveConf.ConfVars.DEFAULTPARTITIONNAME.defaultStrVal);
+ fetcherContext = new
HiveContinuousPartitionFetcherContext(
+ tablePath,
+ hiveShim,
+ new JobConfWrapper(jobConf),
+ catalogTable.getPartitionKeys(),
+
getProducedTableSchema().getFieldDataTypes(),
+
getProducedTableSchema().getFieldNames(),
+ configuration,
+ defaultPartitionName);
+ }
- HiveTableInputFormat inputFormat = getInputFormat(
+ HiveSource hiveSource = new HiveSource(
+ jobConf,
+ tablePath,
+ catalogTable,
allHivePartitions,
-
flinkConf.get(HiveOptions.TABLE_EXEC_HIVE_FALLBACK_MAPRED_READER));
+ limit,
+ hiveVersion,
+
flinkConf.get(HiveOptions.TABLE_EXEC_HIVE_FALLBACK_MAPRED_READER),
+ isStreamingSource() ? new
ContinuousEnumerationSettings(monitorInterval) : null,
+ fetcher,
+ fetcherContext,
+ (RowType) getProducedDataType().getLogicalType()
+ );
+ DataStreamSource<RowData> source = execEnv.fromSource(
+ hiveSource, WatermarkStrategy.noWatermarks(),
"HiveSource-" + tablePath.getFullName());
if (isStreamingSource()) {
Review comment:
Why not move these check to upper?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]