You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by James Duong <jd...@dremio.com> on 2018/07/25 21:00:46 UTC
Unparsing only a SqlNode sub-tree
Hi,
During the process of unparsing a SqlNode tree, is there a way to unparse a
subtree to a String then cache its value?
I was thinking I could spawn another SqlWriter from the SqlWriter object
supplied to unparse(), then pull the SQL string fragment from it. But the
SqlWriter isn't cloneable, so there isn't a guaranteed way to ensure the
new SqlWriter is created the same way as the original.
Re: Unparsing only a SqlNode sub-tree
Posted by Julian Hyde <jh...@apache.org>.
In https://github.com/julianhyde/calcite/commit/35d7187803e59fe76ab56cf4ced91cf88f71d4af <https://github.com/julianhyde/calcite/commit/35d7187803e59fe76ab56cf4ced91cf88f71d4af> (not yet merged to master) I made it easier to convert a SqlNode to a SQL string. See class SimpleContext.
> On Jul 25, 2018, at 2:58 PM, Jacques Nadeau <ja...@apache.org> wrote:
>
> Why not just add a clone method or similar to SqlWriter?
>
> On Wed, Jul 25, 2018 at 2:00 PM, James Duong <jd...@dremio.com> wrote:
>
>> Hi,
>>
>> During the process of unparsing a SqlNode tree, is there a way to unparse a
>> subtree to a String then cache its value?
>>
>> I was thinking I could spawn another SqlWriter from the SqlWriter object
>> supplied to unparse(), then pull the SQL string fragment from it. But the
>> SqlWriter isn't cloneable, so there isn't a guaranteed way to ensure the
>> new SqlWriter is created the same way as the original.
>>
Re: Unparsing only a SqlNode sub-tree
Posted by Jacques Nadeau <ja...@apache.org>.
Why not just add a clone method or similar to SqlWriter?
On Wed, Jul 25, 2018 at 2:00 PM, James Duong <jd...@dremio.com> wrote:
> Hi,
>
> During the process of unparsing a SqlNode tree, is there a way to unparse a
> subtree to a String then cache its value?
>
> I was thinking I could spawn another SqlWriter from the SqlWriter object
> supplied to unparse(), then pull the SQL string fragment from it. But the
> SqlWriter isn't cloneable, so there isn't a guaranteed way to ensure the
> new SqlWriter is created the same way as the original.
>