[jira] Created: (OFBIZ-3575) Union view entity support

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (OFBIZ-3575) Union view entity support

Nicolas Malin (Jira)
Union view entity support
-------------------------

                 Key: OFBIZ-3575
                 URL: https://issues.apache.org/jira/browse/OFBIZ-3575
             Project: OFBiz
          Issue Type: New Feature
          Components: framework
    Affects Versions: SVN trunk
            Reporter: Bob Morley


As per conversion titled "entity-engine union support" (http://n4.nabble.com/entity-engine-union-support-td1607240.html#a1607240); here is the basic union support that we had added into our Ofbiz project.  I have changed a little of the xml schema here ... the premise is that a "UnionViewEntity" extends the standard "ViewEntity" and contains a list of union members that it will union together.  There should only be changes to the ModelReader to instantiate the new model object and then in SqlJdbcUtil to handle generating the new sql for unions.  I have included a very small unit test that executes a findList against a test union.

Here is sample sql that was generated:

SELECT uva.UNION_ID, uva.TESTING_NAME, uva.TESTING_SIZE, uva.TESTING_DATE FROM  ( SELECT T1.TESTING_ID AS UNION_ID, T1.TESTING_NAME AS TESTING_NAME, T1.TESTING_SIZE AS TESTING_SIZE, T1.TESTING_DATE AS TESTING_DATE FROM TESTING T1 UNION SELECT T2.TESTING_TYPE_ID AS UNION_ID, T2.TESTING_NAME AS TESTING_NAME, T2.TESTING_SIZE AS TESTING_SIZE, T2.TESTING_DATE AS TESTING_DATE FROM TESTING T2 ) uva

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (OFBIZ-3575) Union view entity support

Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-3575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Morley updated OFBIZ-3575:
------------------------------

    Attachment: OFBIZ-3575_UnionViewEntitySupport.patch

> Union view entity support
> -------------------------
>
>                 Key: OFBIZ-3575
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3575
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>         Attachments: OFBIZ-3575_UnionViewEntitySupport.patch
>
>
> As per conversion titled "entity-engine union support" (http://n4.nabble.com/entity-engine-union-support-td1607240.html#a1607240); here is the basic union support that we had added into our Ofbiz project.  I have changed a little of the xml schema here ... the premise is that a "UnionViewEntity" extends the standard "ViewEntity" and contains a list of union members that it will union together.  There should only be changes to the ModelReader to instantiate the new model object and then in SqlJdbcUtil to handle generating the new sql for unions.  I have included a very small unit test that executes a findList against a test union.
> Here is sample sql that was generated:
> SELECT uva.UNION_ID, uva.TESTING_NAME, uva.TESTING_SIZE, uva.TESTING_DATE FROM  ( SELECT T1.TESTING_ID AS UNION_ID, T1.TESTING_NAME AS TESTING_NAME, T1.TESTING_SIZE AS TESTING_SIZE, T1.TESTING_DATE AS TESTING_DATE FROM TESTING T1 UNION SELECT T2.TESTING_TYPE_ID AS UNION_ID, T2.TESTING_NAME AS TESTING_NAME, T2.TESTING_SIZE AS TESTING_SIZE, T2.TESTING_DATE AS TESTING_DATE FROM TESTING T2 ) uva

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Assigned: (OFBIZ-3575) Union view entity support

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

     [ https://issues.apache.org/jira/browse/OFBIZ-3575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Heath reassigned OFBIZ-3575:
---------------------------------

    Assignee: Adam Heath

> Union view entity support
> -------------------------
>
>                 Key: OFBIZ-3575
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3575
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Assignee: Adam Heath
>         Attachments: OFBIZ-3575_UnionViewEntitySupport.patch
>
>
> As per conversion titled "entity-engine union support" (http://n4.nabble.com/entity-engine-union-support-td1607240.html#a1607240); here is the basic union support that we had added into our Ofbiz project.  I have changed a little of the xml schema here ... the premise is that a "UnionViewEntity" extends the standard "ViewEntity" and contains a list of union members that it will union together.  There should only be changes to the ModelReader to instantiate the new model object and then in SqlJdbcUtil to handle generating the new sql for unions.  I have included a very small unit test that executes a findList against a test union.
> Here is sample sql that was generated:
> SELECT uva.UNION_ID, uva.TESTING_NAME, uva.TESTING_SIZE, uva.TESTING_DATE FROM  ( SELECT T1.TESTING_ID AS UNION_ID, T1.TESTING_NAME AS TESTING_NAME, T1.TESTING_SIZE AS TESTING_SIZE, T1.TESTING_DATE AS TESTING_DATE FROM TESTING T1 UNION SELECT T2.TESTING_TYPE_ID AS UNION_ID, T2.TESTING_NAME AS TESTING_NAME, T2.TESTING_SIZE AS TESTING_SIZE, T2.TESTING_DATE AS TESTING_DATE FROM TESTING T2 ) uva

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-3575) Union view entity support

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-3575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876702#action_12876702 ]

Adam Heath commented on OFBIZ-3575:
-----------------------------------

I've started to look at this now.  First comment, is that the patch doesn't have consistent formatting(mixed space/tab lines, for one).  Second, the test case should test unions across different tables, with differently named columns, but with the same type.  Plus, we now support conditions in views, which this patch doesn't support at all.

This kind of large change is not something that should be in a single patch.  It should be broken up into much smaller chunks.  One I see that could be done right off the bat is the refactoring in SqlJdbcUtil to move the view sql generation into a separate method.

I see it only supports UNION and UNION ALL.  Why not INTERSECT and EXCEPT variants as well?

Why don't theta-oracle and theta-mssql support unions?  If it's because of the different way conditions are done, then that's not correct.  Just create nested tables.

I'm willing to take the code inside this patch, and use it as a starting point, for something better, so I'm not asking for your help on any of the restructuring.  But I may still have questions about it from time to time.  I also can't give a concrete timeframe as to when it will be done.  I could make use of this tho in one of our own projects.

Do you have any thoughts about how to do dynamic views with unions?


> Union view entity support
> -------------------------
>
>                 Key: OFBIZ-3575
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3575
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Assignee: Adam Heath
>         Attachments: OFBIZ-3575_UnionViewEntitySupport.patch
>
>
> As per conversion titled "entity-engine union support" (http://n4.nabble.com/entity-engine-union-support-td1607240.html#a1607240); here is the basic union support that we had added into our Ofbiz project.  I have changed a little of the xml schema here ... the premise is that a "UnionViewEntity" extends the standard "ViewEntity" and contains a list of union members that it will union together.  There should only be changes to the ModelReader to instantiate the new model object and then in SqlJdbcUtil to handle generating the new sql for unions.  I have included a very small unit test that executes a findList against a test union.
> Here is sample sql that was generated:
> SELECT uva.UNION_ID, uva.TESTING_NAME, uva.TESTING_SIZE, uva.TESTING_DATE FROM  ( SELECT T1.TESTING_ID AS UNION_ID, T1.TESTING_NAME AS TESTING_NAME, T1.TESTING_SIZE AS TESTING_SIZE, T1.TESTING_DATE AS TESTING_DATE FROM TESTING T1 UNION SELECT T2.TESTING_TYPE_ID AS UNION_ID, T2.TESTING_NAME AS TESTING_NAME, T2.TESTING_SIZE AS TESTING_SIZE, T2.TESTING_DATE AS TESTING_DATE FROM TESTING T2 ) uva

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (OFBIZ-3575) Union view entity support

Nicolas Malin (Jira)
In reply to this post by Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-3575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877441#action_12877441 ]

Bob Morley commented on OFBIZ-3575:
-----------------------------------

Someone had expressed interest in the union support; so I simply wrapped it up to provide it as a starting point for what could be done.  We use this union support internally.  Here are my short answers --

- unfortunately my eclipse settings were not proper when I did this patch (since corrected) please do a fix indentation to the patch before any inclusion
- i wrote a simple small unit test to ensure that the pieces I extracted from our source base executed correctly in ofbiz trunk; unit test should absolutely be more complete
- intersect and except should be supported; we simply have not has a use case that had that requirement
- as for theta-oracle/theta-mssql -- i do not know the answer; again this is a starting point and for our solution we did not require that support -- for inclusion into ofbiz we should make the solution more complete

I agree with your approach - take this as a starting point; if you can use it in one of your projects go for it and we can round out the implementation.

> Union view entity support
> -------------------------
>
>                 Key: OFBIZ-3575
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3575
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Assignee: Adam Heath
>         Attachments: OFBIZ-3575_UnionViewEntitySupport.patch
>
>
> As per conversion titled "entity-engine union support" (http://n4.nabble.com/entity-engine-union-support-td1607240.html#a1607240); here is the basic union support that we had added into our Ofbiz project.  I have changed a little of the xml schema here ... the premise is that a "UnionViewEntity" extends the standard "ViewEntity" and contains a list of union members that it will union together.  There should only be changes to the ModelReader to instantiate the new model object and then in SqlJdbcUtil to handle generating the new sql for unions.  I have included a very small unit test that executes a findList against a test union.
> Here is sample sql that was generated:
> SELECT uva.UNION_ID, uva.TESTING_NAME, uva.TESTING_SIZE, uva.TESTING_DATE FROM  ( SELECT T1.TESTING_ID AS UNION_ID, T1.TESTING_NAME AS TESTING_NAME, T1.TESTING_SIZE AS TESTING_SIZE, T1.TESTING_DATE AS TESTING_DATE FROM TESTING T1 UNION SELECT T2.TESTING_TYPE_ID AS UNION_ID, T2.TESTING_NAME AS TESTING_NAME, T2.TESTING_SIZE AS TESTING_SIZE, T2.TESTING_DATE AS TESTING_DATE FROM TESTING T2 ) uva

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.