JingsongLi commented on a change in pull request #9721: [FLINK-14129][hive]
HiveTableSource should implement ProjectableTable…
URL: https://github.com/apache/flink/pull/9721#discussion_r326450474
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/connectors/hive/HiveTableInputFormat.java
##########
@@ -88,17 +86,23 @@
private transient InputFormat mapredInputFormat;
private transient HiveTablePartition hiveTablePartition;
+ // indices of fields to be returned, with projection applied (if any)
+ // TODO: push projection into underlying input format that supports it
+ private int[] fields;
+
public HiveTableInputFormat(
JobConf jobConf,
CatalogTable catalogTable,
- List<HiveTablePartition> partitions) {
+ List<HiveTablePartition> partitions,
+ int[] projectedFields) {
super(jobConf.getCredentials());
checkNotNull(catalogTable, "catalogTable can not be null.");
this.partitions = checkNotNull(partitions, "partitions can not
be null.");
this.jobConf = new JobConf(jobConf);
this.partitionColNames = catalogTable.getPartitionKeys();
- rowArity = catalogTable.getSchema().getFieldCount();
+ int rowArity = catalogTable.getSchema().getFieldCount();
+ fields = projectedFields != null ? projectedFields :
IntStream.range(0, rowArity).toArray();
Review comment:
Let `projectedFields` never null?
----------------------------------------------------------------
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]
With regards,
Apache Git Services