csharp-driver icon indicating copy to clipboard operation
csharp-driver copied to clipboard

CSHARP-975 fix: add check timestamp that cassandra gives if less then…

Open okanlodos opened this issue 3 years ago • 2 comments

this is for https://datastax-oss.atlassian.net/browse/CSHARP-975.

i added the min value as long because DateTimeOffset.ToUnixTimeMilliseconds() is not available in .net=4.5.2

okanlodos avatar Jul 28 '22 20:07 okanlodos

Hi, thanks for the issue report and the PR! It's still not clear to me what the best solution for this problem is so I'll keep investigating this.

I don't think the solution implemented in this PR is good enough because it basically modifies the data that is being read so the user will not actually be able to read the correct data from the database.

Since the type itself does not support the values that are being read from the database it seems to me that we have 2 options:

  1. Introduce a breaking change and change the default C# type that is associated with this C* type
  2. Introduce a custom serializer that users can use if they run into this issue (and potentially set this as the default in the next major version of the driver, whenever that happens)

I'm going to discard option 1 because this issue is very very rare so I can't justify forcing all users to change their application code for something that doesn't affect the vast majority of the userbase. For context, this is the first report of this issue and the driver has been around for a long time.

I'll try to get something together for option 2 to see if it is a good solution for this.

joao-r-reis avatar Nov 03 '22 12:11 joao-r-reis

i guess, the best way to fix it is fix the datetime lib in java :D even if we fix it, it won't work old incorrect data.

we are using csharpdriver with json select, and then deserialize to entity object with external json lib(newtonsoft etc.). therefore we prevented that DateTimeSerialization throws exception by not using. maybe, new serializer that handle this issue would be good.

if i have time, i am gonna look at what i can do better on this problem than this.

okanlodos avatar Nov 27 '22 20:11 okanlodos