[ 
https://issues.apache.org/jira/browse/IGNITE-22181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850639#comment-17850639
 ] 

Aleksandr commented on IGNITE-22181:
------------------------------------

[~vkolodin] thank you for the clarification. 

It seems like the default scale (0) is the correct one and we have to specify 
the scale and precision explicitly. [~jooger] looks like this is not an issue, 
you can close it.

> 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
>            Priority: Major
>              Labels: ignite-3
>
> 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