[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unparsing only a SqlNode sub-tree

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 <jacques@xxxxxxxxxx> wrote:
> Why not just add a clone method or similar to SqlWriter?
> On Wed, Jul 25, 2018 at 2:00 PM, James Duong <jduong@xxxxxxxxxx> 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.