Skip to content

Commit

Permalink
fix NPE issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JkSelf committed Aug 13, 2024
1 parent 1e5a7c9 commit 15b9b94
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ object AggregateFunctionsBuilder {
// First handle the custom aggregate functions
val (substraitAggFuncName, inputTypes) =
if (
ExpressionMappings.expressionExtensionTransformer.extensionExpressionsMapping.contains(
ExpressionMappings.expressionExtensionTransformer != null &&
ExpressionMappings.expressionExtensionTransformer.extensionExpressionsMapping.contains(
aggregateFunc.getClass)
) {
val (substraitAggFuncName, inputTypes) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ object ExpressionConverter extends SQLConfHelper with Logging {

expr match {
case extendedExpr
if ExpressionMappings.expressionExtensionTransformer.extensionExpressionsMapping.contains(
extendedExpr.getClass) =>
if ExpressionMappings.expressionExtensionTransformer != null
&& ExpressionMappings.expressionExtensionTransformer.extensionExpressionsMapping
.contains(extendedExpr.getClass) =>
// Use extended expression transformer to replace custom expression first
ExpressionMappings.expressionExtensionTransformer
.replaceWithExtensionExpressionTransformer(substraitExprName, extendedExpr, attributeSeq)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,11 @@ object ExpressionMappings {

def expressionsMap: Map[Class[_], String] = {
val blacklist = GlutenConfig.getConf.expressionBlacklist
val supportedExprs = defaultExpressionsMap ++
expressionExtensionTransformer.extensionExpressionsMapping

var supportedExprs = defaultExpressionsMap
if (expressionExtensionTransformer != null) {
supportedExprs = supportedExprs ++ expressionExtensionTransformer.extensionExpressionsMapping
}
if (blacklist.isEmpty) {
supportedExprs
} else {
Expand Down

0 comments on commit 15b9b94

Please sign in to comment.