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:

      Description

      See the title.

      1. TAJO-207.2.patch
        4 kB
        DaeMyung Kang
      2. TAJO-207.patch
        4 kB
        DaeMyung Kang

        Activity

        Hide
        charsyam DaeMyung Kang added a comment -

        I implemented bit_length.
        and add testcase like char_length or length.
        and it passed. please review this. Thank you.

        Show
        charsyam DaeMyung Kang added a comment - I implemented bit_length. and add testcase like char_length or length. and it passed. please review this. Thank you.
        Hide
        hyunsik Hyunsik Choi added a comment -

        First of all, thank you for your participation.

        In overall, the patch looks good to me. But, we need to use datum.asByteArray() instead of datum.asChars() because datum.asChars().length() just counts a multiple bytes character as 1. In contrast, we need bit length.

        return DatumFactory.createInt4(datum.asChars().length()*8);
        
        Show
        hyunsik Hyunsik Choi added a comment - First of all, thank you for your participation. In overall, the patch looks good to me. But, we need to use datum.asByteArray() instead of datum.asChars() because datum.asChars().length() just counts a multiple bytes character as 1. In contrast, we need bit length. return DatumFactory.createInt4(datum.asChars().length()*8);
        Hide
        hyunsik Hyunsik Choi added a comment -

        For example, bit_length function should work as follows:

        hyunsik=> select bit_length('가');
         bit_length 
        ------------
                 24
        (1 row)
        
        
        Show
        hyunsik Hyunsik Choi added a comment - For example, bit_length function should work as follows: hyunsik=> select bit_length('가'); bit_length ------------ 24 (1 row)
        Hide
        charsyam DaeMyung Kang added a comment -

        Ok i will patch it soon.

        Show
        charsyam DaeMyung Kang added a comment - Ok i will patch it soon.
        Hide
        charsyam DaeMyung Kang added a comment -

        I updated it to asByteArray().length

        and it passed unittest.

        Show
        charsyam DaeMyung Kang added a comment - I updated it to asByteArray().length and it passed unittest.
        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
        jihoonson Jihoon Son added a comment -

        I just committed the patch.
        Thanks for your contribution!

        Show
        jihoonson Jihoon Son added a comment - I just committed the patch. Thanks for your contribution!
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-trunk-postcommit #575 (See https://builds.apache.org/job/Tajo-trunk-postcommit/575/)
        TAJO-207: Implement bit_length(string) function. (DaeMyung Kang via jihoon) (jihoonson: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=a26c588e31c54e791cbb45f7d5bf1336d0c72da6)

        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/BitLength.java
        • tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java
        • tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-trunk-postcommit #575 (See https://builds.apache.org/job/Tajo-trunk-postcommit/575/ ) TAJO-207 : Implement bit_length(string) function. (DaeMyung Kang via jihoon) (jihoonson: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=a26c588e31c54e791cbb45f7d5bf1336d0c72da6 ) tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/function/string/BitLength.java tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/master/TajoMaster.java tajo-core/tajo-core-backend/src/test/java/org/apache/tajo/engine/function/TestStringOperatorsAndFunctions.java
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-trunk-postcommit #577 (See https://builds.apache.org/job/Tajo-trunk-postcommit/577/)
        TAJO-207: Implement bit_length(string) function. (fixed a missing log in CHANGES.txt) (jihoonson: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=02fd6cb9ab7664760d5549c8e59def0759118e6c)

        • CHANGES.txt
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-trunk-postcommit #577 (See https://builds.apache.org/job/Tajo-trunk-postcommit/577/ ) TAJO-207 : Implement bit_length(string) function. (fixed a missing log in CHANGES.txt) (jihoonson: https://git-wip-us.apache.org/repos/asf?p=incubator-tajo.git&a=commit&h=02fd6cb9ab7664760d5549c8e59def0759118e6c ) CHANGES.txt

          People

          • Assignee:
            charsyam DaeMyung Kang
            Reporter:
            hyunsik Hyunsik Choi
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development