[
https://issues.apache.org/jira/browse/BEAM-6674?focusedWorklogId=256196&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-256196
]
ASF GitHub Bot logged work on BEAM-6674:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Jun/19 20:26
Start Date: 07/Jun/19 20:26
Worklog Time Spent: 10m
Work Description: reuvenlax commented on issue #8725: [BEAM-6674] Add
schema support to JdbcIO read
URL: https://github.com/apache/beam/pull/8725#issuecomment-500027187
What you suggested already works via Schema inference. If you have
PCollection<T> and T has a registered schema, then Beam will infer it
(assuming that T is not erased for some reason). However to convert the
Jdbc class to T requires knowing the actual type in the IO.
On Fri, Jun 7, 2019 at 4:42 AM Charith Ellawala <[email protected]>
wrote:
> *@charithe* commented on this pull request.
> ------------------------------
>
> In sdks/java/io/jdbc/src/main/java/org/apache/beam/sdk/io/jdbc/JdbcIO.java
> <https://github.com/apache/beam/pull/8725#discussion_r291556575>:
>
> > @@ -188,6 +191,15 @@
> .build();
> }
>
> + /** Read Beam {@link Row}s from a JDBC data source. */
> + @Experimental(Experimental.Kind.SCHEMAS)
> + public static ReadRows readRows() {
> + return new AutoValue_JdbcIO_ReadRows.Builder()
> + .setFetchSize(DEFAULT_FETCH_SIZE)
> + .setOutputParallelization(true)
> + .build();
> + }
>
> So I assumed that it would be easy to obtain the schema for T and
> implicitly attach it to the PCollection. However, this appears to be
> difficult to do reliably unless the user explicitly provides a reference to
> Class<T> as you correctly suggested.
>
> Given that the user has to make a conscious effort to enable schema
> support by providing a reference to Class<T>, wouldn't it make sense to
> introduce a generic utility function such as
PCollections.withSchema(PCollection<T>,
> Class<T>) that would work for any kind of PCollection and not just the
> output of JDBC IO?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
>
<https://github.com/apache/beam/pull/8725?email_source=notifications&email_token=AFAYJVLYKZV6GQMKO6KPPHLPZJCQTA5CNFSM4HRE7V22YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB242OVA#discussion_r291556575>,
> or mute the thread
>
<https://github.com/notifications/unsubscribe-auth/AFAYJVKQ3KYP6SUPZL2TFU3PZJCQTANCNFSM4HRE7V2Q>
> .
>
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 256196)
Time Spent: 2h 40m (was: 2.5h)
> The JdbcIO source should produce schemas
> ----------------------------------------
>
> Key: BEAM-6674
> URL: https://issues.apache.org/jira/browse/BEAM-6674
> Project: Beam
> Issue Type: Sub-task
> Components: io-java-jdbc
> Reporter: Reuven Lax
> Assignee: Shehzaad Nakhoda
> Priority: Major
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)