You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/01/25 22:10:12 UTC

[GitHub] [ignite-python-thin-client] isapego opened a new pull request #6: IGNITE-13863: Fix Null reading and writing

isapego opened a new pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568500749



##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
-        return ctype_object.type, super().to_python(
+        typ = getattr(ctype_object, "type", None)

Review comment:
       Inconsistent naming, may be it's better to use `tc_type` here?

##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
-        return ctype_object.type, super().to_python(
+        typ = getattr(ctype_object, "type", None)

Review comment:
       Inconsistent naming, may be it's better to use `tc_type` or 'obj_type'

##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_ for [ByteObject,... ]]
   
   class AllTypesObject(schema=fields):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```

##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_  in [ByteObject,... ]]
   
   class AllTypesObject(schema=fields):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```

##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_  in [ByteObject,... ]]
   
   class AllTypesObject(schema=OrderedDict(fields)):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568500749



##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
-        return ctype_object.type, super().to_python(
+        typ = getattr(ctype_object, "type", None)

Review comment:
       Inconsistent naming, may be it's better to use `tc_type` 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568506407



##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_  in [ByteObject,... ]]
   
   class AllTypesObject(schema=OrderedDict(fields)):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] asfgit closed pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] asfgit closed pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r564434413



##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
+        type = getattr(ctype_object, "type", None)

Review comment:
       just
   ```
   if hasattr(ctype_object, "type"):
       return None
   .....
   ```
   




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r564434413



##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
+        type = getattr(ctype_object, "type", None)

Review comment:
       just
   ```
   if hasattr(ctype_object, "type"):
       return None
   .....
   ```
   Or reuse type below




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568506407



##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_ for [ByteObject,... ]]
   
   class AllTypesObject(schema=fields):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568500749



##########
File path: pyignite/datatypes/complex.py
##########
@@ -420,12 +454,18 @@ def build_header(cls):
 
     @classmethod
     def to_python(cls, ctype_object, *args, **kwargs):
-        return ctype_object.type, super().to_python(
+        typ = getattr(ctype_object, "type", None)

Review comment:
       Inconsistent naming, may be it's better to use `tc_type` or 'obj_type'




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [ignite-python-thin-client] ivandasch commented on a change in pull request #6: IGNITE-13863: Fix Null reading and writing

Posted by GitBox <gi...@apache.org>.
ivandasch commented on a change in pull request #6:
URL: https://github.com/apache/ignite-python-thin-client/pull/6#discussion_r568506407



##########
File path: tests/test_binary.py
##########
@@ -355,3 +360,98 @@ class TestObject(
     hash_utf8 = BinaryObject.hashcode(obj_utf8, client=client)
 
     assert hash_utf8 == -1945378474, 'Invalid hashcode value for object with UTF-8 strings'
+
+
+def test_complex_object_null_fields(client):
+    """
+    Test that Python client can correctly write and read binary object that
+    contains null fields.
+    """
+    class AllTypesObject(
+        metaclass=GenericObjectMeta,
+        type_name='TestObject',
+        schema=OrderedDict([

Review comment:
       too many repeats.
   ```
   
   def camel_to_snake(name):
        name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
        return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
   
   fields = [(camel_to_snake(type_.__name__, type_) for type_  in [ByteObject,... ]]
   
   class AllTypesObject(schema=fields):
         pass
    
   for field,_ in fields:
      setattr(obj, field, None) 
   
   ```




----------------------------------------------------------------
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:
users@infra.apache.org