Skip to content

Commit

Permalink
[SPARK-47522][SQL][FOLLOWUP] Add float(p) values for MySQLIntegration…
Browse files Browse the repository at this point in the history
…Suite

### What changes were proposed in this pull request?

Add float(p) values for MySQLIntegrationSuite

### Why are the changes needed?

test improvements

### Does this PR introduce _any_ user-facing change?

no
### How was this patch tested?

new test cases

### Was this patch authored or co-authored using generative AI tooling?
no

Closes apache#45672 from yaooqinn/SPARK-47522-F.

Authored-by: Kent Yao <yao@apache.org>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
  • Loading branch information
yaooqinn authored and dongjoon-hyun committed Mar 22, 2024
1 parent 36126a5 commit 39500a3
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ class MySQLIntegrationSuite extends DockerJDBCIntegrationSuite {
conn.prepareStatement("INSERT INTO strings VALUES ('the', 'quick', 'brown', 'fox', " +
"'jumps', 'over', 'the', 'lazy', 'dog', '{\"status\": \"merrily\"}')").executeUpdate()

conn.prepareStatement("CREATE TABLE floats (f1 FLOAT, f2 FLOAT UNSIGNED)").executeUpdate()
conn.prepareStatement("INSERT INTO floats VALUES (1.23, 4.56)").executeUpdate()
conn.prepareStatement("CREATE TABLE floats (f1 FLOAT, f2 FLOAT(10), f3 FLOAT(53), " +
"f4 FLOAT UNSIGNED, f5 FLOAT(10) UNSIGNED, f6 FLOAT(53) UNSIGNED)").executeUpdate()
conn.prepareStatement("INSERT INTO floats VALUES (1.23, 4.56, 7.89, 1.23, 4.56, 7.89)")
.executeUpdate()
}

test("Basic test") {
Expand Down Expand Up @@ -267,6 +269,6 @@ class MySQLIntegrationSuite extends DockerJDBCIntegrationSuite {

test("SPARK-47522: Read MySQL FLOAT as FloatType to keep consistent with the write side") {
val df = spark.read.jdbc(jdbcUrl, "floats", new Properties)
checkAnswer(df, Row(1.23f, 4.56d))
checkAnswer(df, Row(1.23f, 4.56f, 7.89d, 1.23d, 4.56d, 7.89d))
}
}

0 comments on commit 39500a3

Please sign in to comment.