Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions core/src/main/scala/org/apache/spark/SparkException.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@ private[spark] class SparkFileAlreadyExistsException(
override def getErrorClass: String = errorClass
}

/**
* Illegal state exception thrown from Spark with an error class.
*/
private[spark] class SparkIllegalStateException(
errorClass: String,
messageParameters: Array[String])
extends IllegalStateException(
SparkThrowableHelper.getMessage(errorClass, messageParameters)) with SparkThrowable {

override def getErrorClass: String = errorClass
}

/**
* File not found exception thrown from Spark with an error class.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.apache.spark.sql.catalyst.plans.logical._
import org.apache.spark.sql.catalyst.trees.TreeNodeTag
import org.apache.spark.sql.catalyst.util.{CharVarcharUtils, StringUtils, TypeUtils}
import org.apache.spark.sql.connector.catalog.{LookupCatalog, SupportsPartitionManagement}
import org.apache.spark.sql.errors.{QueryCompilationErrors, QueryExecutionErrors}
import org.apache.spark.sql.errors.QueryCompilationErrors
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types._
import org.apache.spark.sql.util.SchemaUtils
Expand Down Expand Up @@ -571,8 +571,8 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
|in operator ${operator.simpleString(SQLConf.get.maxToStringFields)}
""".stripMargin)

case _: UnresolvedHint =>
throw QueryExecutionErrors.logicalHintOperatorNotRemovedDuringAnalysisError
case _: UnresolvedHint => throw new IllegalStateException(
"Logical hint operator should be removed during analysis.")

case f @ Filter(condition, _)
if PlanHelper.specialExpressionsInUnsupportedOperator(f).nonEmpty =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.apache.hadoop.fs.permission.FsPermission
import org.codehaus.commons.compiler.CompileException
import org.codehaus.janino.InternalCompilerException

import org.apache.spark.{Partition, SparkArithmeticException, SparkArrayIndexOutOfBoundsException, SparkClassNotFoundException, SparkConcurrentModificationException, SparkDateTimeException, SparkException, SparkFileAlreadyExistsException, SparkFileNotFoundException, SparkIllegalArgumentException, SparkIllegalStateException, SparkIndexOutOfBoundsException, SparkNoSuchElementException, SparkNoSuchMethodException, SparkNumberFormatException, SparkRuntimeException, SparkSecurityException, SparkSQLException, SparkSQLFeatureNotSupportedException, SparkUnsupportedOperationException, SparkUpgradeException}
import org.apache.spark.{Partition, SparkArithmeticException, SparkArrayIndexOutOfBoundsException, SparkClassNotFoundException, SparkConcurrentModificationException, SparkDateTimeException, SparkException, SparkFileAlreadyExistsException, SparkFileNotFoundException, SparkIllegalArgumentException, SparkIndexOutOfBoundsException, SparkNoSuchElementException, SparkNoSuchMethodException, SparkNumberFormatException, SparkRuntimeException, SparkSecurityException, SparkSQLException, SparkSQLFeatureNotSupportedException, SparkUnsupportedOperationException, SparkUpgradeException}
import org.apache.spark.executor.CommitDeniedException
import org.apache.spark.launcher.SparkLauncher
import org.apache.spark.memory.SparkOutOfMemoryError
Expand Down Expand Up @@ -68,12 +68,6 @@ import org.apache.spark.util.CircularBuffer
*/
object QueryExecutionErrors extends QueryErrorsBase {

def logicalHintOperatorNotRemovedDuringAnalysisError(): Throwable = {
new SparkIllegalStateException(errorClass = "INTERNAL_ERROR",
messageParameters = Array(
"Internal error: logical hint operator should have been removed during analysis"))
}

def cannotEvaluateExpressionError(expression: Expression): Throwable = {
new SparkUnsupportedOperationException(errorClass = "INTERNAL_ERROR",
messageParameters = Array(s"Cannot evaluate expression: $expression"))
Expand Down Expand Up @@ -137,7 +131,8 @@ object QueryExecutionErrors extends QueryErrorsBase {
}

def cannotParseDecimalError(): Throwable = {
new SparkIllegalStateException(errorClass = "CANNOT_PARSE_DECIMAL",
new SparkRuntimeException(
errorClass = "CANNOT_PARSE_DECIMAL",
messageParameters = Array.empty)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ private[sql] object ArrowUtils {
case BinaryType => ArrowType.Binary.INSTANCE
case DecimalType.Fixed(precision, scale) => new ArrowType.Decimal(precision, scale)
case DateType => new ArrowType.Date(DateUnit.DAY)
case TimestampType =>
if (timeZoneId == null) {
throw QueryExecutionErrors.timeZoneIdNotSpecifiedForTimestampTypeError()
} else {
new ArrowType.Timestamp(TimeUnit.MICROSECOND, timeZoneId)
}
case TimestampType if timeZoneId == null =>
throw new IllegalStateException("Missing timezoneId where it is mandatory.")
case TimestampType => new ArrowType.Timestamp(TimeUnit.MICROSECOND, timeZoneId)
case TimestampNTZType =>
new ArrowType.Timestamp(TimeUnit.MICROSECOND, null)
case NullType => ArrowType.Null.INSTANCE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class ArrowUtilsSuite extends SparkFunSuite {
roundtrip(DateType)
roundtrip(YearMonthIntervalType())
roundtrip(DayTimeIntervalType())
val tsExMsg = intercept[UnsupportedOperationException] {
val tsExMsg = intercept[IllegalStateException] {
roundtrip(TimestampType)
}
assert(tsExMsg.getMessage.contains("timeZoneId"))
assert(tsExMsg.getMessage.contains("timezoneId"))
}

test("timestamp") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import org.apache.spark.sql.functions.{lit, lower, struct, sum}
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.SQLConf.LegacyBehaviorPolicy.EXCEPTION
import org.apache.spark.sql.test.SharedSparkSession
import org.apache.spark.sql.types.{StructType, TimestampType}
import org.apache.spark.sql.util.ArrowUtils

class QueryExecutionErrorsSuite extends QueryTest
with ParquetTest with OrcTest with SharedSparkSession {
Expand Down Expand Up @@ -228,18 +226,6 @@ class QueryExecutionErrorsSuite extends QueryTest
}
}

test("UNSUPPORTED_OPERATION: timeZoneId not specified while converting TimestampType to Arrow") {
val schema = new StructType().add("value", TimestampType)
val e = intercept[SparkUnsupportedOperationException] {
ArrowUtils.toArrowSchema(schema, null)
}

assert(e.getErrorClass === "UNSUPPORTED_OPERATION")
assert(e.getMessage === "The operation is not supported: " +
"\"TIMESTAMP\" must supply timeZoneId parameter " +
"while converting to the arrow timestamp type.")
}

test("UNSUPPORTED_OPERATION - SPARK-36346: can't read Timestamp as TimestampNTZ") {
withTempPath { file =>
sql("select timestamp_ltz'2019-03-21 00:02:03'").write.orc(file.getCanonicalPath)
Expand Down