You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by adeneche <gi...@git.apache.org> on 2015/09/12 01:16:14 UTC

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

GitHub user adeneche opened a pull request:

    https://github.com/apache/drill/pull/155

    DRILL-3767: SchemaPath.getCompoundPath(String...strings) reverses it'…

    …s input array
    
    @amansinha100 can you please review ?

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

    $ git pull https://github.com/adeneche/incubator-drill DRILL-3767

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

    https://github.com/apache/drill/pull/155.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 #155
    
----
commit f27feb00b31355d62ced810de97a1af154098a7e
Author: adeneche <ad...@gmail.com>
Date:   2015-09-11T17:31:59Z

    DRILL-3767: SchemaPath.getCompoundPath(String...strings) reverses it's input array

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39343893
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -220,9 +214,6 @@ public boolean contains(Object obj) {
         }
     
         SchemaPath other = (SchemaPath) obj;
    -    if (rootSegment == null) {
    --- End diff --
    
    One can indeed pass a null rootSegment to the constructor. If this is something that shouldn't happen, maybe I can just add an assertion in the constructors, otherwise I will revert back the change in this function


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39526314
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -220,9 +214,6 @@ public boolean contains(Object obj) {
         }
     
         SchemaPath other = (SchemaPath) obj;
    -    if (rootSegment == null) {
    --- End diff --
    
    reverted this change


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by amansinha100 <gi...@git.apache.org>.
Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39343781
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -220,9 +214,6 @@ public boolean contains(Object obj) {
         }
     
         SchemaPath other = (SchemaPath) obj;
    -    if (rootSegment == null) {
    --- End diff --
    
    Are you sure rootSegment is not null ? If so, pls add an assert otherwise the next statement could potentially hit NPE. Also what about other.rootSegment ? Should that be checked ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39343898
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -54,15 +50,16 @@ public static SchemaPath getSimplePath(String name) {
       }
     
       public static SchemaPath getCompoundPath(String... strings) {
    --- End diff --
    
    The change I made removes the side effect. Do you mean I should add a description of the method's purpose ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39342062
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -54,15 +50,16 @@ public static SchemaPath getSimplePath(String name) {
       }
     
       public static SchemaPath getCompoundPath(String... strings) {
    --- End diff --
    
    Given the concern expressed in the commit message, do you think a Javadoc should be provided?
    
    Or were you simply referencing that the logic inside the method?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/drill/pull/155


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by amansinha100 <gi...@git.apache.org>.
Github user amansinha100 commented on the pull request:

    https://github.com/apache/drill/pull/155#issuecomment-140782795
  
    Updated PR looks good to me.  +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by amansinha100 <gi...@git.apache.org>.
Github user amansinha100 commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39343798
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -54,15 +50,16 @@ public static SchemaPath getSimplePath(String name) {
       }
     
       public static SchemaPath getCompoundPath(String... strings) {
    -    List<String> paths = Arrays.asList(strings);
    -    Collections.reverse(paths);
         NameSegment s = null;
    -    for (String p : paths) {
    -      s = new NameSegment(p, s);
    +    final int length = strings.length;
    +    // loop through strings in reverse order
    +    for (int i = 0; i < length; i++) {
    --- End diff --
    
    Could you change this to (i=length-1; i >= 0; i--) such that you don't have to the extra subtraction below.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by jacques-n <gi...@git.apache.org>.
Github user jacques-n commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39344265
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -54,15 +50,16 @@ public static SchemaPath getSimplePath(String name) {
       }
     
       public static SchemaPath getCompoundPath(String... strings) {
    --- End diff --
    
    Got it. Never realized that this pattern would have a side effect. Good catch 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] drill pull request: DRILL-3767: SchemaPath.getCompoundPath(String....

Posted by adeneche <gi...@git.apache.org>.
Github user adeneche commented on a diff in the pull request:

    https://github.com/apache/drill/pull/155#discussion_r39526289
  
    --- Diff: common/src/main/java/org/apache/drill/common/expression/SchemaPath.java ---
    @@ -54,15 +50,16 @@ public static SchemaPath getSimplePath(String name) {
       }
     
       public static SchemaPath getCompoundPath(String... strings) {
    -    List<String> paths = Arrays.asList(strings);
    -    Collections.reverse(paths);
         NameSegment s = null;
    -    for (String p : paths) {
    -      s = new NameSegment(p, s);
    +    final int length = strings.length;
    +    // loop through strings in reverse order
    +    for (int i = 0; i < length; i++) {
    --- End diff --
    
    Fixed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---