Skip to content

fix: SortMergeJoin for timestamp keys #1901

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 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 @@ -2168,7 +2168,8 @@ object QueryPlanSerde extends Logging with CometExprShim {
*/
private def supportedSortMergeJoinEqualType(dataType: DataType): Boolean = dataType match {
case _: ByteType | _: ShortType | _: IntegerType | _: LongType | _: FloatType |
_: DoubleType | _: StringType | _: DateType | _: DecimalType | _: BooleanType =>
_: DoubleType | _: StringType | _: DateType | _: DecimalType | _: BooleanType |
_: TimestampType =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should TimestampNTZType also be supported?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TimestampNTZType is supported; there is another case 1 line below.

    case TimestampNTZType => true

true
case TimestampNTZType => true
case _ => false
Expand Down Expand Up @@ -2690,14 +2691,14 @@ object QueryPlanSerde extends Logging with CometExprShim {
// Checks if the join keys are supported by DataFusion SortMergeJoin.
val errorMsgs = join.leftKeys.flatMap { key =>
if (!supportedSortMergeJoinEqualType(key.dataType)) {
Some(s"Unsupported join key type ${key.dataType} on key: ${key.sql}")
Some(s"Unsupported join key type ${key.dataType} on key ${key.sql}")
} else {
None
}
}

if (errorMsgs.nonEmpty) {
withInfo(op, errorMsgs.flatten.mkString("\n"))
withInfo(op, errorMsgs.mkString("\n"))
return None
}

Expand Down
Loading