forked from apache/incubator-gluten
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GLUTEN-6951][CORE][CH] Move CustomerExpressionTransformer to CH back…
…end (apache#6993) Closes apache#6951
- Loading branch information
1 parent
dd5ceeb
commit 81d4354
Showing
18 changed files
with
323 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
backends-clickhouse/src/main/scala/org/apache/gluten/expression/CHExpressions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.gluten.expression | ||
|
||
import org.apache.gluten.expression.ConverterUtils.FunctionConfig | ||
import org.apache.gluten.extension.ExpressionExtensionTrait | ||
import org.apache.gluten.substrait.expression.ExpressionBuilder | ||
|
||
import org.apache.spark.sql.catalyst.expressions.aggregate.AggregateFunction | ||
|
||
// Static helper object for handling expressions that are specifically used in CH backend. | ||
object CHExpressions { | ||
// Since https://github.com/apache/incubator-gluten/pull/1937. | ||
def createAggregateFunction(args: java.lang.Object, aggregateFunc: AggregateFunction): Long = { | ||
val functionMap = args.asInstanceOf[java.util.HashMap[String, java.lang.Long]] | ||
if ( | ||
ExpressionExtensionTrait.expressionExtensionTransformer.extensionExpressionsMapping.contains( | ||
aggregateFunc.getClass) | ||
) { | ||
val (substraitAggFuncName, inputTypes) = | ||
ExpressionExtensionTrait.expressionExtensionTransformer.buildCustomAggregateFunction( | ||
aggregateFunc) | ||
assert(substraitAggFuncName.isDefined) | ||
return ExpressionBuilder.newScalarFunction( | ||
functionMap, | ||
ConverterUtils.makeFuncName(substraitAggFuncName.get, inputTypes, FunctionConfig.REQ)) | ||
} | ||
|
||
AggregateFunctionsBuilder.create(args, aggregateFunc) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.