use of org.apache.calcite.sql.validate.SqlAbstractConformance in project calcite by apache.
the class SqlValidatorTest method testAbstractConformance.
@Test
public void testAbstractConformance() throws InvocationTargetException, IllegalAccessException {
final SqlAbstractConformance c0 = new SqlAbstractConformance() {
};
final SqlConformance c1 = SqlConformanceEnum.DEFAULT;
for (Method method : SqlConformance.class.getMethods()) {
final Object o0 = method.invoke(c0);
final Object o1 = method.invoke(c1);
assertThat(method.toString(), Objects.equals(o0, o1), is(true));
}
}
use of org.apache.calcite.sql.validate.SqlAbstractConformance 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