stevenzwu commented on code in PR #5220:
URL: https://github.com/apache/iceberg/pull/5220#discussion_r916344321


##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/source/IcebergSource.java:
##########
@@ -273,12 +287,21 @@ public Builder properties(Map<String, String> properties) 
{
     }
 
     public IcebergSource<T> build() {
+      ScanContext context = contextBuilder.build();
+      if (readerFunction == null) {
+        try (TableLoader loader = tableLoader) {
+          loader.open();
+          Table table = tableLoader.loadTable();
+          RowDataReaderFunction rowDataReaderFunction = new 
RowDataReaderFunction(flinkConfig, table.schema(),
+              context.project(), context.nameMapping(), 
context.caseSensitive(), table.io(), table.encryption());
+          this.readerFunction = (ReaderFunction<T>) rowDataReaderFunction;

Review Comment:
   not sure if there is a better way than runtime type cast.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to