-
Notifications
You must be signed in to change notification settings - Fork 847
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
AttributeValue of type L does not set IsLSet to true when the list is empty. #1116
Comments
Hi @jasonwadsworth, I am inclined to agree with you that this is something that should be fixed. I will verify with the team. |
@klaytaybai, have you and your team decided to address this? I'm currently doing some pretty hacky things to work around it. |
Hi @jasonwadsworth, thank you for your patience. The .NET SDK team is focusing on re:Invent work due in a week, but this is currently prioritized to be addressed as soon as a core team member gets freed up to verify tests and non-issues with backwards compatibility. |
@klaytaybai is this still an issue? I'm encountering this currently.
This is the code in question. Do we have any reason where
The only time to me it makes sense to not send a list is when it's null, I see one reason might be we default L to be an attribute value, when really I think it should default to null. We can rework the getter if we want to always be able to access To
as the document => json conversion checks isLSet, which checks the private field directly (As far I can see) If no-one is opposed to this I would enjoy making this change as a way to give back to how much I love Dynamo :) |
To bump this, I noticed that these are all built from |
Hi @jasonwadsworth, Good afternoon. I was able to create an item with empty list via AWS Console. As you mentioned, looks like in .NET SDK, the GetIsSet(List) method returns true only if the list has some items or is of type AlwaysSendList for the empty list. The workaround could be to write custom serialization logic to use AlwaysSendList instead of List. However, as you mentioned, this issue can occur repeatedly inside of nested objects (type M), a work around is not particularly feasible. Also, looks like with AWS CLI, putting item with empty list works:
I will work with development team to have a look at it. Thanks, |
Any ETA on this? I just ran into this problem and, as @jasonwadsworth said back in 2018, I've resorted to using a hack whenever I have to deal with DynamoDB lists:
|
We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue. |
I don't believe this has been fixed. I'm not heavily in the .Net space these days, but it's still an issue. |
This is a big problem and not a difficult fix. I am deeply disappointed by the quality of this library. I keep finding so many trivial bugs that should have been fixed within hours of being reported yet it has been years and no real response. I'm to the point where I'm considering writing my own high-level client. |
Adding that i want this to be fixed. Its a big issue now when migrating. Also realising that this could be a issue for us in other places in the future if this is not fixed. |
@LagerstedtMarcus @dtabuenc @jasonwadsworth @Jlalond Have you guys tried the workaround provided here? #1995 I commented with a solution to a user not being able to update empty lists, and am wondering if this workaround could also solve this issue. Please comment back if this workaround doesn't solve the issue and I will bring it to the teams attention again. |
I'm not actively using .Net (this issue is coming up on 5 years old), so I can't say for sure. If the solution sets the |
Is this ever going to be fixed? It is impossible to tell without literally parsing the json ourselves if something was null or empty. These are fundamentally different values and being unable to distinguish between them is a problem. |
@jamesbascle Dynamo will always send empty lists by default if you specify the conversion to V2
|
It's not about sending, but deserializing. If an empty array comes over the wire, say during the process of hooking up a Lambda to a DynamoDB change stream, you cannot tell the difference between an empty list and null by looking at the |
@jamesbascle I see, I understand the issue. I will bring this up to my team so we can re-prioritize this. |
Any status update on prioritization? My team encountered this bug again today. |
Any update here? This issue has been around a long time and my team is also stuck! |
For what it's worth, we're just using the document client and simply wrote a simple serialization/deserialization layer on top of it which wasn't hard. This library has way too many limitations, and is not suitable for doing single-table schemas. |
We released a new version of the It's more compatible with JSON parsers by using nullable value types and not initializing any collections. Note: If you're using the |
|
I'm using a DynamoDB stream record in a Lambda to move data from one table to another. The data from the stream is
Dictionary<string, Amazon.DynamoDBv2.Model.AttributeValue>
, which is the same data I need for aAmazon.DynamoDBv2.Model.PutRequest
. The problem I'm seeing is that I receive a record that is of typeL
butIsLSet
is false ifL
has no data.Expected Behavior
IsLSet
should betrue
if the data in DynamoDB is of type L, even if the list is empty.Current Behavior
When a record stored in DynamoDB is a list (
L
) theIsLSet
value isfalse
when the list is empty.Possible Solution
The code for
IsLSet
looks like this:The problem with this is that the result of
GetIsSet
will always be false for an empty list (unless that list is anAlwaysSendList
, which this is not, nor should it be).It seems to me that the solution might be to set a flag when
L
's setter is called and not base it on the existence of data in the list. Alternativelythis._l
could be null until it needs to not be null. If it is null the getter forL
could return an empty list. The presence of a nullthis._l
would be an indicator thatL
is not set, soIsLSet
could return false.Steps to Reproduce (for bugs)
Create a table in DynamoDB. Include an attribute with DynamoDB JSON like this:
Hook up a Lambda stream to the data (presumably you can just query or scan the table for the record as well) and inspect the
IsLSet
property. It will be set tofalse
when it should betrue
.Context
This bug is making it such that I cannot use the streams to migrate data between tables without intimate knowledge of the data (which I'd like to avoid). Given that this can occur repeatedly inside of nested objects (type
M
) a work around is not particularly feasible.Your Environment
.NET Core Info
The text was updated successfully, but these errors were encountered: