Uploaded image for project: 'Tajo (Retired)'
  1. Tajo (Retired)
  2. TAJO-1098

LogicalPlanVerifier should validate operations within CASE WHEN clauses.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.9.0
    • None
    • None

    Description

      See the following example. Sine PERIOD column is interval type, it can be compared with only interval type constant. But, PERIOD < 0 should try to compare between INTERVAL and INT4 type.

      SELECT
        ID, PERIOD, CASE  
        WHEN PERIOD < 0 THEN 'N/A'
        WHEN PERIOD <= INTERVAL '12h' THEN 'C0'
        WHEN PERIOD <= INTERVAL '24h' THEN 'C1'
        WHEN PERIOD <= INTERVAL '48h' THEN 'C2'
       ...
      

      In this case, the execution engine cause the following error:

      Progress: 17%, response time: 29.557 sec
      Progress: 18%, response time: 30.558 sec
      Progress: 18%, response time: 31.56 sec
      Progress: 19%, response time: 32.561 sec
      Progress: 20%, response time: 33.563 sec
      Progress: 20%, response time: 34.567 sec
      Progress: 21%, response time: 35.57 sec
      Progress: 22%, response time: 36.571 sec
      Progress: 22%, response time: 37.573 sec
      Progress: 23%, response time: 38.574 sec
      Progress: 23%, response time: 39.576 sec
      Progress: 24%, response time: 40.577 sec
      Progress: 50%, response time: 41.579 sec
      Progress: 75%, response time: 42.581 sec
      ERROR: Cannot compare to INT4 type datum
      org.apache.tajo.exception.InvalidOperationException: Cannot compare to INT4 type datum
      	at org.apache.tajo.datum.IntervalDatum.compareTo(IntervalDatum.java:414)
      	at org.apache.tajo.datum.Datum.lessThan(Datum.java:177)
      	at org.apache.tajo.engine.eval.BinaryEval.eval(BinaryEval.java:134)
      	at org.apache.tajo.engine.eval.CaseWhenEval$IfThenEval.checkIfCondition(CaseWhenEval.java:219)
      	at org.apache.tajo.engine.eval.CaseWhenEval.eval(CaseWhenEval.java:109)
      	at org.apache.tajo.engine.planner.Projector.eval(Projector.java:63)
      	at org.apache.tajo.engine.planner.physical.ProjectionExec.next(ProjectionExec.java:60)
      	at org.apache.tajo.engine.planner.physical.StoreTableExec.next(StoreTableExec.java:112)
      	at org.apache.tajo.worker.Task.run(Task.java:446)
      	at org.apache.tajo.worker.TaskRunner$1.run(TaskRunner.java:276)
      	at java.lang.Thread.run(Thread.java:744)
      

      To avoid such a execution error, LogicalPlanVerifier should validate all operations within CASE WHEN.

      Attachments

        Activity

          People

            hyunsik Hyunsik Choi
            hyunsik Hyunsik Choi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: