This is a very interesting topic, thanks for starting this discussion Danny!
Metadata seems a very reasonable way to handle hints and I guess the
proposal by Julian is the way to go.
For the sake of discussion (brainstorming), I was thinking that rules from
hints do not differ too much.
The
Thx Julian
Mostly got your idea, but one thing needs to confirm:
Now the MetadataHandler is kind of query lazy the cache is code-gen ed in the
handler class, the metadata also propagate from inputs, when I got an RelNode’s
hint, how can I cache it in the metadata handler for querying ?
Best,
The RelMetadata system is designed for these kinds of annotations - if there is
a “global hints cache” there’s no benefit to doing it outside the RelMetadata
system.
That said, I don’t know (and I don’t think anyone knows) how we want hints to
be propagated as we generate RelNodes from
Thx, Julian
Let me repeat my thoughts about the details again, in order to implement the
hints, maybe these things are needed:
The main diff is that we will maintain a global hints cache
1. Supports hints grammar for parser.jj
2. During/after sql-to-rel, we may pass a hints cache to the
I think it’s OK to attach hints to the (few) RelNodes that come out of the
SqlToRelConverter.
But it would be a mistake to try to propagate those hints to all of the
RelNodes that are created during query planning. Even if we changed all of the
copy methods (a huge task) there are many other
Thanks Danny.
Those are good points. I think it depends on what we consider hint as.
IMHO, if we consider hint as a kind of metadata,
it is not a good idea to store the hints in the RelNode instance.
Best,
Chunwei
On Wed, Apr 24, 2019 at 11:09 AM Yuzhao Chen wrote:
>
> Thx, Julian
>
> I
Thx, Julian
I think the hint path is a good way for searching RelNode’s parents, broadly,
there may be these modules/things need to be modified:
1. Supports hints grammar for parser.jj
2. Cache the hints in the RelNode instance, and add method like
RelNode#getHints() to fetch all the hints
I see that if you have a hint on, say, the root node then it would be nice for
its child or grand-child to be able to see that hint.
How about giving each hint an inherit path? Thus given
Filter Hint1
+- Join
+- Scan
+- Project Hint2
+- Scan
Filter would have hints
Thx, Andrew
I don’t want to have a custom RelNode class, I hope all the work about hints
would be contributed to the community. I want to find an acceptable way to keep
and propagate the hints if we use the MetadataHandler to cache and query the
hints.
I don’t think the hints should be mixed
Hi Danny,
I would also agree with Julian on his position. I've tried to get around
this limitation in several different ways, but none of it ended well :)
For your idea with hints, if you have custom RelNode classes, you can add
hint as an additional field of the class and you can write a simple
Julian,
I want to add hint support for Calcite, the initial idea was to tag a
RelNode(transformed from a SqlNode with hint) with a hit attribute(or trait),
then I hope that the children (inputs) of it can see this hint, so to make some
decisions if it should consume or propagate the hint.
The
TL;DR: RelNodes don’t really have parents. Be careful if you are relying on the
parent concept too much. Rely on rules instead.
In the Volcano model, a RelNode doesn’t really have a parent. It might be used
in several places. (RelSet has a field ‘List parents’ that is kept up
to date as
Thx, Stamatis, that somehow make sense, if i pass around the parent node every
time I visit a RelNode and keep the parents in the cache, but it is still not
that intuitive. Actually I what a to add a new RelTrait which bind to a
specific scope, for example:
join-rel(trait1)
/
Hi Danny,
Apart from RelShuttle there is also RelVisitor which has a visit method
that provides the parent [1]. Not sure, if it suits your needs.
Best,
Stamatis
[1]
Now for RelNode, we have method getInput()[1] to fetch the input RelNodes, but
how we fetch the parent ?
For example, we have plan:
join-rel
/ \
scan1 scan2
We can get scan1 and scan2 in join-rel directly with method getInput, but how
can we get the join rel in
15 matches
Mail list logo