[ 
https://issues.apache.org/jira/browse/BEAM-5376?focusedWorklogId=144002&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-144002
 ]

ASF GitHub Bot logged work on BEAM-5376:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Sep/18 16:28
            Start Date: 13/Sep/18 16:28
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #6383: 
[BEAM-5376] Support nullability on all Row types
URL: https://github.com/apache/beam/pull/6383#discussion_r217450564
 
 

 ##########
 File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/schemas/JavaBeanSchemaTest.java
 ##########
 @@ -155,10 +155,10 @@ public void testRecursiveGetters() throws 
NoSuchSchemaException {
 
     Row nestedRow = row.getRow("nested");
     assertEquals("string", nestedRow.getString("str"));
-    assertEquals((byte) 1, nestedRow.getByte("aByte"));
-    assertEquals((short) 2, nestedRow.getInt16("aShort"));
-    assertEquals((int) 3, nestedRow.getInt32("anInt"));
-    assertEquals((long) 4, nestedRow.getInt64("aLong"));
+    assertEquals((byte) 1, (Object) nestedRow.getByte("aByte"));
 
 Review comment:
   It is unfortunate that there's `assertEquals(long, long)` overload that is 
applicable here.
   
   Correct way of doing `Byte.valueOf()` is `Byte.valueOf((byte) 1)`, which is 
ugly. Probably even uglier way is `(Byte)(byte)1`. Another ugly approach is to 
create a local wrapper method `void myAssertEquals(Object a, Object b) { 
assertEquals(a, b); }`.
   
   I mentioned `assertTrue()` as an example, not suggesting to use it.
   
   To Rui's point, though, if you look at how `Byte.equals()` works, it accepts 
an `Object` and casts it to `Byte`, so in this case for semantics it shouldn't 
matter whether to cast it at all, to cast it to `Byte` or `Object`. Casting 
here only allows to unambiguously choose the `assertEquals(Object, Object)` 
overload over `assertEquals(long, long)`, and I don't have an idea how to do 
that cleanly, so I don't mind either your approach or any of the proposed in 
the discussion.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 144002)
    Time Spent: 1.5h  (was: 1h 20m)

> Row interface doesn't support nullability on all fields.
> --------------------------------------------------------
>
>                 Key: BEAM-5376
>                 URL: https://issues.apache.org/jira/browse/BEAM-5376
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Andrew Pilloud
>            Assignee: Andrew Pilloud
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> For example: 
> {code:java}
> public boolean getBoolean(int idx);{code}
> Should be:
> {code:java}
> public Boolean getBoolean(int idx);{code}



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

Reply via email to