scala> sql("select rand() +
1").queryExecution.analyzed(0).expressions.head.treeString
res11: String =
"(rand(3296762545665822882) + cast(1 as double)) AS
(rand(3296762545665822882) + CAST(1 AS DOUBLE))#29
+- (rand(3296762545665822882) + cast(1 as double))
   :- rand(3296762545665822882)
   +- cast(1 as double)
      +- 1
"


On Wed, Aug 24, 2016 at 11:23 PM, Maciej Bryński <mac...@brynski.pl> wrote:

> @rxin
> It's not I'm looking for.
> Explain prints output like this.
> == Physical Plan ==
> *Project [id#1576L AS id#1582L]
> +- *Range (0, 1000, splits=400)
>
> I'd like to have whole tree with expressions.
>
> So when I have "select x + y" there should by Add expresion etc.
>
> M.
>
> 2016-08-24 22:39 GMT+02:00 Reynold Xin <r...@databricks.com>:
> > It's basically the output of the explain command.
> >
> >
> > On Wed, Aug 24, 2016 at 12:31 PM, Maciej Bryński <mac...@brynski.pl>
> wrote:
> >>
> >> Hi,
> >> I read this article:
> >>
> >> https://databricks.com/blog/2015/04/13/deep-dive-into-
> spark-sqls-catalyst-optimizer.html
> >>
> >> And I have a question. Is it possible to get / print Tree for SQL Query
> ?
> >>
> >> Something like this:
> >>
> >> Add(Attribute(x), Add(Literal(1), Literal(2)))
> >>
> >> Regards,
> >> --
> >> Maciek Bryński
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe e-mail: dev-unsubscr...@spark.apache.org
> >>
> >
>
>
>
> --
> Maciek Bryński
>

Reply via email to