1 2 Previous Next 16 Replies Latest reply on Apr 15, 2015 4:17 PM by shawkins Branched from an earlier discussion.

    odata translator type enhancements

    kchen007

      I am using Teiid 8.7's OData translator, it did not support Collections of primary type like double, i.e, double[]. Does the newer version of Teiid support them?

       

      thanks

      Kevin

        • 1. Re: odata translator type enhancements
          shawkins

          I don't see any array type support in the odata translator in latest.

           

          The engine does have general support for array types.

          • 2. Re: odata translator type enhancements
            rareddy

            I do not think I saw support for array data type in OData specification either, can you point to any docs on that if have?

            • 3. Re: odata translator type enhancements
              kchen007

              it is part of OData v3, see http://www.odata.org/documentation/odata-version-3-0/

               

              Another thing is to support complex types, and array of complex types. those are also part of the OData v3 spec.

               

              thanks,

               

              Kevin

              • 4. Re: odata translator type enhancements
                shawkins

                OData4j's support for OData v3 was incomplete, so I'm not sure how well this would work in the current odata translator.  We do on the odata production side support mapping Teiid arrays of primitive types to collections, so something similar may be possible.  At the worst it could be targeted for the OData v4 with Olingo.  Just log an enhancement request.

                • 5. Re: odata translator type enhancements
                  rareddy

                  As Steve mentioned there is not going to be any V3 support, we are skipping all together.

                   

                  In V4, we will support complex types and array types. We are going to be doing lot this work in the 8.11

                  • 6. Re: odata translator type enhancements
                    kchen007

                    Ramesh:

                     

                    We (@Halliburton) has ported the original OData4j to most of OData 3 features, like supporting Arrays, Complex type, Function and Stream. It was a clone on googlecode before(we are not able to merge it back), we just exported them to GITHUB Landmark-LGC/pengchen-hal · GitHub.

                     

                    We are willing to help to merge this to your oreva. Let us know what do you think.

                     

                    thanks

                    Kevin

                    • 7. Re: odata translator type enhancements
                      rareddy

                      Super. I just sent out the message about OReva here teiid: OReva - Fork of OData4J library

                       

                      If you want fork this, and submit the change on this, then we can work with.  Depending upon number of commits made by you guys, may be we can simply cherry-pick them one by one. Then we can see what is that you guys need in the Teiid.

                      • 8. Re: odata translator type enhancements
                        kchen007

                        I will compare it with our clones and do a merge and will let you know.

                         

                        thanks

                        Kevin

                        • 9. Re: odata translator type enhancements
                          rareddy

                          Kevin,

                           

                          If that does not work, I suggest taking a diff file from the GitHub, then doing a manual merge in Eclipse as the paths of the files changed. This may get little tedious process..


                          Ramesh..

                          • 10. Re: odata translator type enhancements
                            kchen007

                            Ramesh:

                             

                            I have clone OReva  and merged our change to it. how can I create a pull request for you to review?

                             

                            thanks

                            Kevin

                            • 11. Re: odata translator type enhancements
                              rareddy

                              See sample workflow here https://developer.jboss.org/wiki/ModeShapeDevelopmentWorkflow

                               

                              Once you push to changes your fork, then you should be able to send a pull request on GitHub. You will see "pull" button. Also open Teiid JIRA for this, so that we can refer to work under.

                              • 12. Re: odata translator type enhancements
                                kchen007

                                I am trying to add support of complex types and arrays in OData translator.

                                 

                                One approach I am using is to make these types as String in OData metadata, and let end user to format them as JSON String representation of the types. Then in OData translator simply pass the JSON string down to underlying OData service. The same treatment for the returns, the end user need parse the String result back to the desired type.

                                 

                                This works well for functions, since function will always format the parameters as JSON string. It also means that as long as client program and underlying OData service support those types, the OData translator does not need to understand these types.

                                 

                                But if an entity has complex type or array types, this does not work well, since it would require a special translator to understand for each entity, which String type column need to be converted.

                                 

                                Is there any better solution than this?

                                 

                                thanks,

                                Kevin

                                • 13. Re: odata translator type enhancements
                                  rareddy

                                  But if an entity has complex type or array types, this does not work well, since it would require a special translator to understand for each entity, which String type column need to be converted.

                                  The way I have designed such that if there is a ComplexType in the entityType, all the properties from the ComplexType get in-lined into the EntityType. For "Array", you can use the array type now. At the time I first developed, there was not good support for ArrayType in Teiid, it is not issue now with current versions.

                                   

                                  I am still working on your contribution to OReva. If you want to also look into Teiid changes for OData implementation that would be great, as I am swamped currently with V4 stuff.

                                  • 14. Re: odata translator type enhancements
                                    shawkins

                                    > Is there any better solution than this?

                                     

                                    As Ramesh is saying array types should have direct handling in the engine.  Returning complex json types as string/clob is possible.  We added some json handling, but not an explicit type - although we may revisit that as others like postgresql with jsonb are adding it.  You wouldn't need a translator per type, you would process the complex column using jsontoxml and xmltable to pull whatever information you wanted out from there.  Alternatively some of that logic could be in the translator, but would require parsing the json there and some path notation for access as the name in source.

                                    1 2 Previous Next