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

Exception on modulus operator in SQL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • None
    • None
    • sql

    Description

      Query

      select key % 2 from TBL_DOUBLE
      

      Result

      java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes:
      validated type:
      RecordType(INTEGER NOT NULL KEY % 2) NOT NULL
      converted type:
      RecordType(DECIMAL(25, 15) NOT NULL KEY % 2) NOT NULL
      rel:
      LogicalProject(KEY % 2=[MOD(CAST($0):DECIMAL(30, 15) NOT NULL, 2)])
        IgniteLogicalTableScan(table=[[PUBLIC, TBL_DOUBLE]])
      
      	at org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:492)
      	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:607)
      	at org.apache.ignite.internal.sql.engine.prepare.IgnitePlanner.rel(IgnitePlanner.java:222)
      	at org.apache.ignite.internal.sql.engine.prepare.PlannerHelper.optimize(PlannerHelper.java:63)
      	at org.apache.ignite.internal.sql.engine.prepare.PrepareServiceImpl.lambda$prepareQuery$1(PrepareServiceImpl.java:231)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      
      

      Note that some simple queries like "select 1 % 2" work.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ptupitsyn Pavel Tupitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              3 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 - 10m
                  10m