Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-981] Add more codegen checking in BHJ & SHJ #995

Merged
merged 2 commits into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -141,12 +141,31 @@ case class ColumnarBroadcastHashJoinExec(
// build check for expr
if (buildKeyExprs != null) {
for (expr <- buildKeyExprs) {
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
val columnarBuildKeyExpr = ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
// Only do the check for the join having condition.
if (condition.isDefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if there's no condition defined, this check will pass even the exprs does not support codegen, seems not enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, for no condition case, we still need to add the checking in supportColumnarCodegen of join operator. Will add it soon.

val supportCodegen =
columnarBuildKeyExpr.asInstanceOf[ColumnarExpression].supportColumnarCodegen(null)
if (!supportCodegen) {
throw new UnsupportedOperationException("Fall back due to codegen is" +
" not supported for " + columnarBuildKeyExpr)
}
}
}
}
if (streamedKeyExprs != null) {
for (expr <- streamedKeyExprs) {
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
val columnarStreamedKeyExpr =
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
// Only do the below check for the join having condition.
if (condition.isDefined) {
val supportCodegen =
columnarStreamedKeyExpr.asInstanceOf[ColumnarExpression].supportColumnarCodegen(null)
if (!supportCodegen) {
throw new UnsupportedOperationException("Fall back due to codegen is" +
" not supported for " + columnarStreamedKeyExpr)
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ case class ColumnarShuffledHashJoinExec(
// build check for condition
val conditionExpr: Expression = condition.orNull
if (conditionExpr != null) {
ColumnarExpressionConverter.replaceWithColumnarExpression(conditionExpr)
val columnarConditionExpr =
ColumnarExpressionConverter.replaceWithColumnarExpression(conditionExpr)
val supportCodegen =
columnarConditionExpr.asInstanceOf[ColumnarExpression].supportColumnarCodegen(null)
if (!supportCodegen) {
throw new UnsupportedOperationException(
"Condition expression is not fully supporting codegen!")
}
}
// build check types
for (attr <- streamedPlan.output) {
Expand All @@ -153,12 +160,31 @@ case class ColumnarShuffledHashJoinExec(
// build check for expr
if (buildKeyExprs != null) {
for (expr <- buildKeyExprs) {
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
val columnarBuildKeyExpr = ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
// Only do the check for the join having condition.
if (condition.isDefined) {
val supportCodegen =
columnarBuildKeyExpr.asInstanceOf[ColumnarExpression].supportColumnarCodegen(null)
if (!supportCodegen) {
throw new UnsupportedOperationException("Fall back due to codegen is" +
" not supported for " + columnarBuildKeyExpr)
}
}
}
}
if (streamedKeyExprs != null) {
for (expr <- streamedKeyExprs) {
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
val columnarStreamedKeyExpr =
ColumnarExpressionConverter.replaceWithColumnarExpression(expr)
// Only do the below check for the join having condition.
if (condition.isDefined) {
val supportCodegen =
columnarStreamedKeyExpr.asInstanceOf[ColumnarExpression].supportColumnarCodegen(null)
if (!supportCodegen) {
throw new UnsupportedOperationException("Fall back due to codegen is" +
" not supported for " + columnarStreamedKeyExpr)
}
}
}
}
}
Expand Down Expand Up @@ -286,7 +312,7 @@ case class ColumnarShuffledHashJoinExec(
}

override def doExecuteColumnar(): RDD[ColumnarBatch] = {
// we will use previous codegen join to handle joins with condition
// we will use previous codegen join to handle joins with condition
if (condition.isDefined) {
return getCodeGenIterator
}
Expand Down