openinx opened a new issue #2334:
URL: https://github.com/apache/iceberg/issues/2334
Currently, we only provide the file-level API to execute the row-level
delete/update/insert for `TestTable`, that means we have to write few deletes
by operating low-level API like the following:
```java
Schema deleteRowSchema = icebergTableUnPartitioned.schema().select("data");
Record dataDelete = GenericRecord.create(deleteRowSchema);
List<Record> deletions = Lists.newArrayList(
dataDelete.copy("data", "BBB"), // id = 2
dataDelete.copy("data", "EEE"), // id = 5
dataDelete.copy("data", "HHH") // id = 8
);
DeleteFile eqDeletes =
FileHelpers.writeDeleteFile(icebergTableUnPartitioned, newOutputFile(),
deletions, deleteRowSchema);
icebergTableUnPartitioned.newRowDelta()
.addDeletes(eqDeletes)
.commit();
assertSetsEqual(Lists.newArrayList(
Row.of(1, "AAA"),
Row.of(3, "CCC"),
Row.of(4, "DDD"),
Row.of(6, "FFF"),
Row.of(7, "GGG"),
Row.of(9, "III")),
sql("SELECT * FROM %s", TABLE_NAME_UNPARTITIONED)
);
```
I think there will be many row-level delete unit tests in future
development. It will be more friendly if we could provide a row-level delete
API in `TestTable` such as:
```java
Table table = new TestTable(...);
table.newRowChanges()
.addDeletes(row1, row2)
.insert(row3)
.commit()
```
That will be only exposed for testing purpose, don't have to expose such
API to end-users.
----------------------------------------------------------------
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]