You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Mikhail Petrov (Jira)" <ji...@apache.org> on 2022/04/06 16:30:00 UTC

[jira] [Created] (IGNITE-16808) SQL insert fails if it contains OffsetDateTime class

Mikhail Petrov created IGNITE-16808:
---------------------------------------

             Summary: SQL insert fails if it contains OffsetDateTime class
                 Key: IGNITE-16808
                 URL: https://issues.apache.org/jira/browse/IGNITE-16808
             Project: Ignite
          Issue Type: Bug
            Reporter: Mikhail Petrov


Reproducer:
/** */
public class OffsetDateTimeIndexTest extends AbstractIndexingCommonTest {
    /** */
    @Test
    public void test() throws Exception {
        IgniteEx ignite = startGrids(2);

        ignite.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
            .setIndexedTypes(String.class, Data.class).setSqlSchema("PUBLIC"));

        SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO PUBLIC.DATA(_key, str, offsetDateTime) values(?, ?, ?)").setArgs("0", "0", OffsetDateTime.now());

        ignite.context().query().querySqlFields(qry, false).getAll();
    }

    public static class Data implements Serializable {
        /** Serial version UID. */
        private static final long serialVersionUID = 1L;

        /** */
        @QuerySqlField(index = true)
        public String str;

        /** */
        @QuerySqlField(index = true)
        public OffsetDateTime offsetDateTime;
    }
}

Exception: 

{code:java}
class org.apache.ignite.internal.processors.query.IgniteSQLException: Value conversion failed [column=OFFSETDATETIME, from=java.time.OffsetDateTime, to=java.time.OffsetDateTime]

	at org.apache.ignite.internal.processors.query.h2.dml.DmlUtils.convert(DmlUtils.java:157)
	at org.apache.ignite.internal.processors.query.h2.dml.UpdatePlan.processRow(UpdatePlan.java:263)
	at org.apache.ignite.internal.processors.query.h2.dml.DmlUtils.dmlDoInsert(DmlUtils.java:212)
	at org.apache.ignite.internal.processors.query.h2.dml.DmlUtils.processSelectResult(DmlUtils.java:185)
	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeUpdateNonTransactional(IgniteH2Indexing.java:2902)
	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeUpdate(IgniteH2Indexing.java:2747)
	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeUpdateDistributed(IgniteH2Indexing.java:2673)
	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeDml(IgniteH2Indexing.java:1263)
	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1185)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:3005)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor$2.applyx(GridQueryProcessor.java:2988)
	at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:3650)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$3(GridQueryProcessor.java:3022)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:3094)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2982)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2909)
	at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2882)
	at org.apache.ignite.internal.processors.query.OffsetDateTimeIndexTest.test(OffsetDateTimeIndexTest.java:41)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.apache.ignite.testframework.junits.GridAbstractTest$6.run(GridAbstractTest.java:2431)
	at java.lang.Thread.run(Thread.java:748)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to wrap value[type=24, value=2022-04-06T19:27:05.226+03:00]
	at org.apache.ignite.internal.processors.query.h2.H2Utils.wrap(H2Utils.java:658)
	at org.apache.ignite.internal.processors.query.h2.H2Utils.convert(H2Utils.java:510)
	at org.apache.ignite.internal.processors.query.h2.dml.DmlUtils.convert(DmlUtils.java:146)
	... 28 more
{code}




--
This message was sent by Atlassian Jira
(v8.20.1#820001)