andygrove commented on code in PR #65:
URL: https://github.com/apache/datafusion-java/pull/65#discussion_r3267225460
##########
core/src/main/java/org/apache/datafusion/SessionContext.java:
##########
@@ -392,6 +392,39 @@ public void registerUdf(ScalarUdf udf) {
registerScalarUdf(nativeHandle, name, signatureBytes, volatility.code(),
impl);
}
+ /**
+ * Register a Java-implemented data source as a table. SQL queries that
reference {@code name}
+ * call back into {@code source} to fetch batches.
+ *
+ * <p>{@link DataSource#schema()} is called once here, on the calling
thread, and cached on the
+ * native side. {@link
DataSource#scan(org.apache.arrow.memory.BufferAllocator)} is called once
+ * per query that touches the table, on a Tokio worker thread; it must
return a fresh, independent
+ * {@link org.apache.arrow.vector.ipc.ArrowReader} on every call, with its
buffers allocated from
+ * the {@link org.apache.arrow.memory.BufferAllocator} the framework
supplies.
+ *
+ * @throws IllegalArgumentException if {@code name} or {@code source} is
{@code null}.
+ * @throws IllegalStateException if {@code source.schema()} returns {@code
null}, or this context
+ * is closed.
+ * @throws RuntimeException if native registration fails.
+ */
+ public void registerDataSource(String name, DataSource source) {
Review Comment:
Thanks @pgwhalen. I have addressed your feedback.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]