Re: Avoid SqlParser.toSqlString() adding double quotes to select identifiers
Have you tried using MysqlSqlDialect instead?
On Sun, Nov 11, 2018, 09:21 Shashwat Kumar <shashwatkmr.001@xxxxxxxxx wrote:
> I am trying to modify a SQL statement using SQL Parser and implementing
> SQLVisitor interface to modify select column variables.
> However after modification when I am trying to convert back to sql
> statement, I am getting double quotes in identifiers which is causing sql
> to break on Elastic Search.
> My input query is as follows:
> SELECT user FROM logs;
> I want to change it to
> SELECT _MAP['user'] as "user" FROM "logs";
> toSqlString(SqlDialect.DatabaseProduct.CALCITE.getDialect()) is returning
> SELECT "_MAP['user']" AS "user" FROM "logs"
> How should I do this? Thank you in advance for any suggestions.
> Shashwat Kumar