aiguofer commented on issue #153:
URL: https://github.com/apache/arrow-java/issues/153#issuecomment-2552283997

   IIRC, I believe there's a few things at play here:
   
   - The usage of the Avatica JDBC client
   - The statically typed nature of Java
   - The general design of the driver
   
   I'd have to dig into the code again as it's been a while, but from what I 
remember, when you create a `PreparedStatement`, the driver creates a 
`VectorSchemaRoot` based on the returned Parameter schema. When you set a 
parameter, it attempts to set the given value on the `VectorSchemaRoot`. I'm 
not entirely sure why most of the Java implementation is around 
`VectorSchemaRoot` instead or raw `ArrowRecordBatches`, but I imagine it's due 
to some sort of memory optimization (being able to re-use allocated memory 
within the JVM for pointers to raw Arrow data in the shared memory space). That 
being said, I don't think the use of `VectorSchemaRoot` changes anything here 
as ultimately the data is indeed sent to the server in an `ArrowRecordBatch`.
   
   I think it's possible to re-design how we bind parameters to do the 
following instead:
   - Move the creation of the `VectorSchemaRoot` from the 
`AvaticaParameterBinder` constructor into `AvaticaParameterBinder.bind`
   - Create the `VectorSchemaRoot` by introspecting the list of `typedValues` 
instead of using the `PreparedStatement.getParameterSchema`
   
   The only potential issue here is I'm not entire sure if the 
`FlightSqlClient` needs the `ParameterSchema` to match the schema of the 
`VectorSchemaRoot` that we actually pass in.
   
   I'm curious, how is this handled in other languages? Does the schema that is 
sent with parameters need to match the `ParameterSchema`?


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

Reply via email to