pseudomuto commented on issue #10110:
URL: https://github.com/apache/iceberg/issues/10110#issuecomment-2048366352
Sure thing! I've removed imports and a few things for brevity
```java
private static final String NESSIE_PREFIX = "spark.sql.catalog.nessie.";
Table getTable(String ...names) {
var nessieProps = JavaConverters
.asJava(spark.conf().getAll())
.entrySet()
.stream()
.filter(entry -> entry.getKey().startsWith(NESSIE_PREFIX))
.map(entry ->
Map.entry(entry.getKey().substring(NESSIE_PREFIX.length()), entry.getValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
try (var catalog = new NessieCatalog()) {
catalog.initialize("nessie", nessieProps);
return catalog.loadTable(TableIdentifier.of(names));
} catch (IOException exc) {
throw new RuntimeException(exc);
}
}
// in the main method
var table = getTable(args[0].split("\\."));
var actions = SparkActions.get(spark);
actions
.rewriteDataFiles(table)
.option(RewriteDataFilesSparkAction.MAX_CONCURRENT_FILE_GROUP_REWRITES,
"1000")
.option(RewriteDataFilesSparkAction.TARGET_FILE_SIZE_BYTES, "536870912")
.filter(Expressions.equal(Expressions.day("occurred_at"), getEpochDay()))
.execute();
actions
.rewriteManifests(table)
.rewriteIf(file -> file.length() > MAX_MANIFEST_FILE_SIZE)
.execute();
```
--
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]