You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2017/07/04 14:37:44 UTC

[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

GitHub user cloud-fan opened a pull request:

    https://github.com/apache/spark/pull/18529

    [SPARK-21304][SQL] remove unnecessary isNull variable for collection related encoder expressions

    ## What changes were proposed in this pull request?
    
    For these collection-related encoder expressions, we don't need to create `isNull` variable if the loop element is not nullable.
    
    ## How was this patch tested?
    
    existing tests.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloud-fan/spark minor

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18529.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18529
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79156/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79156 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79156/testReport)** for PR 18529 at commit [`01e2fcd`](https://github.com/apache/spark/commit/01e2fcdd0ea63b37bad2d60881f7384000c3d957).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    thanks for review, merging to master!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/18529


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79176 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79176/testReport)** for PR 18529 at commit [`568fd76`](https://github.com/apache/spark/commit/568fd76b1d9f98613b304e5eedaeec63aeda3163).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125516155
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -682,15 +687,19 @@ object CollectObjectsToMap {
           keyFunction: Expression => Expression,
           valueFunction: Expression => Expression,
           inputData: Expression,
    -      collClass: Class[_]): CollectObjectsToMap = {
    +      collClass: Class[_]): CatalystToExternalMap = {
         val id = curId.getAndIncrement()
         val keyLoopValue = s"CollectObjectsToMap_keyLoopValue$id"
    --- End diff --
    
    ```
    - val keyLoopValue = s"CollectObjectsToMap_keyLoopValue$id"
    + val keyLoopValue = s"CatalystToExternalMap_keyLoopValue$id"
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125542708
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    I guess we can't remove these lines because it might cause a Janino compile error when creating `MapObjects` like:
    
    ```scala
    val inputData = some expression of dataType ObjectType(classOf[Array[Int]])
    MapObjects(..., inputData, IntegerType)
    ```
    
    In this case, `$loopValue == null` occurs the compile error because `$loopValue` is `int`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79176/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79176 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79176/testReport)** for PR 18529 at commit [`568fd76`](https://github.com/apache/spark/commit/568fd76b1d9f98613b304e5eedaeec63aeda3163).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125559540
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    for `Array[Int]`, because we calculate the `elementNullable` based on type, so `elementNullable` will be false.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79182/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125555875
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    Hmm, it depends on if we correctly set `elementNullable` when calling `MapObjects.apply` for all the cases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125516213
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -682,15 +687,19 @@ object CollectObjectsToMap {
           keyFunction: Expression => Expression,
           valueFunction: Expression => Expression,
           inputData: Expression,
    -      collClass: Class[_]): CollectObjectsToMap = {
    +      collClass: Class[_]): CatalystToExternalMap = {
         val id = curId.getAndIncrement()
         val keyLoopValue = s"CollectObjectsToMap_keyLoopValue$id"
         val mapType = inputData.dataType.asInstanceOf[MapType]
         val keyLoopVar = LambdaVariable(keyLoopValue, "", mapType.keyType, nullable = false)
         val valueLoopValue = s"CollectObjectsToMap_valueLoopValue$id"
    -    val valueLoopIsNull = s"CollectObjectsToMap_valueLoopIsNull$id"
    +    val valueLoopIsNull = if (mapType.valueContainsNull) {
    +      s"CollectObjectsToMap_valueLoopIsNull$id"
    --- End diff --
    
    here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    cc @ueshin @kiszk @viirya 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125487461
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -667,7 +672,7 @@ case class MapObjects private(
       }
     }
     
    -object CollectObjectsToMap {
    +object CatalystToExternalMap {
    --- End diff --
    
    This name is more consistent with `ExternalMapToCatalyst`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125492854
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    Why do you remove lines 594-595 in the original code? Can we always ensure primitive type array sets `"false"` into `loopIsNull`?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125555516
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    Actually, I chose the example intentionally to be `loopIsNull != "false"` (because `elementNullable` is `true` here), and we can hit the branch.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79182 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79182/testReport)** for PR 18529 at commit [`50126bd`](https://github.com/apache/spark/commit/50126bdd941588337ea1b4b25974935edc6c2d7b).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125516189
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -682,15 +687,19 @@ object CollectObjectsToMap {
           keyFunction: Expression => Expression,
           valueFunction: Expression => Expression,
           inputData: Expression,
    -      collClass: Class[_]): CollectObjectsToMap = {
    +      collClass: Class[_]): CatalystToExternalMap = {
         val id = curId.getAndIncrement()
         val keyLoopValue = s"CollectObjectsToMap_keyLoopValue$id"
         val mapType = inputData.dataType.asInstanceOf[MapType]
         val keyLoopVar = LambdaVariable(keyLoopValue, "", mapType.keyType, nullable = false)
         val valueLoopValue = s"CollectObjectsToMap_valueLoopValue$id"
    --- End diff --
    
    here, too.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125490683
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -667,7 +672,7 @@ case class MapObjects private(
       }
     }
     
    -object CollectObjectsToMap {
    +object CatalystToExternalMap {
    --- End diff --
    
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by dongjoon-hyun <gi...@git.apache.org>.
Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125516031
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -667,7 +672,7 @@ case class MapObjects private(
       }
     }
     
    -object CollectObjectsToMap {
    +object CatalystToExternalMap {
       private val curId = new java.util.concurrent.atomic.AtomicInteger()
     
       /**
    --- End diff --
    
    Could you fix this in documents, too?
    ```
    * Construct an instance of CollectObjectsToMap case class.
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79156 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79156/testReport)** for PR 18529 at commit [`01e2fcd`](https://github.com/apache/spark/commit/01e2fcdd0ea63b37bad2d60881f7384000c3d957).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18529: [SPARK-21304][SQL] remove unnecessary isNull vari...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18529#discussion_r125544710
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
    @@ -588,12 +591,14 @@ case class MapObjects private(
           case _ => genFunction.value
         }
     
    -    val loopNullCheck = inputDataType match {
    -      case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    -      // The element of primitive array will never be null.
    -      case ObjectType(cls) if cls.isArray && cls.getComponentType.isPrimitive =>
    -        s"$loopIsNull = false"
    -      case _ => s"$loopIsNull = $loopValue == null;"
    +    val loopNullCheck = if (loopIsNull != "false") {
    +      ctx.addMutableState("boolean", loopIsNull, "")
    +      inputDataType match {
    +        case _: ArrayType => s"$loopIsNull = ${genInputData.value}.isNullAt($loopIndex);"
    +        case _ => s"$loopIsNull = $loopValue == null;"
    --- End diff --
    
    For this case, `loopIsNull` will be `false` and we won't hit this branch.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    **[Test build #79182 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79182/testReport)** for PR 18529 at commit [`50126bd`](https://github.com/apache/spark/commit/50126bdd941588337ea1b4b25974935edc6c2d7b).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    LGTM


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18529: [SPARK-21304][SQL] remove unnecessary isNull variable fo...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18529
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org