Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-21797

Column's type mismatch during marshalling of pojo (embedded API)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 3.0.0-beta2
    • None

    Description

      Take a look at the scenario below:

          static class Key {
              int int_col;
              String str_col;
          }
      
          static class Val {
              boolean bool_col;
              LocalDate date_col;
          }
      
          sql("CREATE TABLE test (int_col INT, bool_col BOOLEAN, date_col DATE, str_col VARCHAR, PRIMARY KEY (int_col, str_col))");
      
          KeyValueView<Key, Val> kvView = CLUSTER.aliveNode().tables()
                  .table("test")
                  .keyValueView(Key.class, Val.class);
      
          var key = new Key();
          key.int_col = 1;
          key.str_col = "1";
      
          var val = new Val();
          val.bool_col = true;
          val.date_col = LocalDate.now();
      
          kvView.put(null, key, val);
      

      Mind the order of primary key fields: the first and the last columns in table declaration. In that case, InvalidTypeException is thrown, because after IGNITE-19744 key columns are not grouped in the very beginning of the row anymore, but marshaller of embedded client still appends key columns first (see org.apache.ignite.internal.schema.marshaller.reflection.KvMarshallerImpl#marshal(K, V)).

      Attachments

        Issue Links

          Activity

            People

              mzhuravkov Maksim Zhuravkov
              korlov Konstantin Orlov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h