deniskuzZ commented on PR #6701:
URL: https://github.com/apache/hive/pull/6701#issuecomment-5527274416
> @Aggarwal-Raghav , @deniskuzZ
>
> My concern with how we currently determine the writer implementation is
that we select it at compile time, but it can later be overridden in
`WriterBuilder`.
>
> I explored an alternative approach. Right now, the writer implementation
depends on two factors:
>
> * Write operation
> * Copy-On-Write mode (IIUC, this PR calculates COW inside `WriterBuilder`
using the statement operation)
>
> What if we add a new enum constant inside `Context.Operation` to merge the
two?
>
> ```
> public enum Operation {UPDATE, DELETE, MERGE, IOW, OTHER, COW}
> ```
>
> And move this logic
>
> ```
> boolean isCOW = IcebergTableUtil.isCopyOnWriteMode(operation,
table.properties()::getOrDefault);
> ```
>
> from `WriterBuilder` to `SemanticAnalyzer`
>
> ```
> private Context.Operation getWriteOperation(String destination, Table
destinatonTable) {
> if (destinatonTable != null &&
> destinatonTable.getStorageHandler() != null &&
>
destinatonTable.getStorageHandler().shouldOverwrite(destinatonTable,
ctx.getOperation())) {
> return Context.Operation.COW;
> }
>
> return deleting(destination) ? Context.Operation.DELETE :
> updating(destination) ? Context.Operation.UPDATE :
> merging(destination) ? Context.Operation.MERGE :
Context.Operation.OTHER;
> }
> ```
>
> We can check whether the operation is `Operation.COW` in the
`WriterBuilder` and in `HiveIcebergSerDe`.
>
> WDYT?
COW is not an OPERATION , it's a write mode: COW or MOR
--
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]