You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@tajo.apache.org by "Hyunsik Choi (JIRA)" <ji...@apache.org> on 2014/10/06 19:16:34 UTC

[jira] [Created] (TAJO-1098) LogicalPlanVerifier should not validate operations within CASE WHEN clauses.

Hyunsik Choi created TAJO-1098:
----------------------------------

             Summary: LogicalPlanVerifier should not validate operations within CASE WHEN clauses.
                 Key: TAJO-1098
                 URL: https://issues.apache.org/jira/browse/TAJO-1098
             Project: Tajo
          Issue Type: Bug
            Reporter: Hyunsik Choi


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. 

{noformat}
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'
 ...
{noformat}

In this case, the execution engine cause the following error:
{noformat}
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)
{noformat}

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)