Skip to content

Commit

Permalink
Validate no partition value is null when making partition name
Browse files Browse the repository at this point in the history
Extracted-From: prestodb/presto#11376
  • Loading branch information
jessesleeping authored and sopel39 committed Jan 29, 2019
1 parent 4220e1a commit de589d4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Properties;

Expand Down Expand Up @@ -178,6 +179,8 @@ public static ProtectMode getProtectMode(Table table)
public static String makePartName(List<Column> partitionColumns, List<String> values)
{
checkArgument(partitionColumns.size() == values.size(), "Partition value count does not match the partition column count");
checkArgument(values.stream().allMatch(Objects::nonNull), "partitionValue must not have null elements");

List<String> partitionColumnNames = partitionColumns.stream().map(Column::getName).collect(toList());
return FileUtils.makePartName(partitionColumnNames, values);
}
Expand Down

0 comments on commit de589d4

Please sign in to comment.