You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "yabola (via GitHub)" <gi...@apache.org> on 2023/01/21 09:50:17 UTC
[GitHub] [spark] yabola opened a new pull request, #39687: [SPARK-41470][Core] Relax constraints on Storage-Partitioned Join should assume InternalRow implements equals and hashCode
yabola opened a new pull request, #39687:
URL: https://github.com/apache/spark/pull/39687
…uld assume InternalRow implements equals and hashCode
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1407264818
@sunchao @dongjoon-hyun If you have time, please take a look , thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1089601759
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala:
##########
@@ -132,11 +130,12 @@ case class BatchScanExec(
outputPartitioning match {
case p: KeyGroupedPartitioning =>
- val partitionMapping = finalPartitions.map(s =>
- s.head.asInstanceOf[HasPartitionKey].partitionKey() -> s).toMap
+ val partitionMapping = finalPartitions
+ .map(s => InternalRowComparableWrapper(s.head, p.expressions) -> s).toMap
finalPartitions = p.partitionValues.map { partValue =>
// Use empty partition for those partition values that are not present
- partitionMapping.getOrElse(partValue, Seq.empty)
Review Comment:
`Map` operation needs to rely on `equals` method, change to use `InternalRowComparableWrapper`
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -541,13 +542,31 @@ class BufferedRows(val key: Seq[Any] = Seq.empty) extends WriterCommitMessage
def keyString(): String = key.toArray.mkString("/")
- override def partitionKey(): InternalRow = {
- InternalRow.fromSeq(key)
- }
+ override def partitionKey(): InternalRow = PartitionInternalRow(key.toArray)
Review Comment:
`GenericInternalRow` implements `equals` and `hashCode` methods already. Change to use `PartitionInternalRow`
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala:
##########
@@ -198,12 +198,9 @@ case class EnsureRequirements(
// Check if the two children are partition keys compatible. If so, find the
// common set of partition values, and adjust the plan accordingly.
if (leftSpec.areKeysCompatible(rightSpec)) {
- val leftPartValues = leftSpec.partitioning.partitionValues
- val rightPartValues = rightSpec.partitioning.partitionValues
-
- val mergedPartValues = Utils.mergeOrdered(
- Seq(leftPartValues, rightPartValues))(leftSpec.ordering).toSeq.distinct
-
Review Comment:
Merge operation also needs to rely on `equals` method, change to use `InternalRowComparableWrapper`
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/physical/partitioning.scala:
##########
@@ -677,9 +678,6 @@ case class KeyGroupedShuffleSpec(
}
}
- lazy val ordering: Ordering[InternalRow] =
- RowOrdering.createNaturalAscendingOrdering(partitioning.expressions.map(_.dataType))
-
Review Comment:
In order to centralize the comparison logic, `InternalRowComparableWrapper` is uniformly used here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093974043
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093973345
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(partitionRow: InternalRow,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ new InternalRowComparableWrapper(partitionRow, partitionExpression.map(_.dataType))
+ }
+
+ def mergePartitions(leftPartition: KeyGroupedPartitioning, rightPartition: KeyGroupedPartitioning,
+ partitionExpression: Seq[Expression]): Seq[InternalRow] = {
Review Comment:
Emmmm, this method won't modify any parameters in `KeyGroupedShuffleSpec`, so I'm not sure if it is suitable to move this to `KeyGroupedShuffleSpec`? I think public static method class may be more appropriate.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093971057
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala:
##########
@@ -124,28 +124,24 @@ trait DataSourceV2ScanExecBase extends LeafExecNode {
inputPartitions: Seq[InputPartition]): Option[Seq[(InternalRow, Seq[InputPartition])]] = {
if (!SQLConf.get.v2BucketingEnabled) return None
keyGroupedPartitioning.flatMap { expressions =>
- val results = inputPartitions.takeWhile {
- case _: HasPartitionKey => true
- case _ => false
- }.map(p => (p.asInstanceOf[HasPartitionKey].partitionKey(), p))
-
- if (results.length != inputPartitions.length || inputPartitions.isEmpty) {
+ if (inputPartitions.isEmpty || inputPartitions.count(!_.isInstanceOf[HasPartitionKey]) > 0) {
Review Comment:
Thanks, I revert these changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1096491741
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it comparable with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(
+ partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
Review Comment:
Thanks , done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sunchao commented on a diff in pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "sunchao (via GitHub)" <gi...@apache.org>.
sunchao commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1096102230
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it comparable with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(
+ partition: InputPartition,
Review Comment:
nit: 4 space indentation here.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it comparable with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(
+ partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(
+ partitionRow: InternalRow,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ new InternalRowComparableWrapper(partitionRow, partitionExpression.map(_.dataType))
+ }
+
+ def mergePartitions(
+ leftPartitioning: KeyGroupedPartitioning,
Review Comment:
ditto
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it comparable with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(
+ partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(
+ partitionRow: InternalRow,
Review Comment:
ditto
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,88 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it comparable with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(
+ partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
Review Comment:
I think we can change the parameter to:
```scala
partition: InputPartition with HasPartitionKey
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sunchao commented on pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "sunchao (via GitHub)" <gi...@apache.org>.
sunchao commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1419524760
Committed to master/branch-3.4. Thanks @yabola !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1405975879
@sunchao @dongjoon-hyun Thanks for review ! I am trying to complete codes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1089601759
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala:
##########
@@ -132,11 +130,12 @@ case class BatchScanExec(
outputPartitioning match {
case p: KeyGroupedPartitioning =>
- val partitionMapping = finalPartitions.map(s =>
- s.head.asInstanceOf[HasPartitionKey].partitionKey() -> s).toMap
+ val partitionMapping = finalPartitions
+ .map(s => InternalRowComparableWrapper(s.head, p.expressions) -> s).toMap
finalPartitions = p.partitionValues.map { partValue =>
// Use empty partition for those partition values that are not present
- partitionMapping.getOrElse(partValue, Seq.empty)
Review Comment:
`Map` operation needs to rely on `equals` `hashCode` method, change to use `InternalRowComparableWrapper`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093971177
##########
sql/catalyst/src/main/scala-2.12/org/apache/spark/sql/catalyst/util/InternalRowSet.scala:
##########
@@ -1,65 +0,0 @@
-/*
Review Comment:
removed
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1089602169
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -541,13 +542,31 @@ class BufferedRows(val key: Seq[Any] = Seq.empty) extends WriterCommitMessage
def keyString(): String = key.toArray.mkString("/")
- override def partitionKey(): InternalRow = {
- InternalRow.fromSeq(key)
- }
+ override def partitionKey(): InternalRow = PartitionInternalRow(key.toArray)
Review Comment:
`GenericInternalRow` implements `equals` and `hashCode` methods already. Change to use `PartitionInternalRow` to simulate that it has not been implemented to verify codes correctness
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1089602169
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -541,13 +542,31 @@ class BufferedRows(val key: Seq[Any] = Seq.empty) extends WriterCommitMessage
def keyString(): String = key.toArray.mkString("/")
- override def partitionKey(): InternalRow = {
- InternalRow.fromSeq(key)
- }
+ override def partitionKey(): InternalRow = PartitionInternalRow(key.toArray)
Review Comment:
`GenericInternalRow` implements `equals` and `hashCode` methods already (please see `BaseGenericInternalRow`). Change to use `PartitionInternalRow` to simulate that it has not been implemented to verify codes correctness
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "AmplabJenkins (via GitHub)" <gi...@apache.org>.
AmplabJenkins commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1399572509
Can one of the admins verify this patch?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sunchao closed pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "sunchao (via GitHub)" <gi...@apache.org>.
sunchao closed pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
URL: https://github.com/apache/spark/pull/39687
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] dongjoon-hyun commented on pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1419628490
Thank you so much, @yabola and @sunchao !
cc @cloud-fan and @xinrong-meng , too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on pull request #39687: [SPARK-41470][Core] Relax constraints on Storage-Partitioned Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1399219285
retest this please
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sunchao commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "sunchao (via GitHub)" <gi...@apache.org>.
sunchao commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1092296833
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
Review Comment:
"to make it can be compared with" -> "to make it comparable with"?
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala:
##########
@@ -124,28 +124,24 @@ trait DataSourceV2ScanExecBase extends LeafExecNode {
inputPartitions: Seq[InputPartition]): Option[Seq[(InternalRow, Seq[InputPartition])]] = {
if (!SQLConf.get.v2BucketingEnabled) return None
keyGroupedPartitioning.flatMap { expressions =>
- val results = inputPartitions.takeWhile {
- case _: HasPartitionKey => true
- case _ => false
- }.map(p => (p.asInstanceOf[HasPartitionKey].partitionKey(), p))
-
- if (results.length != inputPartitions.length || inputPartitions.isEmpty) {
+ if (inputPartitions.isEmpty || inputPartitions.count(!_.isInstanceOf[HasPartitionKey]) > 0) {
Review Comment:
I think originally I chose `takeWhile` because it can quickly exit the loop if any input partition doesn't implement `HasPartitionKey`, but with `count` it now has to loop through all input partitions.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(partitionRow: InternalRow,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ new InternalRowComparableWrapper(partitionRow, partitionExpression.map(_.dataType))
+ }
+
+ def mergePartitions(leftPartition: KeyGroupedPartitioning, rightPartition: KeyGroupedPartitioning,
Review Comment:
ditto
maybe rename parameters to `leftPartitioning` and `rightPartitioning`
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala:
##########
@@ -80,22 +79,21 @@ case class BatchScanExec(
"during runtime filtering: not all partitions implement HasPartitionKey after " +
"filtering")
}
-
- val newRows = new InternalRowSet(p.expressions.map(_.dataType))
- newRows ++= newPartitions.map(_.asInstanceOf[HasPartitionKey].partitionKey())
-
- val oldRows = p.partitionValues.toSet
+ val newPartitionKeys = newPartitions
Review Comment:
I think these should be called "partition values" instead of "partition keys". I made a mistake previously and it's better to correct them now.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(partitionRow: InternalRow,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ new InternalRowComparableWrapper(partitionRow, partitionExpression.map(_.dataType))
+ }
+
+ def mergePartitions(leftPartition: KeyGroupedPartitioning, rightPartition: KeyGroupedPartitioning,
+ partitionExpression: Seq[Expression]): Seq[InternalRow] = {
Review Comment:
It's a bit strange that we have `mergePartitions`, which is only related to `KeyGroupedPartitioning`, in the `InternalRowComparableWrapper` class. Could we move this method to some place more relevant, like `KeyGroupedShuffleSpec`?
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(partitionRow: InternalRow,
Review Comment:
ditto
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
Review Comment:
nit: put each parameter in a separate line following the style guide: https://github.com/databricks/scala-style-guide#spacing-and-indentation, e.g.:
```scala
def apply(
partition: InputPartition,
partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
..
}
```
##########
sql/catalyst/src/main/scala-2.12/org/apache/spark/sql/catalyst/util/InternalRowSet.scala:
##########
@@ -1,65 +0,0 @@
-/*
Review Comment:
Should we also remove the same file under `scala-2.13`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093973345
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/InternalRowComparableWrapper.scala:
##########
@@ -0,0 +1,84 @@
+/*
+ * 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.util
+
+import scala.collection.mutable
+
+import org.apache.spark.SparkException
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.catalyst.expressions.{Expression, Murmur3HashFunction, RowOrdering}
+import org.apache.spark.sql.catalyst.plans.physical.KeyGroupedPartitioning
+import org.apache.spark.sql.connector.read.{HasPartitionKey, InputPartition}
+import org.apache.spark.sql.types.{DataType, StructField, StructType}
+
+/**
+ * Wraps the [[InternalRow]] with the corresponding [[DataType]] to make it can be compared with
+ * the values in [[InternalRow]].
+ * It uses Spark's internal murmur hash to compute hash code from an row, and uses [[RowOrdering]]
+ * to perform equality checks.
+ *
+ * @param dataTypes the data types for the row
+ */
+class InternalRowComparableWrapper(val row: InternalRow, val dataTypes: Seq[DataType]) {
+
+ private val structType = StructType(dataTypes.map(t => StructField("f", t)))
+ private val ordering = RowOrdering.createNaturalAscendingOrdering(dataTypes)
+
+ override def hashCode(): Int = Murmur3HashFunction.hash(row, structType, 42L).toInt
+
+ override def equals(other: Any): Boolean = {
+ if (!other.isInstanceOf[InternalRowComparableWrapper]) {
+ return false
+ }
+ val otherWrapper = other.asInstanceOf[InternalRowComparableWrapper]
+ if (!otherWrapper.dataTypes.equals(this.dataTypes)) {
+ return false
+ }
+ ordering.compare(row, otherWrapper.row) == 0
+ }
+}
+
+object InternalRowComparableWrapper {
+
+ def apply(partition: InputPartition,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ if (!partition.isInstanceOf[HasPartitionKey]) {
+ throw new SparkException("partition row should implement `HasPartitionKey`")
+ }
+ new InternalRowComparableWrapper(
+ partition.asInstanceOf[HasPartitionKey].partitionKey(), partitionExpression.map(_.dataType))
+ }
+
+ def apply(partitionRow: InternalRow,
+ partitionExpression: Seq[Expression]): InternalRowComparableWrapper = {
+ new InternalRowComparableWrapper(partitionRow, partitionExpression.map(_.dataType))
+ }
+
+ def mergePartitions(leftPartition: KeyGroupedPartitioning, rightPartition: KeyGroupedPartitioning,
+ partitionExpression: Seq[Expression]): Seq[InternalRow] = {
Review Comment:
Emmmm, this method won't modify any parameters in `KeyGroupedShuffleSpec`, so I'm not sure if it is suitable to move this to `KeyGroupedShuffleSpec`? Public static method class may be more appropriate?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sunchao commented on pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "sunchao (via GitHub)" <gi...@apache.org>.
sunchao commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1400642339
Thanks @yabola for working on this. Could you add a unit test? I think you can just modify `InMemoryBaseTable` to return a `InternalRow` implementation that does not implement `equals` and `hashCode`: it currently calls `InternalRow.fromSeq` which returns `GenericInternalRow` that already implements the two methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on pull request #39687: [SPARK-41470][Core] Relax constraints on Storage-Partitioned Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1399232731
@sunchao @aokolnychyi Please take a look, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093971057
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala:
##########
@@ -124,28 +124,24 @@ trait DataSourceV2ScanExecBase extends LeafExecNode {
inputPartitions: Seq[InputPartition]): Option[Seq[(InternalRow, Seq[InputPartition])]] = {
if (!SQLConf.get.v2BucketingEnabled) return None
keyGroupedPartitioning.flatMap { expressions =>
- val results = inputPartitions.takeWhile {
- case _: HasPartitionKey => true
- case _ => false
- }.map(p => (p.asInstanceOf[HasPartitionKey].partitionKey(), p))
-
- if (results.length != inputPartitions.length || inputPartitions.isEmpty) {
+ if (inputPartitions.isEmpty || inputPartitions.count(!_.isInstanceOf[HasPartitionKey]) > 0) {
Review Comment:
@sunchao Thanks, I revert these changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on a diff in pull request #39687: [SPARK-41470][SQL] Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #39687:
URL: https://github.com/apache/spark/pull/39687#discussion_r1093971347
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala:
##########
@@ -80,22 +79,21 @@ case class BatchScanExec(
"during runtime filtering: not all partitions implement HasPartitionKey after " +
"filtering")
}
-
- val newRows = new InternalRowSet(p.expressions.map(_.dataType))
- newRows ++= newPartitions.map(_.asInstanceOf[HasPartitionKey].partitionKey())
-
- val oldRows = p.partitionValues.toSet
+ val newPartitionKeys = newPartitions
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] yabola commented on pull request #39687: [SPARK-41470][SQL] SPJ: Relax constraints on Storage-Partitioned-Join should assume InternalRow implements equals and hashCode
Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #39687:
URL: https://github.com/apache/spark/pull/39687#issuecomment-1419982050
@sunchao @dongjoon-hyun Thank you all for review!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org