Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1320#discussion_r137279394
--- Diff:
integration/spark-common/src/main/scala/org/apache/spark/util/PartitionUtils.scala
---
@@ -80,37 +80,43 @@ object PartitionUtils {
dateFormatter: SimpleDateFormat): Unit = {
val columnDataType =
partitionInfo.getColumnSchemaList.get(0).getDataType
val index = partitionIdList.indexOf(partitionId)
- if (partitionInfo.getPartitionType == PartitionType.RANGE) {
- val rangeInfo = partitionInfo.getRangeInfo.asScala.toList
- val newRangeInfo = partitionId match {
- case 0 => rangeInfo ++ splitInfo
- case _ => rangeInfo.take(index - 1) ++ splitInfo ++
- rangeInfo.takeRight(rangeInfo.size - index)
+ if (index < 0) {
+ throw new IllegalArgumentException("Invalid Partition Id " +
partitionId +
+ "\n Use show partitions table_name to get the list of valid
partitions")
+ }
+ else {
--- End diff --
else clause is not needed
---