You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by AakashPradeep <gi...@git.apache.org> on 2015/04/30 07:19:23 UTC

[GitHub] phoenix pull request: PHOENIX-1938 Like operator should throw prop...

GitHub user AakashPradeep opened a pull request:

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

    PHOENIX-1938 Like operator should throw proper exception when it is used with data type other then Varcahr and Char

    LIKE operator should be supported only for Varchar and Char and it should throw SQLException with SQLExceptionCode.TYPE_NOT_SUPPORTED_FOR_OPERATOR for any other data type. 
    
    
    Postgres specification : http://www.postgresql.org/docs/8.3/static/functions-matching.html
    Oracle specification: http://docs.oracle.com/cd/B12037_01/server.101/b10759/conditions016.htm
    
    @JamesRTaylor  @twdsilva  Can you please review this.


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

    $ git pull https://github.com/AakashPradeep/phoenix bugfix

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

    https://github.com/apache/phoenix/pull/81.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 #81
    
----
commit fd615a7c267e58b2b4a4a10c595c1aeababbdb72
Author: Aakash <em...@gmail.com>
Date:   2015-04-30T04:41:00Z

    PHOENIX-1938 Like operator should throw proper exception when it is used with data type other then Varcahr and Char

commit 5b9d5d5d5bd7754da3e8023b5a005be2590f6abe
Author: Aakash <em...@gmail.com>
Date:   2015-04-30T04:47:42Z

    PHOENIX-1938 Like operator should throw proper exception when it is used with data type other then Varcahr and Char

commit ad04526922193c99314b91c9fe21abe2d8759035
Author: Aakash <em...@gmail.com>
Date:   2015-04-30T05:13:22Z

    PHOENIX-1938 Like operator should throw proper exception when it is used with data type other then Varcahr and Char- IT test

----


---
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: PHOENIX-1938 Like operator should throw prop...

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

    https://github.com/apache/phoenix/pull/81#issuecomment-104074791
  
    Agreed, but then for all data type like JSON which is coercible to Varchar or Char but does not want to support "LIKE" will have to add an if statement.
    
    Do you think thats ok ?


---
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: PHOENIX-1938 Like operator should throw prop...

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

    https://github.com/apache/phoenix/pull/81#issuecomment-104078110
  
    I'd make JSON castable to VARCHAR instead of coercible. That way you can do an explicit CAST, but it would not be auto-coerced.


---
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: PHOENIX-1938 Like operator should throw prop...

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

    https://github.com/apache/phoenix/pull/81#issuecomment-104059599
  
    Actually, change it to rhs.getDataType().isCoercibleTo(PVarChar.INSTANCE). That's more or less as you've described, but done in a way that doesn't hard code type checks. Our PDataType does not necessarily map 1:1 with SQL types, so down the road we might add a PUTF16EncodedType which would still map to a VARCHAR is SQL. This type of check makes a change like this more manageable.


---
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: PHOENIX-1938 Like operator should throw prop...

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

    https://github.com/apache/phoenix/pull/81#issuecomment-101011634
  
    @JamesRTaylor and @twdsilva  can you please review it. It is required for Json. 


---
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: PHOENIX-1938 Like operator should throw prop...

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

    https://github.com/apache/phoenix/pull/81#issuecomment-104047363
  
    As per the SQL specification, LIKE only works with String data type (http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt search for "Like predicate") . 
    If it has been set to PVarchar.isCoercible() that means anything which can be coerced to Varchar but is not varchar for example VarBinary and JSON, can also be used with "Like". 
    
    IMHO Like should only work with Varhcar and char datatype and throw illegal data type error with other datatype arguments.


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