aokolnychyi commented on a change in pull request #2379:
URL: https://github.com/apache/iceberg/pull/2379#discussion_r609969412



##########
File path: spark3/src/main/java/org/apache/iceberg/spark/source/SourceUtil.java
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.spark.source;
+
+import java.util.List;
+import java.util.UUID;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.FileScanTask;
+import org.apache.iceberg.IsolationLevel;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.spark.SparkWriteOptions;
+import org.apache.spark.sql.Dataset;
+import org.apache.spark.sql.SparkSession;
+import org.apache.spark.sql.connector.read.Scan;
+import org.apache.spark.sql.connector.write.LogicalWriteInfo;
+import org.apache.spark.sql.connector.write.LogicalWriteInfoImpl$;
+import org.apache.spark.sql.execution.datasources.v2.DataSourceV2ScanRelation$;
+import org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2;
+import org.apache.spark.sql.execution.datasources.v2.WriteToDataSourceV2$;
+import org.apache.spark.sql.types.StructType;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+
+public class SourceUtil {
+
+  private SourceUtil() {
+  }
+
+  public static List<DataFile> rewriteFiles(SparkSession spark, Table table, 
List<FileScanTask> filesToRewrite,

Review comment:
       A summary of what we discussed this morning.
   
   There are 3 options we consider now:
   - Building a Spark plan and executing it
     - Too fragile, depends on low-level details from Spark that frequently 
change 
   - Save file scan tasks to compact into a separate file(s) and pass the 
location of that file to the source that would read the files from there as 
opposed to doing scan planning. That file could be a manifest list or something 
else.
     -  Will have a performance penalty for writing extra files that contain 
what to compact.
   - Have a static map/distributed cache that will be propagated in strategies 
(compaction_id -> tasks) and pass compaction_id as a read option to either the 
current source or to a custom data source responsible for compaction.
     - TBD.




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



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

Reply via email to