You can try to disable type coercion in the validator by using the method `org.apache.calcite.sql.validate.SqlValidator.Config#withTypeCoercionEnabled`.
Best, Hongyu Guo On 2023/10/10 03:55:25 张鑫 wrote: > 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. > > >
