Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.8.0
    • Component/s: Function/UDF
    • Labels:
      None

      Description

      left('abcdef', 1) ===> a
      left('abcdef', 2) ===> ab

      right('abcdef', 1) ===> f
      right('abcdef', 2) ===> ef

      1. TAJO-352_3.patch
        12 kB
        Hyunsik Choi
      2. TAJO-352_2.patch
        10 kB
        Hyunsik Choi
      3. TAJO-352.patch
        10 kB
        DaeMyung Kang

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-trunk-postcommit #581 (See https://builds.apache.org/job/Tajo-trunk-postcommit/581/)
        TAJO-352: Implement right/left(text, size) function. (DaeMyung Kang via hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=43ec04aaa34ffe5c5da2cfd05ff919ffac44044b)

        • tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/Left.java
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.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
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/Right.java
        • CHANGES.txt
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-trunk-postcommit #581 (See https://builds.apache.org/job/Tajo-trunk-postcommit/581/ ) TAJO-352 : Implement right/left(text, size) function. (DaeMyung Kang via hyunsik) (hyunsik: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=43ec04aaa34ffe5c5da2cfd05ff919ffac44044b ) tajo-common/src/main/java/org/apache/tajo/datum/TextDatum.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/Left.java tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.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 tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/Right.java CHANGES.txt
        Hide
        hyunsik Hyunsik Choi added a comment -

        committed it to master. Thank you for your contribution!

        Show
        hyunsik Hyunsik Choi added a comment - committed it to master. Thank you for your contribution!
        Hide
        jhkim Jinho Kim added a comment -

        +1 for the patch.

        Show
        jhkim Jinho Kim added a comment - +1 for the patch.
        Hide
        hyunsik Hyunsik Choi added a comment -

        The commented out lines should be enabled after auto casting is implemented.

        Show
        hyunsik Hyunsik Choi added a comment - The commented out lines should be enabled after auto casting is implemented.
        Hide
        hyunsik Hyunsik Choi added a comment -

        I submitted the wrong file. I updated the third patch.

        Show
        hyunsik Hyunsik Choi added a comment - I submitted the wrong file. I updated the third patch.
        Hide
        jihoonson Jihoon Son added a comment - - edited

        The latest patch doesn't look like to contain the difference between the master branch and this issue.
        Also, there are some commented out codes.

        Show
        jihoonson Jihoon Son added a comment - - edited The latest patch doesn't look like to contain the difference between the master branch and this issue. Also, there are some commented out codes.
        Hide
        hyunsik Hyunsik Choi added a comment -

        If there are no objection, I'll commit it after a while.

        Show
        hyunsik Hyunsik Choi added a comment - If there are no objection, I'll commit it after a while.
        Hide
        hyunsik Hyunsik Choi added a comment -

        I've attached the updated patch. This patch does as follows:

        • Enabled SQLParser to recognize left/right function names.
        • Renamed from_left/from_right to left/right
        • Added null handling code to left and right functions
        • Added more unit tests for null handling
        Show
        hyunsik Hyunsik Choi added a comment - I've attached the updated patch. This patch does as follows: Enabled SQLParser to recognize left/right function names. Renamed from_left/from_right to left/right Added null handling code to left and right functions Added more unit tests for null handling
        Hide
        hyunsik Hyunsik Choi added a comment -

        I'll submit a new patch that resolved reserved words.

        Show
        hyunsik Hyunsik Choi added a comment - I'll submit a new patch that resolved reserved words.
        Hide
        hyunsik Hyunsik Choi added a comment -

        If the second parameter (i.e., size) is null, the result should be null. Others look great for me.

        Show
        hyunsik Hyunsik Choi added a comment - If the second parameter (i.e., size) is null, the result should be null. Others look great for me.
        Hide
        charsyam DaeMyung Kang added a comment -

        Don't accept this patch. Here is two problems.

        1. it is the same problem with substr, Parsing error
        2. when give function name to (left, right), it failed with parse.
        (I might think it is because of reserved keyword(left join or right join).

        so. I changed function name left -> from_left, right -> from_right.
        Thanks.

        Show
        charsyam DaeMyung Kang added a comment - Don't accept this patch. Here is two problems. 1. it is the same problem with substr, Parsing error 2. when give function name to (left, right), it failed with parse. (I might think it is because of reserved keyword(left join or right join). so. I changed function name left -> from_left, right -> from_right. Thanks.

          People

          • Assignee:
            charsyam DaeMyung Kang
            Reporter:
            charsyam DaeMyung Kang
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development