-
Notifications
You must be signed in to change notification settings - Fork 85
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
JsonToProtoMessage java.time.LocalDateTime error #1330
Comments
Yes, we have an issue. In the meantime, could you use the CivilTimeEncoder library to convert LocalDateTime into int64? |
Example: json.put("test_time", CivilTimeEncoder.encodePacked64TimeMicros(LocalTime.of(1, 0, 1))); |
For string you can use LocalTime.parse. |
@yirutang It works thank you ! |
I'm getting this same error in 2.10.1. The error message when trying to insert an OffsetDateTime is: Exception: JSONObject does not have a int64 field at root.file_modification_datetime. Stack: Can this be reopened? |
Steps to reproduce
[{"d":"2021-09-27T20:51:10.752"}]
built usingLocalDateTime.now()
Stack trace
External references such as API reference guides
https://cloud.google.com/bigquery/docs/write-api
Any additional information below
It seems that JsonToProtoMessage.java:173 is catching the datetime. Because it cannot be cast to Integer or Long, it throw an error : JSONObject does not have a int64 field at root.d.
case INT64: if (val instanceof Integer) { protoMsg.setField(fieldDescriptor, new Long((Integer) val)); return; } else if (val instanceof Long) { protoMsg.setField(fieldDescriptor, (Long) val); return; } break;
Am i doing it wrong ?
Thanks for your help. (and sorry for my English)
The text was updated successfully, but these errors were encountered: