You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by kliewkliew <gi...@git.apache.org> on 2016/08/26 18:44:11 UTC

[GitHub] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

GitHub user kliewkliew opened a pull request:

    https://github.com/apache/phoenix/pull/200

    PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

    

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

    $ git pull https://github.com/kliewkliew/phoenix PHOENIX-2641

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

    https://github.com/apache/phoenix/pull/200.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 #200
    
----
commit 702233fc535dba8302c11beee49164f0f558f79d
Author: kliewkliew <kl...@users.noreply.github.com>
Date:   2016-08-24T13:40:35Z

    PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

----


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

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

    https://github.com/apache/phoenix/pull/200#discussion_r77378073
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java ---
    @@ -517,8 +518,13 @@ public Expression visitLeave(LikeParseNode node, List<Expression> children) thro
                           return new ComparisonExpression(Arrays.asList(lhs,rhs), op);
                       }
                     }
    -            } else if (index == 0 && pattern.length() == 1) {
    -                return IsNullExpression.create(lhs, true, context.getTempPtr());
    +            } else {
    +                byte[] nullExpressionString = new byte[pattern.length()];
    +                byte[] wildcard = {StringUtil.MULTI_CHAR_LIKE};
    +                StringUtil.fill(nullExpressionString, 0, pattern.length(), wildcard, 0, 1, false);
    +                if (pattern.equals(new String (nullExpressionString))) {
    --- End diff --
    
    +1 that makes sense. Thanks for the contribution, I will get this committed.


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

Posted by kliewkliew <gi...@git.apache.org>.
GitHub user kliewkliew reopened a pull request:

    https://github.com/apache/phoenix/pull/200

    PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

    

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

    $ git pull https://github.com/kliewkliew/phoenix PHOENIX-2641

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

    https://github.com/apache/phoenix/pull/200.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 #200
    
----
commit 702233fc535dba8302c11beee49164f0f558f79d
Author: kliewkliew <kl...@users.noreply.github.com>
Date:   2016-08-24T13:40:35Z

    PHOENIX-2641 Implicit wildcard in LIKE predicate search pattern

commit 53242fdb31c23879a9ae13ef6f429d585c35b307
Author: kliewkliew <kl...@users.noreply.github.com>
Date:   2016-08-24T15:41:20Z

    Convert char to String for comparison

commit 9e8caef11b1ca1971e320beb19a6212a1b653a0c
Author: kliewkliew <kl...@users.noreply.github.com>
Date:   2016-08-24T16:02:46Z

    Handle multiple `%`

----


---
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] phoenix issue #200: PHOENIX-2641 Implicit wildcard in LIKE predicate search ...

Posted by twdsilva <gi...@git.apache.org>.
Github user twdsilva commented on the issue:

    https://github.com/apache/phoenix/pull/200
  
    @kliewkliew  
    Can you please rebase? I cannot apply the patch to master.


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

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

    https://github.com/apache/phoenix/pull/200#discussion_r77374014
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java ---
    @@ -517,8 +518,13 @@ public Expression visitLeave(LikeParseNode node, List<Expression> children) thro
                           return new ComparisonExpression(Arrays.asList(lhs,rhs), op);
                       }
                     }
    -            } else if (index == 0 && pattern.length() == 1) {
    -                return IsNullExpression.create(lhs, true, context.getTempPtr());
    +            } else {
    +                byte[] nullExpressionString = new byte[pattern.length()];
    +                byte[] wildcard = {StringUtil.MULTI_CHAR_LIKE};
    +                StringUtil.fill(nullExpressionString, 0, pattern.length(), wildcard, 0, 1, false);
    +                if (pattern.equals(new String (nullExpressionString))) {
    --- End diff --
    
    I guess that it is unlikely enough that a user would submit a query with `~ LIKE '%%'` instead of `~ LIKE '%'` that it isn't worth the overhead of covering that case. 
    
    I did that in revision 53242fdb31c23879a9ae13ef6f429d585c35b307 with `pattern.equals(Character.toString(StringUtil.MULTI_CHAR_LIKE))` and tested it. That revision works if you would like to commit that.


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

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

    https://github.com/apache/phoenix/pull/200#discussion_r77291213
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/compile/ExpressionCompiler.java ---
    @@ -517,8 +518,13 @@ public Expression visitLeave(LikeParseNode node, List<Expression> children) thro
                           return new ComparisonExpression(Arrays.asList(lhs,rhs), op);
                       }
                     }
    -            } else if (index == 0 && pattern.length() == 1) {
    -                return IsNullExpression.create(lhs, true, context.getTempPtr());
    +            } else {
    +                byte[] nullExpressionString = new byte[pattern.length()];
    +                byte[] wildcard = {StringUtil.MULTI_CHAR_LIKE};
    +                StringUtil.fill(nullExpressionString, 0, pattern.length(), wildcard, 0, 1, false);
    +                if (pattern.equals(new String (nullExpressionString))) {
    --- End diff --
    
    Can we just check if pattern equals StringUtil.MULTI_CHAR_LIKE here ?


---
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] phoenix issue #200: PHOENIX-2641 Implicit wildcard in LIKE predicate search ...

Posted by kliewkliew <gi...@git.apache.org>.
Github user kliewkliew commented on the issue:

    https://github.com/apache/phoenix/pull/200
  
    @twdsilva Changes were made and rebased,


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

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

    https://github.com/apache/phoenix/pull/200


---
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] phoenix issue #200: PHOENIX-2641 Implicit wildcard in LIKE predicate search ...

Posted by kliewkliew <gi...@git.apache.org>.
Github user kliewkliew commented on the issue:

    https://github.com/apache/phoenix/pull/200
  
    Needs more testing


---
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] phoenix issue #200: PHOENIX-2641 Implicit wildcard in LIKE predicate search ...

Posted by twdsilva <gi...@git.apache.org>.
Github user twdsilva commented on the issue:

    https://github.com/apache/phoenix/pull/200
  
    @kliewkliew 
    
    Thanks for the contribution. I did not include your last commit 523f0 , its fine to handle multiple wild card characters. I have committed this to the 4.x and 4.8 branches. 


---
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] phoenix issue #200: PHOENIX-2641 Implicit wildcard in LIKE predicate search ...

Posted by kliewkliew <gi...@git.apache.org>.
Github user kliewkliew commented on the issue:

    https://github.com/apache/phoenix/pull/200
  
    @twdsilva Thanks for committing


---
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] phoenix pull request #200: PHOENIX-2641 Implicit wildcard in LIKE predicate ...

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

    https://github.com/apache/phoenix/pull/200


---
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.
---