vlsi commented on a change in pull request #2615:
URL: https://github.com/apache/calcite/pull/2615#discussion_r757858760
##########
File path:
core/src/test/java/org/apache/calcite/test/TypeCoercionConverterTest.java
##########
@@ -133,4 +172,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);
Review comment:
Consider using `catch(Throwable e) { TestUtil.rethrow(e, "sql=" + sql) }`
That would be shorter, it would catch all throwables, and it would add the
SQL in question
##########
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:
@JiajunBernoulli , have you seen
https://lists.apache.org/thread/3l9y4fv31kthmpn9pbzqdmfp80yrjphf by @julianhyde
?
--
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]