Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-407

PostgreSQL-style cast should have higher operator priority

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: Expression
    • Labels:
      None

      Description

      See the title. Currently, postgresql-style cast has lower operator priority than some operators like equal(=). So, the following statement does not work properly.

      tajo> select l_shipdate from lineitem where l_shipdate = '1996-03-13'::date limit 1;
      ERROR: No operator matches the given name and argument type(s): lineitem.l_shipdate (DATE(0)) = 1996-03-13
      
      1. TAJO-407.patch
        14 kB
        Hyunsik Choi

        Activity

        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-trunk-postcommit #612 (See https://builds.apache.org/job/Tajo-trunk-postcommit/612/)
        TAJO-407: PostgreSQL-style cast should have higher operator priority. (hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=3c302d9e290f5cacaa00d24750fae72d3d35c3e0)

        • tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java
        • CHANGES.txt
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/CastEval.java
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java
        • tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-trunk-postcommit #612 (See https://builds.apache.org/job/Tajo-trunk-postcommit/612/ ) TAJO-407 : PostgreSQL-style cast should have higher operator priority. (hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=3c302d9e290f5cacaa00d24750fae72d3d35c3e0 ) tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/parser/TestHiveConverter.java tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestDateTimeFunctions.java CHANGES.txt tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/eval/TestSQLExpression.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/eval/CastEval.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/parser/SQLAnalyzer.java tajo-core/tajo-core-backend/src/main/antlr4/org/apache/tajo/engine/parser/SQLParser.g4
        Hide
        jihoonson Jihoon Son added a comment -

        +1.
        This patch looks good to me.

        Show
        jihoonson Jihoon Son added a comment - +1. This patch looks good to me.
        Hide
        hyunsik Hyunsik Choi added a comment -

        After this patch, the below expressions work well.

        testSimpleEval("select '1980-04-01 01:50:01'::timestamp;", new String [] {"1980-04-01 01:50:01"});
        testSimpleEval("select '1980-04-01 01:50:01'::timestamp::bigint;", new String [] {"323369401000"});
        testSimpleEval("select ('1980-04-01 01:50:01'::timestamp)::bigint;", new String [] {"323369401000"});
        
        Show
        hyunsik Hyunsik Choi added a comment - After this patch, the below expressions work well. testSimpleEval( "select '1980-04-01 01:50:01'::timestamp;" , new String [] { "1980-04-01 01:50:01" }); testSimpleEval( "select '1980-04-01 01:50:01'::timestamp::bigint;" , new String [] { "323369401000" }); testSimpleEval( "select ('1980-04-01 01:50:01'::timestamp)::bigint;" , new String [] { "323369401000" });

          People

          • Assignee:
            hyunsik Hyunsik Choi
            Reporter:
            hyunsik Hyunsik Choi
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development