Guosmilesmile commented on code in PR #13426:
URL: https://github.com/apache/iceberg/pull/13426#discussion_r2184879566
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/actions/Actions.java:
##########
@@ -32,21 +33,60 @@ public class Actions {
private final StreamExecutionEnvironment env;
private final Table table;
+ private final TableLoader tableLoader;
+ @Deprecated
private Actions(StreamExecutionEnvironment env, Table table) {
this.env = env;
this.table = table;
+ this.tableLoader = null;
}
+ private Actions(StreamExecutionEnvironment env, TableLoader tableLoader) {
+ this.env = env;
+ this.tableLoader = tableLoader;
+ if (!tableLoader.isOpen()) {
+ tableLoader.open();
+ }
+
+ this.table = tableLoader.loadTable();
+ }
+
+ @Deprecated
public static Actions forTable(StreamExecutionEnvironment env, Table table) {
return new Actions(env, table);
}
+ public static Actions forTable(StreamExecutionEnvironment env, TableLoader
tableLoader) {
+ return new Actions(env, tableLoader);
+ }
+
+ @Deprecated
public static Actions forTable(Table table) {
return new
Actions(StreamExecutionEnvironment.getExecutionEnvironment(CONFIG), table);
}
+ public static Actions forTableLoad(TableLoader tableLoader) {
+ return new
Actions(StreamExecutionEnvironment.getExecutionEnvironment(CONFIG),
tableLoader);
+ }
+
public RewriteDataFilesAction rewriteDataFiles() {
return new RewriteDataFilesAction(env, table);
}
+
+ public RewriteDataFilesActionV2 rewriteDataFilesV2() {
+ return new RewriteDataFilesActionV2(env, tableLoader);
+ }
Review Comment:
I initially thought there would be a need to pass in the time externally,
but later I realized it’s just the current time, so it can be removed.
##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/actions/Actions.java:
##########
@@ -32,21 +33,60 @@ public class Actions {
private final StreamExecutionEnvironment env;
private final Table table;
+ private final TableLoader tableLoader;
+ @Deprecated
private Actions(StreamExecutionEnvironment env, Table table) {
this.env = env;
this.table = table;
+ this.tableLoader = null;
}
+ private Actions(StreamExecutionEnvironment env, TableLoader tableLoader) {
+ this.env = env;
+ this.tableLoader = tableLoader;
+ if (!tableLoader.isOpen()) {
+ tableLoader.open();
+ }
+
+ this.table = tableLoader.loadTable();
+ }
+
+ @Deprecated
public static Actions forTable(StreamExecutionEnvironment env, Table table) {
return new Actions(env, table);
}
+ public static Actions forTable(StreamExecutionEnvironment env, TableLoader
tableLoader) {
+ return new Actions(env, tableLoader);
+ }
+
+ @Deprecated
public static Actions forTable(Table table) {
return new
Actions(StreamExecutionEnvironment.getExecutionEnvironment(CONFIG), table);
}
+ public static Actions forTableLoad(TableLoader tableLoader) {
+ return new
Actions(StreamExecutionEnvironment.getExecutionEnvironment(CONFIG),
tableLoader);
+ }
+
public RewriteDataFilesAction rewriteDataFiles() {
return new RewriteDataFilesAction(env, table);
}
+
+ public RewriteDataFilesActionV2 rewriteDataFilesV2() {
+ return new RewriteDataFilesActionV2(env, tableLoader);
+ }
+
+ public ExpireSnapshotsAction expireSnapshots() {
+ return new ExpireSnapshotsAction(env, tableLoader);
+ }
+
+ public RewriteDataFilesActionV2 rewriteDataFilesV2(long triggerTimestamp) {
+ return new RewriteDataFilesActionV2(env, tableLoader, triggerTimestamp);
+ }
+
+ public ExpireSnapshotsAction expireSnapshots(long triggerTimestamp) {
+ return new ExpireSnapshotsAction(env, tableLoader, triggerTimestamp);
+ }
Review Comment:
I initially thought there would be a need to pass in the time externally,
but later I realized it’s just the current time, so it can be removed.
--
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]