You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Maksim Zhuravkov (Jira)" <ji...@apache.org> on 2023/03/20 06:42:00 UTC

[jira] [Updated] (IGNITE-19066) Sql. Investigate why there is more than one instance of default value placeholder.

     [ https://issues.apache.org/jira/browse/IGNITE-19066?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maksim Zhuravkov updated IGNITE-19066:
--------------------------------------
    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.
{code:java}
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>";
        }
    }
{code}

Update IgniteTableImpl convertRow:

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

Error:
{code:java}
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)
{code}



  was:
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. 

Update RexImpTable to use the following code for placeholders.
{code:java}
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>";
        }
    }
{code}

Update IgniteTableImpl convertRow:

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

Error:
{code:java}
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)
{code}




> Sql. Investigate why there is more than one instance of default value placeholder.
> ----------------------------------------------------------------------------------
>
>                 Key: IGNITE-19066
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19066
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Minor
>              Labels: calcite3-required, ignite-3
>             Fix For: 3.0.0-beta2
>
>
> 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.
> {code:java}
> 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>";
>         }
>     }
> {code}
> Update IgniteTableImpl convertRow:
> {code:java}
> Object val = hnd.get(colDesc.logicalIndex(), row);
> + if (val != null) {
> +  RexImpTable.ensurePlaceholderRemoved(val);
> + }
> {code}
> Error:
> {code:java}
> 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)
> {code}



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