google-cloud-dotnet: Datastore query projection with datetime returns integer
I have datetime type in my projection and it returns me integer value instead of timestamp value. If I remove the datetime type from projection, I get correct type back. Below is sample query -
Query query = new Query(historical)
{
Filter = filter,
Projection = { stocksymbol, date },
DistinctOn = { stocksymbol },
Order = {
{ stocksymbol, PropertyOrder.Types.Direction.Descending },
{ date, PropertyOrder.Types.Direction.Descending }
}
};
var queryResult = await dataStore.RunQueryAsync(query);
queryResult.Entities.Properties[date] return back Integer value.
I read about similar issue here (https://github.com/googleapis/google-cloud-node/issues/1319) and the workaround given is not working for me.
This is my modified code with the workaround but I still get incorrect date:
var result = new DateTime(Convert.ToInt64(x.Properties[date].IntegerValue.ToString(), 10) / 1000)
Any ideas what I am missing or how do i fix this issue?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17
Commits related to this issue
- Add methods for timestamp conversion from projection results Fixes #2546. — committed to jskeet/google-cloud-dotnet by jskeet 6 years ago
- Add methods for timestamp conversion from projection results Fixes #2546. — committed to googleapis/google-cloud-dotnet by jskeet 6 years ago
@Thaina: That would only work with an integer number of seconds or milliseconds (we go down to microseconds) - and isn’t available in the frameworks we target. (So it could be in client code, but not in our libraries.)