ssaurav-redhat opened a new issue, #31419:
URL: https://github.com/apache/beam/issues/31419

   ### What happened?
   
   Referencing [JdbcIo's 
doc](https://beam.apache.org/releases/javadoc/current/org/apache/beam/sdk/io/jdbc/JdbcIO.html)
 in the section for Parallel reading from a JDBC datasource, It mentions to use 
either of these types of column for paritioning `Beam supports partitioned 
reading of all data from a table. Automatic partitioning is supported for a few 
data types: Long, 
[DateTime](https://static.javadoc.io/joda-time/joda-time/2.10.10/org/joda/time/DateTime.html?is-external=true),
 String.`
   
   But when I am passing a string field into it, it tries to convert it into 
Long. As a result the code fails. Can anyone help me with this? 
   
   Beam version -> 2.56.0
   JdbcIo version -> 2.56.0
   
   Code
   `PCollection<LogTable> dbReadData = p.apply("ReadFromMySQL", 
JdbcIO.<LogTable>readWithPartitions()
                   
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create(
                                   "com.mysql.cj.jdbc.Driver", 
"jdbc:mysql://localhost:3307/exampledb")
                           .withUsername("exampleuser")
                           .withPassword("examplepass"))
                   .withTable("logs_table")
                   .withCoder(SerializableCoder.of(LogTable.class))
                           .withPartitionColumn("uuid")
                   .withRowMapper(new JdbcIO.RowMapper<LogTable>() {
                       @Override
                       public LogTable mapRow(ResultSet resultSet) throws 
Exception {
                           String uuid = resultSet.getString("uuid");
                           Timestamp time = resultSet.getTimestamp("time");
                           return new LogTable(uuid, time);
                       }
                   }));`
                   
   table structure ->
   `CREATE TABLE `logs_table` (
     `uuid` varchar(255) NOT NULL,
     `time` timestamp NOT NULL
   )`
   
   Runner used was Flink Runner
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [ ] Component: Python SDK
   - [X] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Spark Runner
   - [X] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner


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