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

Refactoring condition code for CHAR into CatalogUtil

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.11.0
    • Component/s: None
    • Labels:
      None

      Description

      Currently Schema's addColumn is this

      ```java
      public synchronized Schema addColumn(String name, Type type) {
      if (type == Type.CHAR)

      { return addColumn(name, CatalogUtil.newDataTypeWithLen(type, 1)); }

      return addColumn(name, CatalogUtil.newSimpleDataType(type));
      }
      ```

      I think it is better condition code into CatalogUtil.newSimpleDataType.
      because some testcode make columns just using CatalogUtil.

        Activity

        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #681 (See https://builds.apache.org/job/Tajo-master-build/681/)
        TAJO-1548: Refactoring condition code for CHAR into CatalogUtil. (blrunner: rev 044fd49a157424aef658d20025a9be094ff25334)

        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
        • CHANGES
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #681 (See https://builds.apache.org/job/Tajo-master-build/681/ ) TAJO-1548 : Refactoring condition code for CHAR into CatalogUtil. (blrunner: rev 044fd49a157424aef658d20025a9be094ff25334) tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java CHANGES
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #319 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/319/)
        TAJO-1548: Refactoring condition code for CHAR into CatalogUtil. (blrunner: rev 044fd49a157424aef658d20025a9be094ff25334)

        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
        • CHANGES
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #319 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/319/ ) TAJO-1548 : Refactoring condition code for CHAR into CatalogUtil. (blrunner: rev 044fd49a157424aef658d20025a9be094ff25334) tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java CHANGES
        Hide
        blrunner Jaehwa Jung added a comment -

        I've just committed this to the master branch.

        Show
        blrunner Jaehwa Jung added a comment - I've just committed this to the master branch.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/531

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/531
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user blrunner commented on the pull request:

        https://github.com/apache/tajo/pull/531#issuecomment-94332999

        Hi @jihoonson

        Thanks for your review.

        Hi @charsyam

        +1
        Thanks for your kind comment.
        I also agree with your suggestion.

        I'll commit this soon.

        Show
        githubbot ASF GitHub Bot added a comment - Github user blrunner commented on the pull request: https://github.com/apache/tajo/pull/531#issuecomment-94332999 Hi @jihoonson Thanks for your review. Hi @charsyam +1 Thanks for your kind comment. I also agree with your suggestion. I'll commit this soon.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/531#issuecomment-94269856

        Hi @charsyam and @blrunner, thanks for your work.
        As @charsyam said, ```CHAR``` type can have a variable length. The code in ```Schema::add()``` seems to give a default length for this type. I agree on that this patch will reduce mistakes because many other codes use ```CatalogUtil.newSimpleDataType()``` directly.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/531#issuecomment-94269856 Hi @charsyam and @blrunner, thanks for your work. As @charsyam said, ```CHAR``` type can have a variable length. The code in ```Schema::add()``` seems to give a default length for this type. I agree on that this patch will reduce mistakes because many other codes use ```CatalogUtil.newSimpleDataType()``` directly.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user charsyam commented on the pull request:

        https://github.com/apache/tajo/pull/531#issuecomment-94029362

        Hi, @blrunner
        CHAR type can have length.
        But if we make CHAR Column using this command

        in tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestReadWrite.java
        ```java
        columns.add(new Column("mychar", Type.CHAR));
        ```

        but it's length is 0, because it is just using CatalogUtil.newSimpleDataType

        and Scheme class already use condition code in addColumn method.
        But I think it can cause some mistakes easily.

        So I think it is better to move this condition code into CatalogUtil.newSimpleDataType
        What do you think?

        Show
        githubbot ASF GitHub Bot added a comment - Github user charsyam commented on the pull request: https://github.com/apache/tajo/pull/531#issuecomment-94029362 Hi, @blrunner CHAR type can have length. But if we make CHAR Column using this command in tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestReadWrite.java ```java columns.add(new Column("mychar", Type.CHAR)); ``` but it's length is 0, because it is just using CatalogUtil.newSimpleDataType and Scheme class already use condition code in addColumn method. But I think it can cause some mistakes easily. So I think it is better to move this condition code into CatalogUtil.newSimpleDataType What do you think?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user blrunner commented on the pull request:

        https://github.com/apache/tajo/pull/531#issuecomment-93899514

        Hi @charsyam

        Could you explain this PR in detail? I don't quite understand this.

        Show
        githubbot ASF GitHub Bot added a comment - Github user blrunner commented on the pull request: https://github.com/apache/tajo/pull/531#issuecomment-93899514 Hi @charsyam Could you explain this PR in detail? I don't quite understand this.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user charsyam opened a pull request:

        https://github.com/apache/tajo/pull/531

        TAJO-1548 Refactoring condition code for CHAR into CatalogUtil

        Currently Schema's addColumn is this
        ```java
        public synchronized Schema addColumn(String name, Type type) {
        if (type == Type.CHAR)

        { return addColumn(name, CatalogUtil.newDataTypeWithLen(type, 1)); }

        return addColumn(name, CatalogUtil.newSimpleDataType(type));
        }
        ```
        I think it is better condition code into CatalogUtil.newSimpleDataType.
        because some testcode make columns just using CatalogUtil.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/charsyam/tajo feature/TAJO-1548

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tajo/pull/531.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #531


        commit 61ab939db276000f09d613635ab06f54a3be1963
        Author: clark.kang <clark.kang@kakao.com>
        Date: 2015-04-11T16:00:12Z

        TAJO-1548


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user charsyam opened a pull request: https://github.com/apache/tajo/pull/531 TAJO-1548 Refactoring condition code for CHAR into CatalogUtil Currently Schema's addColumn is this ```java public synchronized Schema addColumn(String name, Type type) { if (type == Type.CHAR) { return addColumn(name, CatalogUtil.newDataTypeWithLen(type, 1)); } return addColumn(name, CatalogUtil.newSimpleDataType(type)); } ``` I think it is better condition code into CatalogUtil.newSimpleDataType. because some testcode make columns just using CatalogUtil. You can merge this pull request into a Git repository by running: $ git pull https://github.com/charsyam/tajo feature/ TAJO-1548 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/531.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #531 commit 61ab939db276000f09d613635ab06f54a3be1963 Author: clark.kang <clark.kang@kakao.com> Date: 2015-04-11T16:00:12Z TAJO-1548

          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