use of org.apache.calcite.sql.validate.SqlDelegatingConformance in project calcite by apache.
the class SqlValidatorTest method testUserDefinedConformance.
@Test
public void testUserDefinedConformance() {
final SqlAbstractConformance c = new SqlDelegatingConformance(SqlConformanceEnum.DEFAULT) {
public boolean isBangEqualAllowed() {
return true;
}
};
// Our conformance behaves differently from ORACLE_10 for FROM-less query.
final SqlTester customTester = tester.withConformance(c);
final SqlTester defaultTester = tester.withConformance(SqlConformanceEnum.DEFAULT);
final SqlTester oracleTester = tester.withConformance(SqlConformanceEnum.ORACLE_10);
sql("^select 2+2^").tester(customTester).ok().tester(defaultTester).ok().tester(oracleTester).fails("SELECT must have a FROM clause");
// Our conformance behaves like ORACLE_10 for "!=" operator.
sql("select * from (values 1) where 1 != 2").tester(customTester).ok().tester(defaultTester).fails("Bang equal '!=' is not allowed under the current SQL conformance level").tester(oracleTester).ok();
sql("select * from (values 1) where 1 != any (2, 3)").tester(customTester).ok().tester(defaultTester).fails("Bang equal '!=' is not allowed under the current SQL conformance level").tester(oracleTester).ok();
}
Aggregations