You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by kaspersorensen <gi...@git.apache.org> on 2015/10/04 00:11:02 UTC

[GitHub] metamodel pull request: Metamodel 192/datatype conversion function...

GitHub user kaspersorensen opened a pull request:

    https://github.com/apache/metamodel/pull/55

    Metamodel 192/datatype conversion functions

    __Do not merge yet__
    
    This is my first attempt at implementing METAMODEL-192, which thereby is also the first time we make pluggable ScalarFunctions available. I wanted to share it early on since I think some people will find the approach interesting ( @ardlema ?) as inspiration for similar scalar functions (SUBSTRING etc.) ... Please let me know if you think the approach is good or not.

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

    $ git pull https://github.com/kaspersorensen/metamodel METAMODEL-192/datatype-conversion-functions

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

    https://github.com/apache/metamodel/pull/55.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 #55
    
----
commit 94d08404647e53352a07ac37692000aa319a06b4
Author: Kasper Sørensen <i....@gmail.com>
Date:   2015-10-03T20:15:50Z

    METAMODEL-192: Updated ScalarFunction interface and added ToXx functions

commit 018a666df5e9dc21e7db9c3ca7f0f041c9986570
Author: Kasper Sørensen <i....@gmail.com>
Date:   2015-10-03T20:27:17Z

    Cleaned up the function inheritance patterns, using @Override etc.

commit 3cb4cd8d7c475533f92292baee55e463adca2a57
Author: Kasper Sørensen <i....@gmail.com>
Date:   2015-10-03T22:09:11Z

    METAMODEL-192: First impl for client-side eval. JDBC not covered yet.

----


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146283048
  
    Reported your idea in METAMODEL-193 - https://issues.apache.org/jira/browse/METAMODEL-193


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146112604
  
    I'd go for the first option. As a first approach I think that is fine to just throwing an exception. I always like to start with the simplest solution and then try to improve it afterwards (if it is needed)
    
    So..my +1 to the first one


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

RE: [GitHub] metamodel pull request: Metamodel 192/datatype conversion function...

Posted by Mario Rasathurai <mr...@infogix.com>.
How can I unsubscribe from this email distribution?

-----Original Message-----
From: kaspersorensen [mailto:git@git.apache.org]
Sent: Wednesday, October 07, 2015 9:03 AM
To: dev@metamodel.apache.org
Subject: [GitHub] metamodel pull request: Metamodel 192/datatype conversion function...

Github user kaspersorensen commented on the pull request:

    https://github.com/apache/metamodel/pull/55#issuecomment-146204525

    Let's create a separate issue in JIRA for that. I could imagine a little parser trick to do it, but I guess for consistency that format is an anomaly compared to other function literals that normally say ```function(argument)``` :-)


---
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.
---
NOTICE: This e-mail message and any included attachments are from Infogix, Inc. ("Infogix") and are intended solely for use by the individual(s) to whom the message was addressed. The information contained herein may include privileged or otherwise confidential information. Unauthorized review, forwarding, printing, copying, distributing, or using the information contained in this message is strictly prohibited. If you have received this message in error, or have reason to believe that you are not authorized to receive it, please promptly notify the sender by e-mail, delete the message from your computer, and do not copy or disclose the information to anyone else. If you properly received this e-mail as an addressee, please maintain its contents in confidence to protect confidentiality. Thank you.

[GitHub] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146204525
  
    Let's create a separate issue in JIRA for that. I could imagine a little parser trick to do it, but I guess for consistency that format is an anomaly compared to other function literals that normally say ```function(argument)``` :-)


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146143826
  
    OK as far as I am concerned, this story is now complete (assuming Travis builds alright). Could someone give it a code review and then let's merge it if everybody still likes it? :-)
    
    Side-note: I would think we then consider MetaModel 4.4.0 kinda _done_? Anyone else has pending stuff to add before we do a release?


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146162602
  
    Looks good to me, but it would be nice to maybe also allow something like SQL's ```CAST <expression> as <type>``` later.
    
    +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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146125113
  
    I agree. Would rather finish this quickly, maybe create a JIRA issue for improving it, but have something that works for a limited scope. And I do think that having scalar functions "just" for SELECT clause is already a big deal.


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-146017943
  
    As you can see on my todo-list above, actually now it works in JDBC also and I have improved testing and all.
    
    The only thing that doesn't work (that I know of) is having scalar functions in e.g. the WHERE clause of a JDBC query. I couldn't yet figure out a good way to decompose that problem. I can think of three solution scenarios:
    
     1. Simply not support it, but throw a MetaModel exception when it is attempted. For me this is actually OK to begin with.
     1. Have a failover strategy when this happens which uses a QueryPostprocessDataContext and thus eventually one or more full-table-scans to execute the query.
     1. Do something really clever to decompose the query and figure out how much of it can be natively executed, do that, and postprocess the rest. This seems very complex so I wouldn't recommend it for now.
    
    What do you guys think? I prefer 1 or 2.


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-145617761
  
    Great, then I'll continue down this line ...
    
    A few TODOs that I can think of:
    
     - [ ] More rigoruous testing - does it also work in filter items, does it work in subqueries and all that.
     - [ ] Add some hooks to the query parser to understand it.
     - [ ] Maybe also add aliases in the query parser? I notice that for scalar functions there are often different names for the same thing in many SQL dialects.
     - [ ] Add JDBC support by querying the IQueryRewriter interface whether or not particular scalar functions are supported.


---
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] metamodel pull request: Metamodel 192/datatype conversion function...

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

    https://github.com/apache/metamodel/pull/55#issuecomment-145520371
  
    Really nice approach!
    
    I woudl add some unit tests for TO_STRING, TO_DATE and TO_BOOLEAN functions.


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