Hi David,

More responses inline...

On 3/12/13 10:28 AM, drv wrote:
I just came across another problem -

The old VTIs passed predicates in a Qualifier[][] object which holds a
representation of the predicates re-ordered in conjunctive normal form. I
have many methods that process this Qualifier[][] structure.
When we introduced RestrictedVTI, we did not want to invent yet another way to represent a restriction. So we considered moving Qualifier into the public api. Unfortunately, Qualifier references DataValueDescriptor, and that would have meant pulling a big chunk of Derby's type system into the public api.
Now however, the initScan() method on the RestrictedVTI interface passes
predicates in a recursive tree of Restriction objects. The predicates in
this structure are not re-ordered. The tree structure just matches the
original bracketing of ANDed and ORed expressions in the query.

My question is - are there any public utility methods in Derby for
converting the top level Restriction object into a Qualifier[][]? I haven't
found any yet. Or is there a simple way of just doing it myself?
I'm not aware of any public utility methods for doing this. The focus of RestrictedVTI was to make it possible to deploy table functions against generic external data sources, not against code which understands the Derby type system and storage apis.

Writing such a utility method doesn't seem to be hard, just tedious. It should be easy to percolate the ANDs up the Restriction structure in order to convert to conjunctive normal form. Each Restriction.ColumnQualifier should then correspond to a Qualifier. If you write such a utility method, please consider donating it to the community. The Derby code for converting a predicate to conjunctive normal form can be found in org.apache.derby.impl.sql.compile.SelectNode.normExpressions().

Thanks,
-Rick
Thanks again -
David



--
View this message in context: 
http://apache-database.10148.n7.nabble.com/Limitations-of-Table-Functions-vs-old-VTIs-tp127988p127995.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.


Reply via email to