-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccf95f5
commit 08c10c0
Showing
9 changed files
with
268 additions
and
147 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
230 changes: 139 additions & 91 deletions
230
gluten-core/src/main/scala/io/glutenproject/expression/ExpressionConverter.scala
Large diffs are not rendered by default.
Oops, something went wrong.
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
49 changes: 49 additions & 0 deletions
49
...c/test/scala/org/apache/spark/sql/catalyst/expressions/GlutenExpressionMappingSuite.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,49 @@ | ||
/* | ||
* 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.spark.sql.catalyst.expressions | ||
|
||
import io.glutenproject.GlutenConfig | ||
import io.glutenproject.execution.ProjectExecTransformer | ||
import io.glutenproject.expression.ExpressionMappings | ||
|
||
import org.apache.spark.sql.{GlutenSQLTestsTrait, Row} | ||
import org.apache.spark.sql.execution.ProjectExec | ||
import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper | ||
|
||
class GlutenExpressionMappingSuite extends GlutenSQLTestsTrait with AdaptiveSparkPlanHelper { | ||
|
||
test("test expression blacklist") { | ||
val names = ExpressionMappings.expressionsMap.values.toSet | ||
assert(names.contains("regexp_replace")) | ||
assert(names.contains("regexp_extract")) | ||
|
||
withSQLConf(GlutenConfig.EXPRESSION_BLACK_LIST.key -> "regexp_replace,regexp_extract,add") { | ||
val names = ExpressionMappings.expressionsMap.values.toSet | ||
assert(!names.contains("regexp_replace")) | ||
assert(!names.contains("regexp_extract")) | ||
assert(names.contains("regexp_extract_all")) | ||
assert(!names.contains("add")) | ||
spark.sql("CREATE TABLE t USING PARQUET AS SELECT 1 as c") | ||
withTable("t") { | ||
val df = spark.sql("SELECT c + 1 FROM t") | ||
checkAnswer(df, Row(2)) | ||
assert(find(df.queryExecution.executedPlan)(_.isInstanceOf[ProjectExecTransformer]).isEmpty) | ||
assert(find(df.queryExecution.executedPlan)(_.isInstanceOf[ProjectExec]).isDefined) | ||
} | ||
} | ||
} | ||
} |
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