Hi, You can customize a SqlDialect, which inherits ClickHouseSqlDialect, and then you could customize the logic of `getCastSpec` method.
Another way is that you can create a `ClickHouseSqlDialect` in your project, its package name is the same as ClickHouseSqlDialect in Calcite, so that your project will load your ClickHouseSqlDialect, and then you can modify the logic inside,such as `getCastSpec` method. Best, LakeShen 张鑫 <[email protected]> 于2023年10月10日周二 11:56写道: > Hi all, > > I want to translate a optimized sql by RelNode and then convert it into > SqlNode so that I can get sql string to execute. After validation and > optimization by HepPlanner, I got relNode. Then, > > > SqlNode sqlNode = RelToSqlConverter relToSqlConverter = new > RelToSqlConverter(ClickHouseSqlDialect.DEFAULT).visitRoot(relNode).asStatement(); > > And the sql string of sqlNode is below, > > ``` > Select > CAST(c1 AS `INT64`), > COUNT(*), > groupBitMap(c3) > ... > ``` > > > My Original sql string is below, > ``` > Select > c1, > COUNT(c2), > COUNT(DISTINCT c3) > ... > ``` > > > My expectation is like this, > ``` > Select > c1, > COUNT(c2), > groupBitMap(c3) > ... > ``` > > > How can I achieve this by ignore type cast and nullability etc. to keep > origin sql unchanged as much as possible? > > Really thanks. > > >
