Github user techaddict commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13990#discussion_r69772459
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
 ---
    @@ -441,10 +452,15 @@ case class StringToMap(text: Expression, pairDelim: 
Expression, keyValueDelim: E
             UTF8String[] $keyArray = new UTF8String[$tempArray.length];
             UTF8String[] $valueArray = new UTF8String[$tempArray.length];
     
    -        for (int $i = 0; $i < $tempArray.length; $i ++) {
    +        for (int $i = 0; $i < $tempArray.length; $i++) {
               UTF8String[] $keyValue = ($tempArray[$i]).split($keyValueDelim, 
2);
               $keyArray[$i] = $keyValue[0];
    -          $valueArray[$i] = $keyValue[1];
    +          if ($keyValue.length < 2) {
    +            $valueArray[$i] = null;
    +          }
    +          else {
    +            $valueArray[$i] = $keyValue[1];
    +          }
    --- End diff --
    
    I think that syntax is allowed in java, and it's much more readable than 
tertiary if notation. 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to