RussellSpitzer commented on code in PR #4588:
URL: https://github.com/apache/iceberg/pull/4588#discussion_r855416250
##########
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:
That is the path it takes at this moment, but that's the issue here, we want
this test check the output of
```
Dataset<Row> df = spark.read()
.format("iceberg")
.load(TableIdentifier.of("default", name).toString())
.selectExpr(columns);
```
Having this copy the implementation details decouples the test from what
actually may be happening we change the code in the future
--
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]