You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Usman Shahid (JIRA)" <ji...@apache.org> on 2018/03/05 18:44:00 UTC

[jira] [Created] (AVRO-2154) Python to Java IPC converts boolean inside a union to integer

Usman Shahid created AVRO-2154:
----------------------------------

             Summary: Python to Java IPC converts boolean inside a union to integer
                 Key: AVRO-2154
                 URL: https://issues.apache.org/jira/browse/AVRO-2154
             Project: Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.8.2
         Environment: macOS 10.13.3

Java(TM) SE Runtime Environment (build 1.8.0_161-b12)

Python 2.7.10
            Reporter: Usman Shahid


Using the following IDL:
{code:java}
@namespace("us.codemug")
protocol BooleanTestProtocol {
  void booleanInUnion(union{boolean, int, string} myunion);
}
{code}
and the following Java implementation:
{code:java}
package us.codemug;

import java.util.Map;
import org.apache.avro.AvroRemoteException;

public class BooleanTestResponder implements BooleanTestProtocol {

  public Void booleanInUnion(Object myunion) throws AvroRemoteException {
    print(myunion);
    return null;
  }

  private void print(Object value) {
    System.out.println("Type: " + value.getClass().getName());
    System.out.println("Value: " + value);
  }
}

{code}
When performing the IPC from python with the input:
{code}
args = dict()
args['myunion'] = True
requestor.request('booleanInUnion', args)
{code}
Produces this output at the server side:
{code:java}
Type: java.lang.Integer
Value: 1
{code}
The booleans are being converted to integers



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)