You're correct that rules do not manipulate data and are only used during the planning/optimization stage. However, you can use a rule to transform the join RelNode into a custom class you create. When the query is executed, then this class will be used to perform the join.
-- Michael Mior [email protected] Le jeu. 16 mai 2019 à 20:38, Valeriy Trofimov <[email protected]> a écrit : > > Thank you for the replies. I though that rules are used during query > planning/optimization stage, not to manipulate real data returned after > executing the query. What I want to do is to use a custom algorithm to join > data returned from the left and right side of the query after the query is > executed. So, in my case it would probably be writing a rule that says "if > you see keyword JOIN, then change the query to not do the join, but to get > me data from left and right sides and then do the join using my own > algorithm". Let me know if it's possible. > > Thanks, > Val > > On Thu, May 16, 2019 at 3:24 PM Parimarjan Negi <[email protected]> > wrote: > > > Hi, > > > > I have been working on a research project that tries out various strategies > > for join algorithms. Here are some implementations of various baselines > > like exhaustive search, left deep search etc. which may be helpful for you. > > Here is the implementation for the exhaustive search rule which uses > > Calcite' implementations (like BushyJoinOrderRule) as a base: > > > > > > https://github.com/parimarjan/query-optimizer/blob/master/src/main/java/ExhaustiveDPJoinOrderRule.java#L40 > > > > Best, > > Pari > > > > On Thu, May 16, 2019 at 4:37 PM Ivan Grgurina <[email protected]> > > wrote: > > > > > What do you mean by "custom join algorithm"? You seem to be mixing "SQL > > > join queries" with "Avatica". Calcite uses planner rules on relational > > > algebra level, you can write a rule that transforms Join RelNode with > > your > > > algorithm. Is that what you want to do? > > > > > > ig > > > > > > > > > > > > > > > ________________________________ > > > From: Valeriy Trofimov <[email protected]> > > > Sent: Thursday, May 16, 2019 9:47 PM > > > To: [email protected] > > > Subject: Customizing Join Algorithm > > > > > > Hi All, > > > > > > I want to use a custom join algorithm in Calcite SQL join queries. My > > > questions are: > > > > > > 1. Is it possible to do? > > > 2. If yes, what part of Calcite should I update? > > > > > > I've tried to figure it out myself by debugging Calcite join unit tests, > > > but it looks like Calcite uses Avatica for this. > > > > > > Thanks, > > > Val > > > > >
