Stephanie Flavin created AVRO-3102:
--------------------------------------
Summary: Avro Java IPC responder fails to convert union null +
logical type fields
Key: AVRO-3102
URL: https://issues.apache.org/jira/browse/AVRO-3102
Project: Apache Avro
Issue Type: Bug
Components: java, logical types
Affects Versions: 1.10.2
Environment: Avro Version
* Avro IPC [1.10.2]
* Avro maven plugin [1.10.2]
Java Version [11]
Reporter: Stephanie Flavin
*Steps to replicate:*
1. Use the maven plugin with the following avdl
{noformat}
@namespace("org.example")
protocol TestService {
record MaybeLogicalTypes {
union {null, date} dateType = null;
union {null, time_ms} timeMsType = null;
union {null, timestamp_ms} timestampMsType = null;
}
MaybeLogicalTypes getMaybeLogicalTypes();
}{noformat}
2. Implement the TestService that returns a MaybeLogicalTypes object with the
values populated and start a server e.g.
{code:java}
Responder responder = new SpecificResponder(TestService.class,
new OKAvroHandler());
Server server = new NettyServer(responder,
new InetSocketAddress("127.0.0.1", port));
server.start();
{code}
3. Run the client code to request a MaybeLogicalTypes object.
{code:java}
SpecificRequestor.getClient(TestService.class, new
HttpTransceiver(url)).getMaybeLogicalTypes(){code}
The client will error when any of the fields are populated
{noformat}
org.apache.avro.AvroRuntimeException: Unknown datum type java.time.Instant:
2021-03-31T11:26:20.123888Z
at
org.apache.avro.ipc.specific.SpecificRequestor.readError(SpecificRequestor.java:160)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Requestor$Response.getResponse(Requestor.java:566)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Requestor$TransceiverCallback.handleResult(Requestor.java:366)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Requestor$TransceiverCallback.handleResult(Requestor.java:330)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Transceiver.transceive(Transceiver.java:73)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Requestor.request(Requestor.java:152)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.Requestor.request(Requestor.java:101)
~[avro-ipc-1.10.2.jar:1.10.2]
at
org.apache.avro.ipc.specific.SpecificRequestor.invoke(SpecificRequestor.java:108)
~[avro-ipc-1.10.2.jar:1.10.2]
{noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)