ccaominh commented on a change in pull request #6974: sql support for dynamic 
parameters
URL: https://github.com/apache/incubator-druid/pull/6974#discussion_r311302328
 
 

 ##########
 File path: sql/src/main/java/org/apache/druid/sql/avatica/DruidStatement.java
 ##########
 @@ -152,27 +162,36 @@ public DruidStatement prepare(
       try {
         ensure(State.NEW);
         sqlLifecycle.initialize(query, queryContext);
-        sqlLifecycle.planAndAuthorize(authenticationResult);
+
+        this.authenticationResult = authenticationResult;
+        PrepareResult prepareResult = 
sqlLifecycle.prepare(authenticationResult);
         this.maxRowCount = maxRowCount;
         this.query = query;
+        ArrayList<AvaticaParameter> params = new ArrayList<>();
+        final RelDataType parameterRowType = 
prepareResult.getParameterRowType();
+        for (RelDataTypeField field : parameterRowType.getFieldList()) {
+          RelDataType type = field.getType();
+          params.add(
+              new AvaticaParameter(
+                  false,
+                  type.getPrecision(),
+                  type.getScale(),
+                  type.getSqlTypeName().getJdbcOrdinal(),
+                  type.getSqlTypeName().getName(),
+                  Object.class.getName(),
 
 Review comment:
   Why did you hard code this to `java.lang.Object`? From the docs, it's 
supposed to be the Java class backing the JDBC type (e.g., `java.lang.Integer`) 
— though I'm not sure what it's used for.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to