Maksim Zhuravkov created IGNITE-22325:
-----------------------------------------

             Summary: 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
             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 that can be stored in 14 bit + 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.





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

Reply via email to