[ 
https://issues.apache.org/jira/browse/BEAM-9887?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rahul Patwari updated BEAM-9887:
--------------------------------
    Description: 
schema.logicaltypes.FixedBytes logical type expects an argument - the length of 
the byte[].

When an invalid input value (with length < expectedLength) is provided while 
building the Row with FixedBytes logical type, IllegalArgumentException is 
expected. But, the Exception is not thrown. The below code illustrates the 
behaviour:
{code:java}
 Schema schema = Schema.builder().addLogicalTypeField("char", 
FixedBytes.of(10)).build();
 byte[] byteArray = {1, 2, 3, 4, 5};
 Row row = Row.withSchema(schema).withFieldValue("char", byteArray).build();
 System.out.println(Arrays.toString(row.getLogicalTypeValue("char", 
byte[].class)));
{code}
 

The above code prints "[1, 2, 3, 4, 5]" with length 5 to the console, whereas 
the expected length of FixedBytes, is 10.

 

The code is run on the master branch.

The behaviour is as expected with 2.20.0 release.

{{ }}

  was:
schema.logicaltypes.FixedBytes logical type expects an argument - the length of 
the byte[].

When an invalid input(length < expectedLength) value is provided while building 
the Row with FixedBytes logical type, IllegalArgumentException is expected. 
But, the Exception is not thrown.

 

Schema schema = Schema.builder().addLogicalTypeField("char", 
FixedBytes.of(10)).build();
byte[] byteArray = \{1, 2, 3, 4, 5};
Row row = Row.withSchema(schema).withFieldValue("char", byteArray).build();
System.out.println(Arrays.toString(row.getLogicalTypeValue("char", 
byte[].class)));

 

The above code print "[1, 2, 3, 4, 5]" with length 5, whereas the expected 
length of FixedBytes is 10.

{{ }}


> Expected Exception when building Row with logical types with Invalid input 
> ---------------------------------------------------------------------------
>
>                 Key: BEAM-9887
>                 URL: https://issues.apache.org/jira/browse/BEAM-9887
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Rahul Patwari
>            Assignee: Rahul Patwari
>            Priority: Major
>
> schema.logicaltypes.FixedBytes logical type expects an argument - the length 
> of the byte[].
> When an invalid input value (with length < expectedLength) is provided while 
> building the Row with FixedBytes logical type, IllegalArgumentException is 
> expected. But, the Exception is not thrown. The below code illustrates the 
> behaviour:
> {code:java}
>  Schema schema = Schema.builder().addLogicalTypeField("char", 
> FixedBytes.of(10)).build();
>  byte[] byteArray = {1, 2, 3, 4, 5};
>  Row row = Row.withSchema(schema).withFieldValue("char", byteArray).build();
>  System.out.println(Arrays.toString(row.getLogicalTypeValue("char", 
> byte[].class)));
> {code}
>  
> The above code prints "[1, 2, 3, 4, 5]" with length 5 to the console, whereas 
> the expected length of FixedBytes, is 10.
>  
> The code is run on the master branch.
> The behaviour is as expected with 2.20.0 release.
> {{ }}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to