Calcite - Sql Validation

About

Validation of a sql tree (SqlNode)

How to

Query Planning Utilit

With the query planning utility as shown in the getting started

SqlNode sqlNodeValidated = planner.validate(sqlNode);

SqlValidatorUtil

With a SqlValidatorUtil. In the example below, you just need to pass a catalogReader.

SqlStdOperatorTable operatorTable = SqlStdOperatorTable.instance();
SqlValidatorWithHints sqlValidator = SqlValidatorUtil.newValidator(
		operatorTable, 
		catalogReader, 
		catalogReader.getTypeFactory(), 
		SqlConformanceEnum.DEFAULT
);
SqlNode sqlValidated = sqlValidator.validate(sqlNode);

Sample code

See live example on github CalciteSqlValidationTest.java


Powered by ComboStrap