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

Sql. Investigate why there is more than one instance of default value placeholder.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 3.0
    • sql
    • Docs Required, Release Notes Required

    Description

      Investigate why there is more than value of default value placeholder even though Default value placeholder implements readResolve method and it is uses java serialization.

      Reproducer:

      Update RexImpTable to use the following code for placeholders.

      private static class Placeholder {
              static final Object DEFAULT_VALUE = DefaultValuePlaceholder.VALUE;
              static final Object UNSPECIFIED_VALUE = UnspecifiedValuePlaceholder.VALUE;
          }
      
          public static void ensurePlaceholderRemoved(Object value) {
              if (value instanceof DefaultValuePlaceholder && value != Placeholder.DEFAULT_VALUE) {
                  throw new AssertionError("Unexpected DEFAULT value placeholder: " + value + ". Expected: " + Placeholder.DEFAULT_VALUE);
              }
          }
      
          private static final class DefaultValuePlaceholder implements Serializable {
      
              private static final DefaultValuePlaceholder VALUE = new DefaultValuePlaceholder();
      
              private static final long serialVersionUID = -978388731876609995L;
      
              private Object readResolve() {
                  return VALUE;
              }
      
              public String toString() {
                  return "DEFAULT#" + hashCode();
              }
          }
      
          private static final class UnspecifiedValuePlaceholder implements Serializable {
      
              private static final UnspecifiedValuePlaceholder VALUE = new UnspecifiedValuePlaceholder();
      
              private static final long serialVersionUID = 3312208611999510012L;
      
              private Object readResolve() {
                  return VALUE;
              }
      
              public String toString() {
                  return "<UNSPECIFIED_VALUE>";
              }
          }
      

      Update IgniteTableImpl convertRow:

      Object val = hnd.get(colDesc.logicalIndex(), row);
      + if (val != null) {
      +  RexImpTable.ensurePlaceholderRemoved(val);
      + }
      

      Error:

      Caused by: java.lang.AssertionError: Unexpected DEFAULT value placeholder: DEFAULT#238068340. Expected: DEFAULT#1599919888
      	at org.apache.ignite.internal.sql.engine.exec.exp.RexImpTable.ensurePlaceholderRemoved(RexImpTable.java:2588)
      	at org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl.convertRow(IgniteTableImpl.java:514)
      	at org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl.insertAll(IgniteTableImpl.java:390)
      	at org.apache.ignite.internal.sql.engine.exec.rel.ModifyNode.flushTuples(ModifyNode.java:218)
      	at org.apache.ignite.internal.sql.engine.exec.rel.ModifyNode.tryEnd(ModifyNode.java:187)
      	at org.apache.ignite.internal.sql.engine.exec.rel.ModifyNode.end(ModifyNode.java:160)
      	at org.apache.ignite.internal.sql.engine.exec.rel.Inbox.pushUnordered(Inbox.java:333)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            mzhuravkov Maksim Zhuravkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: