Aleksandr created IGNITE-22181:
----------------------------------

             Summary: BigDecimal scale is lost during create table
                 Key: IGNITE-22181
                 URL: https://issues.apache.org/jira/browse/IGNITE-22181
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksandr


Given a pojo

{code:java}
 @Table
    public static class PojoClass {
        @Id
        private Integer i;
        private BigDecimal b;

        public Integer getI() {
            return i;
        }

        public void setI(int i) {
            this.i = i;
        }

        public BigDecimal getB() {
            return b;
        }

        public void setB(BigDecimal b) {
            this.b = b;
        }
{code}

I create a table from it with this call: 


{code:java}
 client.catalog().create(PojoClass.class).execute();
{code}

Then I insert one record and read it:


{code:java}
 var table = client.tables().table(PojoClass.class.getSimpleName());
 var pojo = new PojoClass();
 pojo.setI(44);
 pojo.setB(new BigDecimal("123.45")); // <-- NOTE 

 var pojoRecordView = table.recordView(PojoClass.class);
 pojoRecordView.insert(null, pojo);

 var keyPojo = new PojoClass();
 keyPojo.setI(44);
 assertThat(pojoRecordView.get(null, keyPojo), equalTo(pojo)); <-- THIS FAILS
{code}

The assertion is failed due the scale (2) is lost for the BigDecimal field 
during the table creation.




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

Reply via email to