in parquet-hadoop/src/main/java/org/apache/parquet/hadoop/rewrite/RewriteOptions.java [599:649]
private void checkPreconditions() {
Preconditions.checkArgument(inputFiles != null && !inputFiles.isEmpty(), "Input file is required");
Preconditions.checkArgument(outputFile != null, "Output file is required");
if (pruneColumns != null) {
if (maskColumns != null) {
for (String pruneColumn : pruneColumns) {
Preconditions.checkArgument(
!maskColumns.containsKey(pruneColumn), "Cannot prune and mask same column");
}
}
if (encryptColumns != null) {
for (String pruneColumn : pruneColumns) {
Preconditions.checkArgument(
!encryptColumns.contains(pruneColumn), "Cannot prune and encrypt same column");
}
}
}
if (renameColumns != null) {
Set<String> nullifiedColumns = maskColumns == null
? new HashSet<>()
: maskColumns.entrySet().stream()
.filter(x -> x.getValue() == MaskMode.NULLIFY)
.map(Map.Entry::getKey)
.collect(Collectors.toSet());
renameColumns.forEach((colSrc, colDst) -> {
Preconditions.checkArgument(
colSrc != null && !colSrc.trim().isEmpty(), "Renamed column source name can't be empty");
Preconditions.checkArgument(
colDst != null && !colDst.trim().isEmpty(), "Renamed column target name can't be empty");
Preconditions.checkArgument(
!nullifiedColumns.contains(colSrc), "Cannot nullify and rename the same column");
Preconditions.checkArgument(
!colSrc.contains(".") && !colDst.contains("."),
"Renamed column can't be nested, in case of GroupType column only a top level column can be renamed");
});
}
if (encryptColumns != null && !encryptColumns.isEmpty()) {
Preconditions.checkArgument(
fileEncryptionProperties != null,
"FileEncryptionProperties is required when encrypting columns");
}
if (fileEncryptionProperties != null) {
Preconditions.checkArgument(
encryptColumns != null && !encryptColumns.isEmpty(),
"Encrypt columns is required when FileEncryptionProperties is set");
}
}