public static HivePrivObjectActionType getActionType(Entity privObject) { HivePrivObjectActionType actionType = HivePrivObjectActionType.OTHER; if (privObject instanceof WriteEntity) { WriteType writeType = ((WriteEntity) privObject).getWriteType(); switch (writeType) { case INSERT: return HivePrivObjectActionType.INSERT; case INSERT_OVERWRITE: return HivePrivObjectActionType.INSERT_OVERWRITE; case UPDATE: return HivePrivObjectActionType.UPDATE; case DELETE: return HivePrivObjectActionType.DELETE; default: // Ignore other types for purposes of authorization break; } } return actionType; }
public static HivePrivObjectActionType getActionType(Entity privObject) { HivePrivObjectActionType actionType = HivePrivObjectActionType.OTHER; if (privObject instanceof WriteEntity) { WriteType writeType = ((WriteEntity) privObject).getWriteType(); switch (writeType) { case INSERT: return HivePrivObjectActionType.INSERT; case INSERT_OVERWRITE: return HivePrivObjectActionType.INSERT_OVERWRITE; case UPDATE: return HivePrivObjectActionType.UPDATE; case DELETE: return HivePrivObjectActionType.DELETE; default: // Ignore other types for purposes of authorization break; } } return actionType; }
@Override public LockType getLockType(WriteEntity writeEntity) { if (writeEntity.getWriteType().equals(WriteEntity.WriteType.INSERT)) { return LockType.SHARED_READ; } return LockType.SHARED_WRITE; }
@Override public LockType getLockType(WriteEntity writeEntity) { if (writeEntity.getWriteType().equals(WriteEntity.WriteType.INSERT)) { return LockType.SHARED_READ; } return LockType.SHARED_WRITE; }
private HiveLockMode getWriteEntityLockMode (WriteEntity we) { HiveLockMode lockMode = we.isComplete() ? HiveLockMode.EXCLUSIVE : HiveLockMode.SHARED; //but the writeEntity is complete in DDL operations, instead DDL sets the writeType, so //we use it to determine its lockMode, and first we check if the writeType was set WriteEntity.WriteType writeType = we.getWriteType(); if (writeType == null) { return lockMode; } switch (writeType) { case DDL_EXCLUSIVE: return HiveLockMode.EXCLUSIVE; case DDL_SHARED: return HiveLockMode.SHARED; case DDL_NO_LOCK: return null; default: //other writeTypes related to DMLs return lockMode; } }
private HiveLockMode getWriteEntityLockMode (WriteEntity we) { HiveLockMode lockMode = we.isComplete() ? HiveLockMode.EXCLUSIVE : HiveLockMode.SHARED; //but the writeEntity is complete in DDL operations, instead DDL sets the writeType, so //we use it to determine its lockMode, and first we check if the writeType was set WriteEntity.WriteType writeType = we.getWriteType(); if (writeType == null) { return lockMode; } switch (writeType) { case DDL_EXCLUSIVE: return HiveLockMode.EXCLUSIVE; case DDL_SHARED: return HiveLockMode.SHARED; case DDL_NO_LOCK: return null; default: //other writeTypes related to DMLs return lockMode; } }
public String toStringDetail() { return "WriteEntity(" + toString() + ") Type=" + getType() + " WriteType=" + getWriteType(); }
public String toStringDetail() { return "WriteEntity(" + toString() + ") Type=" + getType() + " WriteType=" + getWriteType(); }
@Override public LockType getLockType(WriteEntity writeEntity ) { if (writeEntity.getWriteType().equals(WriteEntity.WriteType.INSERT)) { return LockType.SHARED_READ; } return LockType.SHARED_WRITE; }
public String toDetailedString() { return toString() + " Type=" + getTyp() + " WriteType=" + getWriteType() + " isDP=" + isDynamicPartitionWrite(); }
public String toDetailedString() { return toString() + " Type=" + getTyp() + " WriteType=" + getWriteType() + " isDP=" + isDynamicPartitionWrite(); }
WriteEntity.WriteType wt = we.getWriteType(); if (isTargetTable(we, targetTable) && (wt == WriteEntity.WriteType.UPDATE || wt == WriteEntity.WriteType.DELETE)) { for (WriteEntity original : toRemove) { WriteEntity we = new WriteEntity(re.getPartition(), original.getWriteType()); we.setDynamicPartitionWrite(original.isDynamicPartitionWrite()); outputs.add(we);
/** * This modifies the logic wrt what operations are allowed in a transaction. Multi-statement * transaction support is incomplete but it makes some Acid tests cases much easier to write. */ private boolean allowOperationInATransaction(QueryPlan queryPlan) { //Acid and MM tables support Load Data with transactional semantics. This will allow Load Data //in a txn assuming we can determine the target is a suitable table type. if(queryPlan.getOperation() == HiveOperation.LOAD && queryPlan.getOutputs() != null && queryPlan.getOutputs().size() == 1) { WriteEntity writeEntity = queryPlan.getOutputs().iterator().next(); if(AcidUtils.isTransactionalTable(writeEntity.getTable())) { switch (writeEntity.getWriteType()) { case INSERT: //allow operation in a txn return true; case INSERT_OVERWRITE: //see HIVE-18154 return false; default: //not relevant for LOAD return false; } } } //todo: handle Insert Overwrite as well: HIVE-18154 return false; }
WriteEntity.WriteType wt = we.getWriteType(); if(isTargetTable(we, targetTable) && (wt == WriteEntity.WriteType.UPDATE || wt == WriteEntity.WriteType.DELETE)) { for(WriteEntity original : toRemove) { WriteEntity we = new WriteEntity(re.getPartition(), original.getWriteType()); we.setDynamicPartitionWrite(original.isDynamicPartitionWrite()); outputs.add(we);
for (WriteEntity e : sem.getOutputs()) { if (e.getType() == Entity.Type.PARTITION) { additionalOutputs.add(new WriteEntity(e.getTable(), e.getWriteType()));
WriteEntity.WriteType writeType = writeEntity.getWriteType(); if (writeType != WriteType.UPDATE && writeType != WriteType.DELETE) {
for (WriteEntity e : sem.getOutputs()) { if (e.getType() == Entity.Type.PARTITION) { additionalOutputs.add(new WriteEntity(e.getTable(), e.getWriteType()));
switch (output.getWriteType()) { throw new RuntimeException("Unknown write type " + output.getWriteType().toString());
switch (output.getWriteType()) { case DDL_EXCLUSIVE: case INSERT_OVERWRITE: output.getWriteType().toString());
@Override public LockType getLockType(WriteEntity writeEntity) { if (writeEntity.getWriteType().equals(WriteEntity.WriteType.INSERT)) { return LockType.SHARED_READ; } return LockType.SHARED_WRITE; }