Revert "IGNITE-8552: SQL: mapped DATE data type to java.util.Date in DDL 
processor. This allows to use DATE type as PK from DDL as well as significantly 
improves performance of DATE column processing if parent table was created from 
DDL. This closes #4692."

This reverts commit bc41ab03f9ec832b9cc5d7f59e1be68cb7249758.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a3cca2f6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a3cca2f6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a3cca2f6

Branch: refs/heads/ignite-gg-14206
Commit: a3cca2f677a60835d84e20cb04520da5491bc3d7
Parents: 0b2fc15
Author: devozerov <voze...@gridgain.com>
Authored: Wed Sep 26 13:34:09 2018 +0300
Committer: devozerov <voze...@gridgain.com>
Committed: Wed Sep 26 13:34:09 2018 +0300

----------------------------------------------------------------------
 .../query/h2/ddl/DdlStatementsProcessor.java    |   3 -
 .../twostep/CreateTableWithDateKeySelfTest.java | 219 -------------------
 .../IgniteCacheQuerySelfTestSuite2.java         |   3 -
 3 files changed, 225 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a3cca2f6/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
index d7a0547..8688c4fbd9 100644
--- 
a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
+++ 
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/ddl/DdlStatementsProcessor.java
@@ -779,9 +779,6 @@ public class DdlStatementsProcessor {
                 if (!handleUuidAsByte)
                     return UUID.class.getName();
 
-            case Value.DATE:
-                return java.util.Date.class.getName();
-
             default:
                 return DataType.getTypeClassName(type);
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/a3cca2f6/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/CreateTableWithDateKeySelfTest.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/CreateTableWithDateKeySelfTest.java
 
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/CreateTableWithDateKeySelfTest.java
deleted file mode 100644
index 6539276..0000000
--- 
a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/twostep/CreateTableWithDateKeySelfTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.query.h2.twostep;
-
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.temporal.ChronoUnit;
-import java.util.Date;
-import java.util.List;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.query.FieldsQueryCursor;
-import org.apache.ignite.cache.query.SqlFieldsQuery;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class CreateTableWithDateKeySelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final int NODES_COUNT = 1;
-
-    /** */
-    private static Ignite ignite;
-
-    /** */
-    private static IgniteCache<?, ?> initCache;
-
-    /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        ignite = startGridsMultiThreaded(NODES_COUNT, false);
-
-        initCache = ignite.getOrCreateCache(new 
CacheConfiguration<>(DEFAULT_CACHE_NAME)
-            .setSqlSchema("PUBLIC")
-        );
-    }
-
-    /** {@inheritDoc} */
-    @Override protected void afterTestsStopped() throws Exception {
-        stopAllGrids();
-    }
-
-    /** */
-    public void testPassTableWithDateKeyCreation() {
-        final String creationQry = "CREATE TABLE %s (id DATE primary key, 
dateField DATE) " +
-            "WITH \"cache_name=%s, WRAP_VALUE=false\"";
-
-        final Date key = new Date();
-
-        final Date val = Date.from(Instant.now().minus(1, ChronoUnit.DAYS));
-
-        checkInsertUpdateDelete(creationQry, "Tab1", key, val);
-    }
-
-    /** */
-    public void testPassTableWithTimeKeyCreation() {
-        final String creationQry = "CREATE TABLE %s (id TIME primary key, 
dateField TIME) " +
-            "WITH \"cache_name=%s, WRAP_VALUE=false\"";
-
-        final Time key = Time.valueOf(LocalTime.now());
-
-        final Time val = Time.valueOf(LocalTime.now());
-
-        checkInsertUpdateDelete(creationQry, "Tab2", key, val);
-    }
-
-    /** */
-    public void testPassTableWithTimeStampKeyCreation() {
-        final String creationQry = "CREATE TABLE %s (id TIMESTAMP primary key, 
dateField TIMESTAMP) " +
-            "WITH \"cache_name=%s, WRAP_VALUE=false\"";
-
-        final Timestamp key = Timestamp.valueOf(LocalDateTime.now());
-
-        final Timestamp val = Timestamp.valueOf(LocalDateTime.now());
-
-        checkInsertUpdateDelete(creationQry, "Tab3", key, val);
-    }
-
-    /**
-     * Common testing logic
-     *
-     * @param creationQry Create table query.
-     * @param tblName Table name.
-     * @param key Sample key.
-     * @param val Sample value.
-     * @param <K> Type of key.
-     * @param <V> Type of value.
-     */
-    private <K, V> void checkInsertUpdateDelete(
-        final String creationQry,
-        final String tblName,
-        final K key,
-        final V val) {
-        final String cacheName = "TABLE_CACHE_" + tblName;
-
-        try (FieldsQueryCursor<List<?>> cur = initCache.query(
-            new SqlFieldsQuery(String.format(creationQry, tblName, 
cacheName)))) {
-
-            assertNotNull(cur);
-
-            List<List<?>> rows = cur.getAll();
-
-            assertEquals(1, rows.size());
-
-            assertEquals(0L, rows.get(0).get(0));
-        }
-
-        IgniteCache<K, V> cache = ignite.getOrCreateCache(cacheName);
-
-        try (FieldsQueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery(
-            "INSERT INTO " + tblName + " VALUES(?, ?)").setArgs(key, val))) {
-
-            assertNotNull(cur);
-
-            List<List<?>> rows = cur.getAll();
-
-            assertEquals(1, rows.size());
-
-            assertEquals(1L, rows.get(0).get(0));
-        }
-
-        assertSelection(tblName, cache, key, val);
-
-        assertEquals(val, cache.get(key));
-
-        cache.remove(key);
-
-        assertAbsence(tblName, cache, key);
-
-        assertFalse(cache.containsKey(key));
-
-        cache.put(key, val);
-
-        assertEquals(val, cache.get(key));
-
-        assertSelection(tblName, cache, key, val);
-
-        try (FieldsQueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery(
-            "DELETE FROM " + tblName + " WHERE id=?").setArgs(key))) {
-
-            assertNotNull(cur);
-
-            List<List<?>> rows = cur.getAll();
-
-            assertEquals(1, rows.size());
-
-            assertEquals(1L, rows.get(0).get(0));
-        }
-
-        assertAbsence(tblName, cache, key);
-
-        assertFalse(cache.containsKey(key));
-    }
-
-    /**
-     * Check absence of key in the table.
-     *
-     * @param tblName Table name.
-     * @param cache Cache.
-     * @param key Sample key.
-     * @param <K> Type of key.
-     * @param <V> Type of value.
-     */
-    private <K, V> void assertAbsence(final String tblName, final 
IgniteCache<K, V> cache, final K key) {
-        try (FieldsQueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery(
-            "select * from " + tblName + " where id=?").setArgs(key))) {
-            assertNotNull(cur);
-
-            List<List<?>> rows = cur.getAll();
-
-            assertEquals(0, rows.size());
-        }
-    }
-
-    /**
-     * Check presence of key in the table.
-     *
-     * @param tblName Table name.
-     * @param cache Cache.
-     * @param key Sample key.
-     * @param val Sample value.
-     * @param <K> Type of key.
-     * @param <V> Type of value.
-     */
-    private <K, V> void assertSelection(final String tblName, final 
IgniteCache<K, V> cache, final K key,
-        final V val) {
-        try (FieldsQueryCursor<List<?>> cur = cache.query(new SqlFieldsQuery(
-            "select * from " + tblName + " where id=?").setArgs(key))) {
-            assertNotNull(cur);
-
-            List<List<?>> rows = cur.getAll();
-
-            assertEquals(1, rows.size());
-
-            assertEquals(key, rows.get(0).get(0));
-
-            assertEquals(val, rows.get(0).get(1));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/a3cca2f6/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
----------------------------------------------------------------------
diff --git 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
index dba046b..4b91b43 100644
--- 
a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
+++ 
b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite2.java
@@ -51,7 +51,6 @@ import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlDistribut
 import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlSegmentedIndexMultiNodeSelfTest;
 import 
org.apache.ignite.internal.processors.query.IgniteCacheGroupsSqlSegmentedIndexSelfTest;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.CacheQueryMemoryLeakTest;
-import 
org.apache.ignite.internal.processors.query.h2.twostep.CreateTableWithDateKeySelfTest;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.DisappearedCacheCauseRetryMessageSelfTest;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.DisappearedCacheWasNotFoundMessageSelfTest;
 import 
org.apache.ignite.internal.processors.query.h2.twostep.NonCollocatedRetryMessageSelfTest;
@@ -116,8 +115,6 @@ public class IgniteCacheQuerySelfTestSuite2 extends 
TestSuite {
 
         suite.addTestSuite(CacheQueryMemoryLeakTest.class);
 
-        suite.addTestSuite(CreateTableWithDateKeySelfTest.class);
-
         suite.addTestSuite(NonCollocatedRetryMessageSelfTest.class);
         suite.addTestSuite(RetryCauseMessageSelfTest.class);
         suite.addTestSuite(DisappearedCacheCauseRetryMessageSelfTest.class);

Reply via email to