wypoon commented on code in PR #4588:
URL: https://github.com/apache/iceberg/pull/4588#discussion_r855486081
##########
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/source/TestSparkReaderDeletes.java:
##########
@@ -139,18 +151,55 @@ protected void dropTable(String name) {
}
@Override
- public StructLikeSet rowSet(String name, Table table, String... columns) {
- Dataset<Row> df = spark.read()
- .format("iceberg")
- .load(TableIdentifier.of("default", name).toString())
- .selectExpr(columns);
+ protected boolean countDeletes() {
+ return true;
+ }
- Types.StructType projection = table.schema().select(columns).asStruct();
- StructLikeSet set = StructLikeSet.create(projection);
- df.collectAsList().forEach(row -> {
- SparkStructLike rowWrapper = new SparkStructLike(projection);
- set.add(rowWrapper.wrap(row));
- });
+ private void setDeleteCount(long count) {
+ deleteCount = count;
+ }
+
+ @Override
+ protected long deleteCount() {
+ return deleteCount;
+ }
+
+ @Override
+ public StructLikeSet rowSet(String name, Table table, String... columns)
throws IOException {
+ Schema schema = table.schema().select(columns);
+ StructType sparkSchema = SparkSchemaUtil.convert(schema);
+ Types.StructType type = schema.asStruct();
+ StructLikeSet set = StructLikeSet.create(type);
+
+ CloseableIterable<CombinedScanTask> tasks = TableScanUtil.planTasks(
+ table.newScan().planFiles(),
+ TableProperties.METADATA_SPLIT_SIZE_DEFAULT,
+ TableProperties.SPLIT_LOOKBACK_DEFAULT,
+ TableProperties.SPLIT_OPEN_FILE_COST_DEFAULT);
+
+ long delCount = 0L;
Review Comment:
Here is another option:
I'll leave `TestSparkReaderDeletes` alone, and instead create a new class
that also extends `DeleteReadTests` (or even `TestSparkReaderDeletes`) and
override `rowSet` there. It is perhaps also not necessary to run all the tests
in `DeleteReadTests` or `TestSparkReaderDeletes` in this new class. I had also
increased the parameter space of `TestSparkReaderDeletes` in order to cover all
3 file formats, but I can dial it back and distribute the increased coverage to
the new class. Basically, there will be no loss of test coverage.
--
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]