jroof88 commented on a change in pull request #29720:
URL: https://github.com/apache/spark/pull/29720#discussion_r487148520



##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`. With 
this approach, the `fromJson` call to the constructors of the changes classes 
emulates the default arguments so the `jsonValue` function will behave in the 
same way when called upon.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       @HyukjinKwon I refactored the test to include a roundtrip test for 
`jsonValue()` 👍 

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`. With 
this approach, the `fromJson` call to the constructors of the changes classes 
emulates the default arguments so the `jsonValue` function will behave in the 
same way when called upon.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       @HyukjinKwon I refactored the test to include a roundtrip test for 
`jsonValue()` 👍 

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       Nope it won't cause any user-facing error. By doing:
   ```python
   json.get("containsNull", True)
   ```
   The code is getting the value of the `containsNull` key from the JSON if it 
exists. If the key does not, it will be `True`. This matches the constructor of 
`ArrayType` which has `True` as the default argument for `containsNull`. With 
this approach, the `fromJson` call to the constructors of the changes classes 
emulates the default arguments so the `jsonValue` function will behave in the 
same way when called upon.
   
   I'm happy to add some tests if you believe it is needed but this is be a 
no-op change.

##########
File path: python/pyspark/sql/types.py
##########
@@ -305,7 +305,7 @@ def jsonValue(self):
     @classmethod
     def fromJson(cls, json):

Review comment:
       @HyukjinKwon I refactored the test to include a roundtrip test for 
`jsonValue()` 👍 




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to