Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API-875] Deserialize SqlRows lazily #472

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

mdumandag
Copy link
Contributor

This is a required change to be able to use parts of the row,
even if we cannot deserialize some column values.

Also, lazy deserialization is a plus on its own.

To accomplish this, similar to the Java client, I have changed the
code so that, we try to deserialize column values when we
call get_object or get_object_with_index. Note that,
just like the Java client

row.get_object("smth")
row.get_object("smth")

will result in two deserializations.
We could easily solve this with an extra object per row (something
like LazyDeserializable class with two fields: serialized and deserialized
where once we deserialize it, it assigns the result to deserialized and
return it for the subsequent calls). But, I didn't want to go that way due
to extra object cost.

Closes #447

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2021

Codecov Report

Merging #472 (7b39199) into master (f89fe19) will decrease coverage by 0.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #472      +/-   ##
==========================================
- Coverage   95.15%   94.87%   -0.29%     
==========================================
  Files         345      345              
  Lines       17696    17700       +4     
==========================================
- Hits        16838    16792      -46     
- Misses        858      908      +50     
Impacted Files Coverage Δ
hazelcast/sql.py 97.30% <100.00%> (+0.02%) ⬆️
...otocol/codec/client_authentication_custom_codec.py 50.00% <0.00%> (-23.81%) ⬇️
hazelcast/reactor.py 81.79% <0.00%> (-8.26%) ⬇️
hazelcast/connection.py 91.88% <0.00%> (-1.42%) ⬇️
hazelcast/proxy/base.py 97.40% <0.00%> (-0.65%) ⬇️
hazelcast/listener.py 94.23% <0.00%> (+1.92%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f89fe19...7b39199. Read the comment docs.

Copy link

@zpqrtbnk zpqrtbnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the best of my Python knowledge this is OK with be and then we have to do the same in C# of course...

This is a required change to be able to use parts of the row,
even if we cannot deserialize some column values.

Also, lazy deserialization is a plus on its own.

To accomplish this, similar to the Java client, I have changed the
code so that, we try to deserialize column values when we
call `get_object` or `get_object_with_index`. Note that,
just like the Java client

```
row.get_object("smth")
row.get_object("smth")
```

will result in two deserializations.
We could easily solve this with an extra object per row (something
like LazyDeserializable class with two fields: serialized and deserialized
where once we deserialize it, it assigns the result to deserialized and
return it for the subsequent calls). But, I didn't want to go that way due
to extra object cost.
@mdumandag mdumandag merged commit f614580 into hazelcast:master Sep 16, 2021
@mdumandag mdumandag deleted the lazy-obj-deserialization branch September 16, 2021 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TRACKING ISSUE] Lazy SQL OBJECT deserialization
3 participants