Thanks tushar. I got it working in similar ways:

1. For DAG as JSON String:

Map<String, Object> stringObjectMap =
LogicalPlanSerializer.convertToMap(dag, true);
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.INDENT_OUTPUT);
String s = mapper.writeValueAsString(stringObjectMap);
System.out.println(s);

2. For DAG as properties file:
StringWriter stringWriter = new StringWriter();
LogicalPlanSerializer.convertToProperties(dag).save(stringWriter);
System.out.println(stringWriter.toString());


Either works for me. Thanks for all the help.

-Chinmay.




On Thu, Sep 22, 2016 at 12:22 PM, Tushar Gosavi <tus...@datatorrent.com>
wrote:

> Hi Chinmay,
>
> take a look at following gist for example.
> https://gist.github.com/anonymous/8df8e05ffc16e620bbc030e1034da3c4
>
> - Tushar.
>
>
> On Thu, Sep 22, 2016 at 12:05 PM, Chinmay Kolhatkar
> <chin...@datatorrent.com> wrote:
> > Hi Tushar,
> >
> > Thanks for the information. Can you please provide me pointers on how to
> > use it?
> >
> > I can always examine the LogicalPlan structure but for a test case, I
> think
> > its an overkill, instead if I have a utility which can print LogicalPlan
> > (similar to LogicalPlanSerializer), then its just the matter for string
> > comparison which one has to do in test for verification.
> >
> > -Chinmay.
> >
> >
> >
> > On Thu, Sep 22, 2016 at 11:59 AM, Tushar Gosavi <tus...@datatorrent.com>
> > wrote:
> >
> >> There is a LogicalPlanSerializer in apex engine, which will generate
> >> json equivalent of DAG, which can be printed easily.
> >> But for verification check if right components are added in DAG by
> >> examining dag structure than printing it.
> >>
> >> - Tushar.
> >>
> >>
> >> On Thu, Sep 22, 2016 at 11:39 AM, Chinmay Kolhatkar
> >> <chin...@datatorrent.com> wrote:
> >> > Hi All,
> >> >
> >> > For testing of calcite generated DAG, I want to verify whether the
> >> correct
> >> > DAG is created with right operators and streams and whether properties
> >> are
> >> > set properly.
> >> >
> >> > Is there any PrintWriter for the LogicalPlan object printing
> components
> >> of
> >> > DAG?
> >> >
> >> > If not, I am planning to write one for Calcite testing.
> >> > I was wondering if that would be useful addition to apex-core for
> testing
> >> > purpose.
> >> >
> >> > Please share your opinion.
> >> >
> >> > Thanks,
> >> > Chinmay.
> >>
>

Reply via email to