question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Different meanings set on values when reading null

See original GitHub issue

Hey, we have a list in our datastore with ids and sometimes nulls in it. Like here:

["null","null","a953c730fc2e4647b3a5b4e88fa4f0ce","59ce754ddf03401eb09abd50c977cf67","null"]    

When we try to fetch them, we get the “Different meanings set on values within a list_value” Exception.

Is this a bug, that the method does not handles null?

_get_meaning Method:

def _get_meaning(value_pb, is_list=False):
    meaning = None
    if is_list:
        # An empty list will have no values, hence no shared meaning
        # set among them.
        if len(value_pb.list_value) == 0:
            return None

        # We check among all the meanings, some of which may be None,
        # the rest which may be enum/int values.
        all_meanings = set(_get_meaning(sub_value_pb)
                           for sub_value_pb in value_pb.list_value)
        meaning = all_meanings.pop()
        # The value we popped off should have been unique. If not
        # then we can't handle a list with values that have more
        # than one meaning.
        if all_meanings:
            raise ValueError('Different meanings set on values '
                             'within a list_value')
    elif value_pb.meaning:  # Simple field (int32)
        meaning = value_pb.meaning

    return meaning

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
dhermescommented, Mar 23, 2016

Thanks. I’ll try to dig into it today (I am running a training so I may not get to it until the evening).

1reaction
dhermescommented, Mar 23, 2016

Also, for context, _get_meaning and associated code were added in #1241.

Also original design discussion (go to comment, issue is long). I’m trying to track down the discussion of the decision to use a single type for an entire list, but can’t find it.

@xamoom-raphael Can you provide a tiny ndb snippet? I’ll store my own data with the remote API and then check the raw output to see what would need to be done to accommodate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Things You Should Know About NULL Values - Biztory
A NULL value is a special marker used in SQL to indicate that a data value does not exist in the database. In...
Read more >
A quick and thorough guide to 'null' - freeCodeCamp
If a reference points to null , it simply means that there is no value associated with it. Technically speaking, the memory location...
Read more >
50 Shades of NULL – The Different Meanings of NULL in SQL
NULL can be: The “undefined” value, i.e., the value that is not yet defined (probably for technical reasons) but may well be defined...
Read more >
What is a Null Set? - Video & Lesson Transcript - Study.com
Sometimes the null set is called the empty set as the sets contain no elements. These two definitions are used interchangeably.
Read more >
What is a null set in mathematics? - TechTarget
In mathematical sets, the null set is a set that does not contain any values or elements. It is expressed as { }...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found