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

SQL create index on invalid data type

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.9
    • Component/s: sql
    • Labels:
      None
    • Release Note:
      Fix an issue when node stops if index is created on field with invalid data type
    • Ignite Flags:
      Docs Required, Release Notes Required

      Description

      Reproduce

      • Create cache with value class
            private static class Value {
                @QuerySqlField
                int val_int;
                java.util.Date val_date;
            }
        
      • alter table with command
        ALTER TABLE TEST ADD COLUMN (VAL_DATE DATE)
      • try to create index with command
        CREATE INDEX TEST_VAL_DATE_IDX ON TEST(VAL_DATE)

      CorruptedTreeException is thrown, the node is stopped.

      class org.apache.ignite.IgniteCheckedException: Runtime failure on row: Row@6a2853cd[ key: 0, val: org.apache.ignite.internal.processors.query.CreateIndexOnInvalidDataTypeTest$Value [idHash=1693430008, hash=1583713321, val_int=0, val_date=Thu Jan 01 03:00:00 MSK 1970] ][ 0, <value skipped on error: Failed to wrap object into H2 Value. java.util.Date cannot be cast to java.sql.Date> ]
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.doPut(BPlusTree.java:2438)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.putx(BPlusTree.java:2388)
      	at org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex.putx(H2TreeIndex.java:434)
      	at org.apache.ignite.internal.processors.query.h2.IndexBuildClosure.apply(IndexBuildClosure.java:52)
      	at org.apache.ignite.internal.processors.query.schema.SchemaIndexCachePartitionWorker$SchemaIndexCacheVisitorClosureWrapper.apply(SchemaIndexCachePartitionWorker.java:298)
      	at org.apache.ignite.internal.processors.cache.GridCacheMapEntry.updateIndex(GridCacheMapEntry.java:4494)
      	at org.apache.ignite.internal.processors.query.schema.SchemaIndexCachePartitionWorker.processKey(SchemaIndexCachePartitionWorker.java:231)
      	at org.apache.ignite.internal.processors.query.schema.SchemaIndexCachePartitionWorker.processPartition(SchemaIndexCachePartitionWorker.java:188)
      	at org.apache.ignite.internal.processors.query.schema.SchemaIndexCachePartitionWorker.body(SchemaIndexCachePartitionWorker.java:127)
      	at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to wrap object into H2 Value. java.util.Date cannot be cast to java.sql.Date
      	at org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow.wrap(H2CacheRow.java:177)
      	at org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow.getValue0(H2CacheRow.java:109)
      	at org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow.getValue(H2CacheRow.java:91)
      	at org.apache.ignite.internal.processors.query.h2.database.io.AbstractH2ExtrasLeafIO.storeByOffset(AbstractH2ExtrasLeafIO.java:115)
      	at org.apache.ignite.internal.processors.query.h2.database.io.AbstractH2ExtrasLeafIO.storeByOffset(AbstractH2ExtrasLeafIO.java:37)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO.store(BPlusIO.java:185)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO.insert(BPlusIO.java:272)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Put.insertSimple(BPlusTree.java:3685)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Put.insert(BPlusTree.java:3667)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Put.access$1900(BPlusTree.java:3539)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Insert.run0(BPlusTree.java:452)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Insert.run0(BPlusTree.java:433)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5889)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$GetPageHandler.run(BPlusTree.java:5875)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.util.PageHandler.writePage(PageHandler.java:360)
      	at org.apache.ignite.internal.processors.cache.persistence.DataStructure.write(DataStructure.java:297)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.access$11300(BPlusTree.java:99)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Put.tryInsert(BPlusTree.java:3859)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Put.access$7100(BPlusTree.java:3539)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.putDown(BPlusTree.java:2803)
      	at org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree.doPut(BPlusTree.java:2408)
      	... 12 more
      Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date
      	at org.apache.ignite.internal.processors.query.h2.H2Utils.wrap(H2Utils.java:625)
      	at org.apache.ignite.internal.processors.query.h2.opt.H2CacheRow.wrap(H2CacheRow.java:174)
      	... 32 more
      

        Attachments

          Activity

            People

            • Assignee:
              tledkov-gridgain Taras Ledkov
              Reporter:
              tledkov-gridgain Taras Ledkov
            • Votes:
              0 Vote for this issue
              Watchers:
              5 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 - 50m
                50m