-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16525][SQL] Enable Row Based HashMap in HashAggregateExec #14176
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
Changes from 8 commits
4a5b81f
7194394
122cf18
def94cc
97bb7c1
b9a4268
e67ff5d
b32cb7b
a58314c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -499,14 +499,16 @@ object SQLConf { | |
| .intConf | ||
| .createWithDefault(40) | ||
|
|
||
| val VECTORIZED_AGG_MAP_MAX_COLUMNS = | ||
| SQLConfigBuilder("spark.sql.codegen.aggregate.map.columns.max") | ||
| val FAST_AGG_MAP_IMPL = | ||
| SQLConfigBuilder("spark.sql.codegen.aggregate.map.enforce.impl") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also make sure that all references to the old config are also appropriately modified. |
||
| .internal() | ||
| .doc("Sets the maximum width of schema (aggregate keys + values) for which aggregate with" + | ||
| "keys uses an in-memory columnar map to speed up execution. Setting this to 0 effectively" + | ||
| "disables the columnar map") | ||
| .intConf | ||
| .createWithDefault(3) | ||
| .doc("Sets the implementation for fast hash map during aggregation. Could be one of the " + | ||
| "following: rowbased, vectorized, skip, auto. Defaults to auto, and should only be other " + | ||
| "values for testing purposes.") | ||
| .stringConf | ||
| .transform(_.toLowerCase()) | ||
| .checkValues(Set("rowbased", "vectorized", "skip", "auto")) | ||
| .createWithDefault("auto") | ||
|
||
|
|
||
| val FILE_SINK_LOG_DELETION = SQLConfigBuilder("spark.sql.streaming.fileSink.log.deletion") | ||
| .internal() | ||
|
|
@@ -673,7 +675,7 @@ private[sql] class SQLConf extends Serializable with CatalystConf with Logging { | |
|
|
||
| override def runSQLonFile: Boolean = getConf(RUN_SQL_ON_FILES) | ||
|
|
||
| def vectorizedAggregateMapMaxColumns: Int = getConf(VECTORIZED_AGG_MAP_MAX_COLUMNS) | ||
| def enforceFastAggHashMapImpl: String = getConf(FAST_AGG_MAP_IMPL) | ||
|
|
||
| def variableSubstituteEnabled: Boolean = getConf(VARIABLE_SUBSTITUTE_ENABLED) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * 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 | ||
|
|
||
| import org.apache.spark.sql.functions._ | ||
| import org.apache.spark.sql.types.DecimalType | ||
|
|
||
| abstract class AggregateHashMapSuite extends DataFrameAggregateSuite { | ||
|
||
| import testImplicits._ | ||
|
|
||
| protected def setAggregateHashMapImpl(): Unit | ||
|
|
||
| protected override def beforeAll(): Unit = { | ||
| setAggregateHashMapImpl() | ||
| sparkConf.set("spark.sql.codegen.fallback", "false") | ||
| super.beforeAll() | ||
| } | ||
|
|
||
| test("SQL decimal test") { | ||
|
||
| checkAnswer( | ||
| decimalData.groupBy('a cast DecimalType(10, 2)).agg(avg('b cast DecimalType(10, 2))), | ||
| Seq(Row(new java.math.BigDecimal(1.0), new java.math.BigDecimal(1.5)), | ||
| Row(new java.math.BigDecimal(2.0), new java.math.BigDecimal(1.5)), | ||
| Row(new java.math.BigDecimal(3.0), new java.math.BigDecimal(1.5)))) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * 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 | ||
|
|
||
| class RowBasedAggregateHashMapSuite extends AggregateHashMapSuite { | ||
|
|
||
| protected def setAggregateHashMapImpl() { | ||
| sparkConf.set("spark.sql.codegen.aggregate.map.enforce.impl", "rowbased") | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /* | ||
| * 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 | ||
|
|
||
| class VectorizedAggregateHashMapSuite extends AggregateHashMapSuite { | ||
|
|
||
| protected def setAggregateHashMapImpl() { | ||
| sparkConf.set("spark.sql.codegen.aggregate.map.enforce.impl", "vectorized") | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a regression test for this in [sql]?