JiajunBernoulli commented on a change in pull request #2615:
URL: https://github.com/apache/calcite/pull/2615#discussion_r757854332
##########
File path:
core/src/test/java/org/apache/calcite/test/TypeCoercionConverterTest.java
##########
@@ -133,4 +162,24 @@
private void checkPlanEquals(String sql) {
tester.assertConvertsTo(sql, "${plan}");
}
+
+ private void checkValidateSqlEquals(String sql) {
+ Objects.requireNonNull(sql, "sql");
+ final SqlNode sqlQuery;
+ try {
+ sqlQuery = tester.parseQuery(sql);
+ } catch (RuntimeException | Error e) {
+ throw e;
+ } catch (Exception e) {
+ throw TestUtil.rethrow(e);
+ }
+ final RelDataTypeFactory typeFactory =
tester.getValidator().getTypeFactory();
+ final Prepare.CatalogReader catalogReader =
+ tester.createCatalogReader(typeFactory);
+ final SqlValidator validator =
+ tester.createValidator(catalogReader, typeFactory);
+
+ final String actual = validator.validate(sqlQuery).toString();
Review comment:
I'm interested in it. `checkValidateSqlEquals` function can be
abstracted.
Do you think it's more appropriate to put it in the parent class
`SqlToRelTestBase` or create an interface `SqlToValidateTestBase`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]