Thanks for the pointer Julian. Unfortunately I haven't gotten this working yet since I've been focusing on other things the past couple weeks. I seemed to have tossed the WIP code I had for this. The cost entirely depends on how you're making use of Calcite of course since the cost is only relevant for a particular instance of a planner.
Assuming you want to use some sane defaults, you can create a CalciteConnection and call prepareStatement which will use CalcitePrepare to create a VolcanoPlanner instance. Within CalcitePreparingStmt.prepareSql, you'll see the optimization happening. >From there you'll have to get a reference to the root RelNode of the optimized plan and then you can get the cost from the planner. There's a fair bit of glue you need to hold it all together, but I think that's the basic idea. It would be great if you could share your progress on this! Cheers, -- Michael Mior [email protected] 2016-03-15 15:21 GMT-04:00 Julian Hyde <[email protected]>: > See > https://mail-archives.apache.org/mod_mbox/calcite-dev/201603.mbox/%3CCA%2BEpF8spJ2%2BgeZpwWWETw5T%3DK7hLxXS8wW39u9gDoStrJ8h7MQ%40mail.gmail.com%3E > > > On Mar 15, 2016, at 5:52 AM, Srinivasan Hariharan02 < > [email protected]> wrote: > > > > Hi, > > > > I am trying to develop a standalone code to calculate the cost of the > query using calcite Jdbc adapter. Do anyone guide that is it possible to > retrieve the cost of the query if yes can you point to some examples. > > > > Regards, > > Srinivasan Hariharan > > +91-9940395830 > > > >
