Skip to content

Commit

Permalink
Default impl
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGekk committed Dec 22, 2020
1 parent 43a7761 commit 13bfe3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ void createPartitions(
* @return true if partitions were deleted, false if any partition not exists
* @throws NoSuchPartitionException If any partition identifier to alter doesn't exist
* @throws UnsupportedOperationException If partition purging is not supported
*
* @since 3.2.0
*/
boolean purgePartitions(InternalRow[] idents)
throws NoSuchPartitionException, UnsupportedOperationException;
default boolean purgePartitions(InternalRow[] idents)
throws NoSuchPartitionException, UnsupportedOperationException {
throw new UnsupportedOperationException("Partition purge is not supported");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ void createPartition(
* @return true if a partition was deleted, false if no partition exists for the identifier
* @throws NoSuchPartitionException If the partition identifier to alter doesn't exist
* @throws UnsupportedOperationException If partition purging is not supported
*
* @since 3.2.0
*/
boolean purgePartition(InternalRow ident)
throws NoSuchPartitionException, UnsupportedOperationException;
default boolean purgePartition(InternalRow ident)
throws NoSuchPartitionException, UnsupportedOperationException {
throw new UnsupportedOperationException("Partition purge is not supported");
}

/**
* Test whether a partition exists using an {@link InternalRow ident} from the table.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,4 @@ class InMemoryAtomicPartitionTable (
}
idents.forall(dropPartition)
}

override def purgePartitions(idents: Array[InternalRow]): Boolean = {
if (!idents.forall(partitionExists)) {
return false;
}
idents.forall(purgePartition)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ class InMemoryPartitionTable(
}
}

override def purgePartition(ident: InternalRow): Boolean = {
throw new UnsupportedOperationException("Partition purge is not supported")
}

def replacePartitionMetadata(ident: InternalRow, properties: util.Map[String, String]): Unit = {
if (memoryTablePartitions.containsKey(ident)) {
memoryTablePartitions.put(ident, properties)
Expand Down

0 comments on commit 13bfe3e

Please sign in to comment.