Skip to content

Commit

Permalink
Migrate collectionOperations
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGekk committed Feb 10, 2024
1 parent 6edfda6 commit 08f120e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
10 changes: 10 additions & 0 deletions common/utils/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -7725,6 +7725,16 @@
"<msg>"
]
},
"_LEGACY_ERROR_TEMP_3242" : {
"message" : [
"sequence step must be an <intervalType> of day granularity if start and end values are dates"
]
},
"_LEGACY_ERROR_TEMP_3243" : {
"message" : [
"Illegal sequence boundaries: <start> to <stop> by <step>"
]
},
"_LEGACY_ERROR_USER_RAISED_EXCEPTION" : {
"message" : [
"<errorMessage>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3352,8 +3352,9 @@ object Sequence {
val (stepMonths, stepDays, stepMicros) = splitStep(input3)

if (scale == MICROS_PER_DAY && stepMonths == 0 && stepDays == 0) {
throw new IllegalArgumentException(s"sequence step must be an ${intervalType.typeName}" +
" of day granularity if start and end values are dates")
throw new SparkIllegalArgumentException(
errorClass = "_LEGACY_ERROR_TEMP_3242",
messageParameters = Map("intervalType" -> intervalType.typeName))
}

if (stepMonths == 0 && stepMicros == 0 && scale == MICROS_PER_DAY) {
Expand Down Expand Up @@ -3445,9 +3446,10 @@ object Sequence {
val check = if (scale == MICROS_PER_DAY) {
s"""
|if ($stepMonths == 0 && $stepDays == 0) {
| throw new IllegalArgumentException(
| "sequence step must be an ${intervalType.typeName} " +
| "of day granularity if start and end values are dates");
| java.util.Map<String, String> params = new java.util.HashMap<String, String>();
| params.put("intervalType", "${intervalType.typeName}");
| throw new org.apache.spark.SparkIllegalArgumentException(
| "_LEGACY_ERROR_TEMP_3242", params);
|}
""".stripMargin
} else {
Expand Down Expand Up @@ -3538,8 +3540,12 @@ object Sequence {
|if (!(($estimatedStep > 0 && $start <= $stop) ||
| ($estimatedStep < 0 && $start >= $stop) ||
| ($estimatedStep == 0 && $start == $stop))) {
| throw new IllegalArgumentException(
| "Illegal sequence boundaries: " + $start + " to " + $stop + " by " + $step);
| java.util.Map<String, String> params = new java.util.HashMap<String, String>();
| params.put("start", $start);
| params.put("stop", $stop);
| params.put("step", $step);
| throw new org.apache.spark.SparkIllegalArgumentException(
| "_LEGACY_ERROR_TEMP_3243", params);
|}
|int $len = $calcFn((long) $start, (long) $stop, (long) $estimatedStep);
""".stripMargin
Expand Down

0 comments on commit 08f120e

Please sign in to comment.