git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass a custom object as an operand to the schema factory ?


Even though you can pass custom objects, you should not. We might want to create a connection via a JDBC connect string, which only allows strings. Or via an RPC.

I’d limit it to JSON-serializable values - ordered map, ordered list, string, boolean, numeric, null.

If you want to pass a complex object then pass a handle to that object that (some kind of URI string) can be used by some kind of directory service to get the object on the other side.

Julian


> On May 13, 2018, at 4:56 PM, Muhammad Gelbana <m.gelbana@xxxxxxxxx> wrote:
> 
> I see that the SchemaFactory's create method
> <https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java#L68>
> accepts a Map of Object values which suggests that I can put any Java
> object in this map.
> 
> I used to pass strings just fine but now I need to pass expensive objects
> that I can't afford creating once more in the SchemaFactory.
> 
> I thought about having an external structure that holds these expensive
> objects and I would look them up from the SchemaFactory but I'm hoping
> there would be another way to evade that.
> 
> Has anyone faced such a case before and would kindly share his solution ?
> 
> Thanks,
> Gelbana