jinxing64 commented on a change in pull request #1452: [WIP][CALCITE-3338] 
Error with executeBatch and preparedStatement when usi…
URL: https://github.com/apache/calcite/pull/1452#discussion_r324515675
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/jdbc/CalciteConnectionImpl.java
 ##########
 @@ -279,18 +279,25 @@ public Properties getProperties() {
       CalciteStatement statement = (CalciteStatement) createStatement();
       CalcitePrepare.CalciteSignature<T> signature =
           statement.prepare(queryable);
-      return enumerable(statement.handle, signature).enumerator();
+      return enumerable(statement.handle, signature, null).enumerator();
     } catch (SQLException e) {
       throw new RuntimeException(e);
     }
   }
 
   public <T> Enumerable<T> enumerable(Meta.StatementHandle handle,
-      CalcitePrepare.CalciteSignature<T> signature) throws SQLException {
+      CalcitePrepare.CalciteSignature<T> signature,
+      List<TypedValue> parameterValues0) throws SQLException {
     Map<String, Object> map = new LinkedHashMap<>();
     AvaticaStatement statement = lookupStatement(handle);
-    final List<TypedValue> parameterValues =
-        TROJAN.getParameterValues(statement);
+
+    final List<TypedValue> parameterValues;
+    if (parameterValues0 == null || parameterValues0.isEmpty()) {
 
 Review comment:
   We should not always assume that `parameterValues0` can cover the parameter 
values in `PreparedStatement`. When calling `AvaticalResultSet#execute` 
(https://github.com/apache/calcite-avatica/blob/master/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSet.java#L183),
 it assumes that all parameters are in statement, thus just passes in an empty 
list for parameters.
   
   For above reason, I added check as above

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to