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

Maksim Zhuravkov updated IGNITE-22325:
--------------------------------------
    Description: 
For both LocalDate and LocalDateTime BinaryTuple format 
(https://cwiki.apache.org/confluence/display/IGNITE/IEP-54%3A+Schema-first+Approach)
 can only store year as 14 value bits + 1 sign bit.

{code:java}
@Test
public void dateTest2() {
    LocalDate value = LocalDate.of(2000000, 1, 1);

    BinaryTupleBuilder builder = new BinaryTupleBuilder(1);
    ByteBuffer bytes = builder.appendDate(value).build();
    assertEquals(3, bytes.get(1));
    assertEquals(5, bytes.limit());

    BinaryTupleReader reader = new BinaryTupleReader(1, bytes);
    assertEquals(value, reader.dateValue(0));
}

org.opentest4j.AssertionFailedError: 
Expected :+2000000-01-01
Actual   :1152-01-01
{code}

It should be possible to store values that do not lie within the year range 
defined by BinaryTuple format.



  was:
For both LocalDate and LocalDateTime BinaryTuple format 
(https://cwiki.apache.org/confluence/display/IGNITE/IEP-54%3A+Schema-first+Approach)
 can only store year as 14 value bits + 1 sign bit.

{code:java}
@Test
public void dateTest2() {
    LocalDate value = LocalDate.of(2000000, 1, 1);

    BinaryTupleBuilder builder = new BinaryTupleBuilder(1);
    ByteBuffer bytes = builder.appendDate(value).build();
    assertEquals(3, bytes.get(1));
    assertEquals(5, bytes.limit());

    BinaryTupleReader reader = new BinaryTupleReader(1, bytes);
    assertEquals(value, reader.dateValue(0));
}

org.opentest4j.AssertionFailedError: 
Expected :+2000000-01-01
Actual   :1152-01-01
{code}

It should be possible to store such values in BinaryTuple format.




> BinaryTupleBuilder accepts LocalDate/LocalDateTime that can not be 
> represented by BinaryTuple
> ---------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-22325
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22325
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>
> For both LocalDate and LocalDateTime BinaryTuple format 
> (https://cwiki.apache.org/confluence/display/IGNITE/IEP-54%3A+Schema-first+Approach)
>  can only store year as 14 value bits + 1 sign bit.
> {code:java}
> @Test
> public void dateTest2() {
>     LocalDate value = LocalDate.of(2000000, 1, 1);
>     BinaryTupleBuilder builder = new BinaryTupleBuilder(1);
>     ByteBuffer bytes = builder.appendDate(value).build();
>     assertEquals(3, bytes.get(1));
>     assertEquals(5, bytes.limit());
>     BinaryTupleReader reader = new BinaryTupleReader(1, bytes);
>     assertEquals(value, reader.dateValue(0));
> }
> org.opentest4j.AssertionFailedError: 
> Expected :+2000000-01-01
> Actual   :1152-01-01
> {code}
> It should be possible to store values that do not lie within the year range 
> defined by BinaryTuple format.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to