You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/10 16:01:05 UTC
[GitHub] [arrow-adbc] zeroshade opened a new issue, #60: Retrieve expected param binding information
zeroshade opened a new issue, #60:
URL: https://github.com/apache/arrow-adbc/issues/60
If available, it would be great to be able to retrieve any information about parameter binding that is available. Some potential information that *might* be available:
* Number of expected parameters
* Names of expected parameters
* Schema / types of expected parameters
Since it's not reliable to always be able to get this information, there would need to be a way to indicate that there was no error, but the information is not available.
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] zeroshade commented on issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1211193521
Seems good to me! :)
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] zeroshade commented on issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
zeroshade commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1211012442
at a minimum it would be good to be able to at least know the *number* of expected inputs even if the schema isn't knowable.
Maybe having two values? an integer indicating the number of parameters and an `ArrowSchema*` which can be left null if it's not knowable?
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm closed issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
lidavidm closed issue #60: [Format] Retrieve expected param binding information
URL: https://github.com/apache/arrow-adbc/issues/60
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1210983818
Flight SQL provides this. I think this makes sense, but yeah, something like `SELECT ?, ?` is going to be dubious. I don't know if there's a great way of indicating that, though. Or, `SELECT ? + ?` would constrain the type, but still wouldn't give you a single schema.
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1211134073
How about this? The parameters are always encoded as a schema, but unknown types are represented as just NullType. Avoids having lots of optional things/multiple calls.
```diff
diff --git a/adbc.h b/adbc.h
index e7d9d51..2748d0d 100644
--- a/adbc.h
+++ b/adbc.h
@@ -746,6 +746,22 @@ AdbcStatusCode AdbcStatementBindStream(struct AdbcStatement* statement,
struct ArrowArrayStream* values,
struct AdbcError* error);
+/// \brief Get the schema for bound parameters.
+///
+/// This should be called after AdbcStatementPrepare. This retrieves
+/// an Arrow schema describing the number, names, and types of the
+/// parameters in a parameterized statement. Not all drivers will
+/// support this. If the name of a parameter cannot be determined,
+/// the name of the corresponding field in the schema will be an empty
+/// string. Similarly, if the type cannot be statically determined,
+/// the type of the corresponding field will be NA (NullType).
+///
+/// \return ADBC_STATUS_NOT_IMPLEMENTED if the schema cannot be determined.
+ADBC_EXPORT
+AdbcStatusCode AdbcStatementGetParameterSchema(struct AdbcStatement* statement,
+ struct ArrowSchema* schema,
+ struct AdbcError* error);
+
/// \brief Read the result of a statement.
///
/// This method can be called only once per execution of the
diff --git a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
index b621587..fbc1d5f 100644
--- a/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
+++ b/java/core/src/main/java/org/apache/arrow/adbc/core/AdbcStatement.java
@@ -22,6 +22,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.arrow.vector.VectorSchemaRoot;
import org.apache.arrow.vector.ipc.ArrowReader;
+import org.apache.arrow.vector.types.pojo.Schema;
public interface AdbcStatement extends AutoCloseable {
/** Set a generic query option. */
@@ -75,6 +76,20 @@ public interface AdbcStatement extends AutoCloseable {
*/
ArrowReader getArrowReader() throws AdbcException;
+ /**
+ * Get the schema for bound parameters.
+ *
+ * <p>This should be called after AdbcStatementPrepare. This retrieves an Arrow schema describing
+ * the number, names, and types of the parameters in a parameterized statement. Not all drivers
+ * will support this. If the name of a parameter cannot be determined, the name of the
+ * corresponding field in the schema will be an empty string. Similarly, if the type cannot be
+ * statically determined, the type of the corresponding field will be NA (NullType).
+ *
+ * @throws AdbcException with {@link AdbcStatusCode#NOT_IMPLEMENTED} if the parameters cannot be
+ * determined at all.
+ */
+ Schema getParameterSchema() throws AdbcException;
+
/**
* Get a list of partitions of the result set.
*
```
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-adbc] lidavidm commented on issue #60: [Format] Retrieve expected param binding information
Posted by GitBox <gi...@apache.org>.
lidavidm commented on issue #60:
URL: https://github.com/apache/arrow-adbc/issues/60#issuecomment-1211081338
That makes sense.
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org