Hi Lana,

I think what you are looking for is RelOptUtil#dumpPlan [1]
using SqlExplainFormat.JSON as one of the parameters.
You can check the callers of this method for examples on how to use it.

Best,
Stamatis

[1]
https://github.com/apache/calcite/blob/7f5e9b8b7e6b4afd8e4f21524aa3c4ce8b7ddb61/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java#L2116

On Sun, Jun 6, 2021 at 10:42 PM Lana Ramjit <[email protected]> wrote:

> Hi all,
>
> I was reading this old blog post from OmniSci
> <
> https://www.omnisci.com/blog/fast-and-flexible-query-analysis-at-mapd-with-apache-calcite-2
> >and
> they mention that to use Calcite-generated plans in their C++ library, they
> serialized the relational algebra output by Calcite into JSON. I'd like to
> do something like this for a project but I can't seem to find any good
> documentation of this. I found this page in the docs
> <https://calcite.apache.org/docs/model.html> about the model, but what I
> am
> looking for hopefully is a function that I can pass the root of a Calcite
> plan and get a JSONified serialization. Does this exist?
>
> Thanks,
> Lana
>

Reply via email to