openinx commented on a change in pull request #1893:
URL: https://github.com/apache/iceberg/pull/1893#discussion_r551840539
##########
File path: flink/src/test/java/org/apache/iceberg/flink/FlinkTestBase.java
##########
@@ -72,8 +72,21 @@ protected TableEnvironment getTableEnv() {
return tEnv;
}
+ /**
+ * if we have a sql with '%' , for example : SELECT * FROM mytable WHERE
data LIKE 'a%'. the format operation will
+ * throw an exception, so we add a sql method to execute the original sql
+ *
+ * @param query the sql
+ * @param args the args to format sql
+ * @return the formated sql
+ */
protected List<Object[]> sql(String query, Object... args) {
- TableResult tableResult = getTableEnv().executeSql(String.format(query,
args));
+ String sql = String.format(query, args);
+ return sql(sql);
+ }
+
+ protected List<Object[]> sql(String sql) {
+ TableResult tableResult = getTableEnv().executeSql(sql);
Review comment:
I'd prefer to have a basic `args` check here ( rather than introducing
another similar `sql(String query, Object... args)` method:
```java
String query = args.length > 0 ? String.format(sql, args) : sql:
TableResult tableResult = getTableEnv().executeSql(query);
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]