kasakrisz commented on PR #6701:
URL: https://github.com/apache/hive/pull/6701#issuecomment-5589038531
> > 2. Can we pass Write Mode (COW or MOR) as a second parameter to
the`WriterBuilder` instead of passing two Operations?
>
> Yes, we can, and it's seems to be a cleaner design. We could be passing
COW flag before rewrite.
>
> @kasakrisz , is this what you have in mind:
Yes, this looks good to me.
>
> FileSinkDesc
>
> ```
> private Context.Operation writeOperation = Context.Operation.OTHER;
> boolean isCopyOnWrite = false;
> ```
>
> SemanticAnalyzer
>
> ```
> boolean isCopyOnWrite =
IcebergTableUtil.isCopyOnWriteMode(ctx.getOperation(),
table.properties()::getOrDefault);
> fileSinkDesc.setIsCopyOnWrite(isCOW);
> ```
>
Note that `IcebergTableUtil` is not accessible from SA but maybe:
```
HiveStorageHandler storageHandler = table.getStorageHandler();
if (storageHandler != null) {
copyOnWriteMode = storageHandler.shouldOverwrite(table,
Context.Operation.<operation>);
}
```
> WriterBuilder
>
> ```
> private WriterBuilder(Table table, UnaryOperator<String> ops) {
> ....
> this.operation = HiveCustomStorageHandlerUtils.getWriteOperation(ops,
tableName);
> this.isCopyOnWrite = HiveCustomStorageHandlerUtils.isCopyOnWrite(ops,
tableName);
> }
> ```
--
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]