You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/04/29 15:31:01 UTC

[GitHub] [flink] walterddr commented on a change in pull request #8248: [FLINK-12309][JDBC] JDBCOoutputFormat and JDBCAppendTableSink float behavior is not align

walterddr commented on a change in pull request #8248: [FLINK-12309][JDBC] JDBCOoutputFormat and JDBCAppendTableSink float behavior is not align
URL: https://github.com/apache/flink/pull/8248#discussion_r279414601
 
 

 ##########
 File path: flink-connectors/flink-jdbc/src/test/java/org/apache/flink/api/java/io/jdbc/JDBCOutputFormatTest.java
 ##########
 @@ -133,6 +133,32 @@ public void testExceptionOnInvalidType() throws IOException {
 		jdbcOutputFormat.writeRecord(row);
 	}
 
+	@Test(expected = RuntimeException.class)
+	public void testCastFloatToDoubleType() throws IOException {
+		jdbcOutputFormat = JDBCOutputFormat.buildJDBCOutputFormat()
+			.setDrivername(DRIVER_CLASS)
+			.setDBUrl(DB_URL)
+			.setQuery(String.format(INSERT_TEMPLATE, INPUT_TABLE))
+			.setSqlTypes(new int[] {
+				Types.INTEGER,
+				Types.VARCHAR,
+				Types.VARCHAR,
+				Types.FLOAT,
+				Types.VARCHAR})
+			.finish();
+		jdbcOutputFormat.open(0, 1);
+
+		Row row = new Row(5);
+		row.setField(0, 4);
+		row.setField(1, "hello");
+		row.setField(2, "world");
+		row.setField(3, 0.99f); // jdbcOutputFormat will cast float to double
 
 Review comment:
   I usually avoid trailing comments (it's already pretty self-explanatory from your test function name

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services