You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/20 11:40:11 UTC

[GitHub] [spark] LuciferYang opened a new pull request, #36925: [SPARK-39520][SQL] Override `--` method for Scala 2.13 `ExpressionSet`

LuciferYang opened a new pull request, #36925:
URL: https://github.com/apache/spark/pull/36925

   ### 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] wangyum commented on a diff in pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
wangyum commented on code in PR #36925:
URL: https://github.com/apache/spark/pull/36925#discussion_r901709796


##########
sql/catalyst/src/main/scala-2.13/org/apache/spark/sql/catalyst/expressions/ExpressionSet.scala:
##########
@@ -132,6 +132,12 @@ class ExpressionSet protected(
     newSet
   }
 
+  override def --(that: IterableOnce[Expression]): ExpressionSet = {
+    val newSet = clone()
+    that.iterator.foreach(newSet.remove)
+    newSet
+  }
+

Review Comment:
   `++` doesn't have this issue?



-- 
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] srowen closed pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
srowen closed pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13 
URL: https://github.com/apache/spark/pull/36925


-- 
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] LuciferYang commented on pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #36925:
URL: https://github.com/apache/spark/pull/36925#issuecomment-1160357491

   cc @HyukjinKwon 


-- 
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] srowen commented on pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
srowen commented on PR #36925:
URL: https://github.com/apache/spark/pull/36925#issuecomment-1161222543

   Other things were removed, like the override of union(). May be fine, just now seems to be worth another look


-- 
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] LuciferYang commented on pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #36925:
URL: https://github.com/apache/spark/pull/36925#issuecomment-1161176292

   > Merged to master. It looks like this wasn't a problem in 3.3.x; this change removed the overrides:
   > 
   > https://issues.apache.org/jira/browse/SPARK-38836 #36121
   > 
   > I wonder if we will have other similar issues -- sounds like ++ is OK. CCing @minyyy
   
   The default implementation of `++` reuse `concat`:
   
   ```scala
   def concat(that: collection.IterableOnce[A]): C = fromSpecific(that match {
       case that: collection.Iterable[A] => new View.Concat(this, that)
       case _ => iterator.concat(that.iterator)
     })
   ```
   
   So the semantics of `++` should be ok, but if override `concat` method as follows, maybe a little quick than default implementation:
   
   ```scala
    override def concat(that: collection.IterableOnce[Expression]): ExpressionSet = {
       val newSet = clone()
       that.iterator.foreach(newSet.add)
       newSet
     }
   ```
   
   for example:
   
   ```
   val initialSet = ExpressionSet(aUpper + 1 :: Rand(0) :: Nil)
   val setToAddWithSameDeterministicExpression = ExpressionSet(aUpper + 1 :: Rand(0) :: Nil)
   benchmark.addCase("Test ++") { _: Int =>
       for (_ <- 0L until 100000) {
          setToAddWithSameDeterministicExpression ++ initialSet
        }
      }
   ```
   
   default implementation:
   
   ```
   OpenJDK 64-Bit Server VM 1.8.0_322-b06 on Mac OS X 11.4
   Apple M1
   Test ExpressionSet ++ :                   Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
   ------------------------------------------------------------------------------------------------------------------------
   Test ++                                              10             10           0         10.3          96.7       1.0X
   ```
   
   override `concat`:
   
   ```
   OpenJDK 64-Bit Server VM 1.8.0_322-b06 on Mac OS X 11.4
   Apple M1
   Test ExpressionSet ++ :                   Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
   ------------------------------------------------------------------------------------------------------------------------
   Test ++                                               7              7           0         15.0          66.5       1.0X
   ```
   


-- 
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] LuciferYang commented on a diff in pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on code in PR #36925:
URL: https://github.com/apache/spark/pull/36925#discussion_r901720849


##########
sql/catalyst/src/main/scala-2.13/org/apache/spark/sql/catalyst/expressions/ExpressionSet.scala:
##########
@@ -132,6 +132,12 @@ class ExpressionSet protected(
     newSet
   }
 
+  override def --(that: IterableOnce[Expression]): ExpressionSet = {
+    val newSet = clone()
+    that.iterator.foreach(newSet.remove)
+    newSet
+  }
+

Review Comment:
   Yes, ++ no such issue and ExpressionSetSuite already covered ++



-- 
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] LuciferYang commented on pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #36925:
URL: https://github.com/apache/spark/pull/36925#issuecomment-1160395973

   run 
   ```
   dev/change-scala-version.sh 2.13
   mvn clean install -DskipTests -pl sql/catalyst -am -Pscala-2.13
   mvn test -pl sql/catalyst -Pscala-2.13 
   ```
   
   All test passed
   
   ```
   Run completed in 4 minutes, 31 seconds.
   Total number of tests run: 6583
   Suites: completed 285, aborted 0
   Tests: succeeded 6583, failed 0, canceled 1, ignored 5, pending 0
   All tests passed.
   ```


-- 
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] srowen commented on pull request #36925: [SPARK-39520][SQL] Override `--` method for `ExpressionSet` in Scala 2.13

Posted by GitBox <gi...@apache.org>.
srowen commented on PR #36925:
URL: https://github.com/apache/spark/pull/36925#issuecomment-1160811940

   Merged to master. It looks like this wasn't a problem in 3.3.x; this change removed the overrides:
   
   https://issues.apache.org/jira/browse/SPARK-38836
   https://github.com/apache/spark/pull/36121
   
   I wonder if we will have other similar issues -- sounds like ++ is OK. CCing @minyyy 


-- 
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