Skip to content

[SPARK-35109][SQL] Fix minor exception messages of HashedRelation and HashJoin #32211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import org.codehaus.janino.InternalCompilerException

import org.apache.spark.{Partition, SparkException, SparkUpgradeException}
import org.apache.spark.executor.CommitDeniedException
import org.apache.spark.memory.SparkOutOfMemoryError
import org.apache.spark.sql.catalyst.analysis.UnresolvedGenerator
import org.apache.spark.sql.catalyst.catalog.CatalogDatabase
import org.apache.spark.sql.catalyst.expressions.{Expression, UnevaluableAggregate}
import org.apache.spark.sql.catalyst.plans.JoinType
import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
import org.apache.spark.sql.connector.catalog.Identifier
import org.apache.spark.sql.connector.expressions.Transform
Expand Down Expand Up @@ -712,16 +712,6 @@ object QueryExecutionErrors {
"Dictionary encoding should not be used because of dictionary overflow.")
}

def hashJoinCannotTakeJoinTypeWithBuildLeftError(joinType: JoinType): Throwable = {
new IllegalArgumentException(
s"HashJoin should not take $joinType as the JoinType with building left side")
}

def hashJoinCannotTakeJoinTypeWithBuildRightError(joinType: JoinType): Throwable = {
new IllegalArgumentException(
s"HashJoin should not take $joinType as the JoinType with building right side")
}

def endOfIteratorError(): Throwable = {
new NoSuchElementException("End of the iterator")
}
Expand All @@ -730,11 +720,15 @@ object QueryExecutionErrors {
new IOException("Could not allocate memory to grow BytesToBytesMap")
}

def cannotAcquireMemoryToBuildHashRelationError(size: Long, got: Long): Throwable = {
def cannotAcquireMemoryToBuildLongHashedRelationError(size: Long, got: Long): Throwable = {
new SparkException(s"Can't acquire $size bytes memory to build hash relation, " +
s"got $got bytes")
}

def cannotAcquireMemoryToBuildUnsafeHashedRelationError(): Throwable = {
new SparkOutOfMemoryError("There is not enough memory to build hash map")
}

def rowLargerThan256MUnsupportedError(): Throwable = {
new UnsupportedOperationException("Does not support row that is larger than 256M")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,7 @@ private[joins] object UnsafeHashedRelation {
row.getBaseObject, row.getBaseOffset, row.getSizeInBytes)
if (!success) {
binaryMap.free()
// scalastyle:off throwerror
throw new SparkOutOfMemoryError("There is not enough memory to build hash map")
// scalastyle:on throwerror
throw QueryExecutionErrors.cannotAcquireMemoryToBuildUnsafeHashedRelationError()
}
} else if (isNullAware) {
return HashedRelationWithAllNullKeys
Expand Down Expand Up @@ -577,7 +575,7 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
val got = acquireMemory(size)
if (got < size) {
freeMemory(got)
throw QueryExecutionErrors.cannotAcquireMemoryToBuildHashRelationError(size, got)
throw QueryExecutionErrors.cannotAcquireMemoryToBuildLongHashedRelationError(size, got)
}
}

Expand Down