snazy commented on code in PR #4474:
URL: https://github.com/apache/polaris/pull/4474#discussion_r3286706564
##########
persistence/nosql/persistence/impl/src/main/java/org/apache/polaris/persistence/nosql/impl/indexes/IndexImpl.java:
##########
@@ -904,26 +909,43 @@ public IndexKey key() {
return k;
}
+ @Override
+ public boolean hasNonNullValue() {
+ var state = contentState;
+ if (state == VALUE_STATE_NULL) {
+ return false;
+ }
+ if (state != VALUE_STATE_UNMATERIALIZED) {
+ return true;
+ }
+ var nonNull =
+ !serializer.isNullSerialized(
+ serializedThreadSafe().limit(endOffset).position(valueOffset));
+ if (contentState == VALUE_STATE_UNMATERIALIZED) {
+ contentState = nonNull ? VALUE_STATE_NON_NULL : VALUE_STATE_NULL;
+ }
+ return nonNull;
+ }
+
@Override
@Nullable
public V valueNullable() {
- var c = content;
- if (c == null) {
- if (!hasContent) {
- c =
- content =
- serializer.deserialize(
-
serializedThreadSafe().limit(endOffset).position(valueOffset));
- hasContent = true;
- }
+ var state = contentState;
+ if (state == VALUE_STATE_NULL) {
+ return null;
}
+ if (state != VALUE_STATE_UNMATERIALIZED && state !=
VALUE_STATE_NON_NULL) {
+ return materializedContent(state);
Review Comment:
Right, not necessary 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]