Skip to content

Commit ebd84be

Browse files
committed
fixup! fixup! ktlint: manual fixes
1 parent 2dd54c6 commit ebd84be

File tree

11 files changed

+73
-119
lines changed

11 files changed

+73
-119
lines changed

dataframe-jdbc/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/readJdbc.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,8 @@ private fun buildSchemaByTableColumns(tableColumns: MutableList<TableColumnMetad
525525
}
526526

527527
private fun generateColumnSchemaValue(dbType: DbType, tableColumnMetadata: TableColumnMetadata): ColumnSchema =
528-
dbType.convertSqlTypeToColumnSchemaValue(tableColumnMetadata) ?: ColumnSchema.Value(
529-
makeCommonSqlToKTypeMapping(tableColumnMetadata),
530-
)
528+
dbType.convertSqlTypeToColumnSchemaValue(tableColumnMetadata)
529+
?: ColumnSchema.Value(makeCommonSqlToKTypeMapping(tableColumnMetadata))
531530

532531
/**
533532
* Retrieves the metadata of the columns in the result set.
@@ -681,7 +680,8 @@ private fun extractNewRowFromResultSetAndAddToData(
681680
* @return The generated KType.
682681
*/
683682
private fun generateKType(dbType: DbType, tableColumnMetadata: TableColumnMetadata): KType =
684-
dbType.convertSqlTypeToKType(tableColumnMetadata) ?: makeCommonSqlToKTypeMapping(tableColumnMetadata)
683+
dbType.convertSqlTypeToKType(tableColumnMetadata)
684+
?: makeCommonSqlToKTypeMapping(tableColumnMetadata)
685685

686686
/**
687687
* Creates a mapping between common SQL types and their corresponding KTypes.

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/h2Test.kt

Lines changed: 37 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -216,37 +216,35 @@ class JdbcTest {
216216
""".trimIndent(),
217217
).executeUpdate()
218218

219-
connection
220-
.prepareStatement(
221-
"""
222-
INSERT INTO TestTable VALUES (
223-
'DEF', 'LMN', 'Another CLOB data', 'Different CLOB data',
224-
'Another Varchar', X'101112', X'131415', X'161718',
225-
FALSE, 2, 200, 2000, 200000,
226-
234.56, 2.34, 4.56, 3.14,
227-
'2023-07-21', '14:30:00', '22:45:00', '2023-07-20 18:15:30',
228-
'2023-07-19 18:15:30', NULL,
229-
'Option2', '{"key": "another_value"}', '234e5678-e89b-12d3-a456-426655440001'
230-
)
231-
""".trimIndent(),
232-
).executeUpdate()
233-
234-
connection
235-
.prepareStatement(
236-
"""
237-
INSERT INTO TestTable VALUES (
238-
'GHI', 'OPQ', 'Third CLOB entry', 'Yet another CLOB data',
239-
'Yet Another Varchar', X'192021', X'222324', X'252627',
240-
TRUE, 3, 300, 3000, 300000,
241-
345.67, 3.45, 5.67, 4.71,
242-
'2023-07-22', '20:45:00', '03:30:00', '2023-07-21 23:45:15',
243-
'2023-07-20 23:45:15', NULL,
244-
'Option3', '{ "person": { "name": "John Doe", "age": 30 }, ' ||
245-
'"address": { "street": "123 Main St", "city": "Exampleville", "zipcode": "12345"}}',
246-
'345e6789-e89b-12d3-a456-426655440002'
247-
)
248-
""".trimIndent(),
249-
).executeUpdate()
219+
connection.prepareStatement(
220+
"""
221+
INSERT INTO TestTable VALUES (
222+
'DEF', 'LMN', 'Another CLOB data', 'Different CLOB data',
223+
'Another Varchar', X'101112', X'131415', X'161718',
224+
FALSE, 2, 200, 2000, 200000,
225+
234.56, 2.34, 4.56, 3.14,
226+
'2023-07-21', '14:30:00', '22:45:00', '2023-07-20 18:15:30',
227+
'2023-07-19 18:15:30', NULL,
228+
'Option2', '{"key": "another_value"}', '234e5678-e89b-12d3-a456-426655440001'
229+
)
230+
""".trimIndent(),
231+
).executeUpdate()
232+
233+
connection.prepareStatement(
234+
"""
235+
INSERT INTO TestTable VALUES (
236+
'GHI', 'OPQ', 'Third CLOB entry', 'Yet another CLOB data',
237+
'Yet Another Varchar', X'192021', X'222324', X'252627',
238+
TRUE, 3, 300, 3000, 300000,
239+
345.67, 3.45, 5.67, 4.71,
240+
'2023-07-22', '20:45:00', '03:30:00', '2023-07-21 23:45:15',
241+
'2023-07-20 23:45:15', NULL,
242+
'Option3', '{ "person": { "name": "John Doe", "age": 30 }, ' ||
243+
'"address": { "street": "123 Main St", "city": "Exampleville", "zipcode": "12345"}}',
244+
'345e6789-e89b-12d3-a456-426655440002'
245+
)
246+
""".trimIndent(),
247+
).executeUpdate()
250248

251249
val tableName = "TestTable"
252250
val df = DataFrame.readSqlTable(connection, tableName).cast<TestTableData>()
@@ -717,18 +715,14 @@ class JdbcTest {
717715

718716
connection.createStatement().execute(createTestTable1Query)
719717

720-
connection.createStatement().execute(
721-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)",
722-
)
723-
connection.createStatement().execute(
724-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)",
725-
)
726-
connection.createStatement().execute(
727-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)",
728-
)
729-
connection.createStatement().execute(
730-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)",
731-
)
718+
connection.createStatement()
719+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)")
720+
connection.createStatement()
721+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)")
722+
connection.createStatement()
723+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)")
724+
connection.createStatement()
725+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)")
732726

733727
// start testing `readSqlTable` method
734728

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/mariadbH2Test.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ class MariadbH2Test {
151151
jsonCol JSON NOT NULL
152152
)
153153
"""
154-
connection.createStatement().execute(
155-
createTableQuery.trimIndent(),
156-
)
154+
connection.createStatement().execute(createTableQuery.trimIndent())
157155

158156
@Language("SQL")
159157
val createTableQuery2 = """
@@ -190,9 +188,7 @@ class MariadbH2Test {
190188
enumCol ENUM('Value1', 'Value2', 'Value3')
191189
)
192190
"""
193-
connection.createStatement().execute(
194-
createTableQuery2.trimIndent(),
195-
)
191+
connection.createStatement().execute(createTableQuery2.trimIndent())
196192

197193
@Language("SQL")
198194
val insertData1 =

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/mssqlH2Test.kt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ class MSSQLH2Test {
112112
);
113113
"""
114114

115-
connection.createStatement().execute(
116-
createTableQuery.trimIndent(),
117-
)
115+
connection.createStatement().execute(createTableQuery.trimIndent())
118116

119117
@Language("SQL")
120118
val insertData1 =
@@ -264,18 +262,14 @@ class MSSQLH2Test {
264262

265263
connection.createStatement().execute(createTestTable1Query)
266264

267-
connection.createStatement().execute(
268-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)",
269-
)
270-
connection.createStatement().execute(
271-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)",
272-
)
273-
connection.createStatement().execute(
274-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)",
275-
)
276-
connection.createStatement().execute(
277-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)",
278-
)
265+
connection.createStatement()
266+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)")
267+
connection.createStatement()
268+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)")
269+
connection.createStatement()
270+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)")
271+
connection.createStatement()
272+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)")
279273

280274
// start testing `readSqlTable` method
281275

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/mysqlH2Test.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ class MySqlH2Test {
148148
)
149149
"""
150150

151-
connection.createStatement().execute(
152-
createTableQuery.trimIndent(),
153-
)
151+
connection.createStatement().execute(createTableQuery.trimIndent())
154152

155153
@Language("SQL")
156154
val createTableQuery2 = """
@@ -189,9 +187,7 @@ class MySqlH2Test {
189187
)
190188
"""
191189

192-
connection.createStatement().execute(
193-
createTableQuery2.trimIndent(),
194-
)
190+
connection.createStatement().execute(createTableQuery2.trimIndent())
195191

196192
@Language("SQL")
197193
val insertData1 =

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/h2/postgresH2Test.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ class PostgresH2Test {
9393
integerCol integer
9494
)
9595
"""
96-
connection.createStatement().execute(
97-
createTableStatement.trimIndent(),
98-
)
96+
connection.createStatement().execute(createTableStatement.trimIndent())
9997

10098
@Language("SQL")
10199
val createTableQuery = """
@@ -114,9 +112,7 @@ class PostgresH2Test {
114112
uuidCol uuid not null
115113
)
116114
"""
117-
connection.createStatement().execute(
118-
createTableQuery.trimIndent(),
119-
)
115+
connection.createStatement().execute(createTableQuery.trimIndent())
120116

121117
@Language("SQL")
122118
val insertData1 = """

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/local/mariadbTest.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ class MariadbTest {
177177
CHECK (JSON_VALID(jsonCol))
178178
)
179179
"""
180-
connection.createStatement().execute(
181-
createTableQuery.trimIndent(),
182-
)
180+
connection.createStatement().execute(createTableQuery.trimIndent())
183181

184182
@Language("SQL")
185183
val createTableQuery2 = """
@@ -217,9 +215,7 @@ class MariadbTest {
217215
setCol SET('Option1', 'Option2', 'Option3')
218216
)
219217
"""
220-
connection.createStatement().execute(
221-
createTableQuery2.trimIndent(),
222-
)
218+
connection.createStatement().execute(createTableQuery2.trimIndent())
223219

224220
@Language("SQL")
225221
val insertData1 =

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/local/mssqlTest.kt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ class MSSQLTest {
139139
);
140140
"""
141141

142-
connection.createStatement().execute(
143-
createTableQuery.trimIndent(),
144-
)
142+
connection.createStatement().execute(createTableQuery.trimIndent())
145143

146144
@Language("SQL")
147145
val insertData1 =
@@ -315,18 +313,14 @@ class MSSQLTest {
315313

316314
connection.createStatement().execute(createTestTable1Query)
317315

318-
connection.createStatement().execute(
319-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)",
320-
)
321-
connection.createStatement().execute(
322-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)",
323-
)
324-
connection.createStatement().execute(
325-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)",
326-
)
327-
connection.createStatement().execute(
328-
"INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)",
329-
)
316+
connection.createStatement()
317+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (1, 'John', 'Crawford', 40)")
318+
connection.createStatement()
319+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (2, 'Alice', 'Smith', 25)")
320+
connection.createStatement()
321+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (3, 'Bob', 'Johnson', 47)")
322+
connection.createStatement()
323+
.execute("INSERT INTO TestTable1 (id, name, surname, age) VALUES (4, 'Sam', NULL, 15)")
330324

331325
// start testing `readSqlTable` method
332326

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/local/mysqlTest.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ class MySqlTest {
173173
)
174174
"""
175175

176-
connection.createStatement().execute(
177-
createTableQuery.trimIndent(),
178-
)
176+
connection.createStatement().execute(createTableQuery.trimIndent())
179177

180178
@Language("SQL")
181179
val createTableQuery2 = """
@@ -217,9 +215,7 @@ class MySqlTest {
217215
)
218216
"""
219217

220-
connection.createStatement().execute(
221-
createTableQuery2.trimIndent(),
222-
)
218+
connection.createStatement().execute(createTableQuery2.trimIndent())
223219

224220
@Language("SQL")
225221
val insertData1 =

dataframe-jdbc/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/local/postgresTest.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ class PostgresTest {
117117
jsonbCol jsonb not null
118118
)
119119
"""
120-
connection.createStatement().execute(
121-
createTableStatement.trimIndent(),
122-
)
120+
connection.createStatement().execute(createTableStatement.trimIndent())
123121

124122
@Language("SQL")
125123
val createTableQuery = """
@@ -146,9 +144,7 @@ class PostgresTest {
146144
xmlCol xml not null
147145
)
148146
"""
149-
connection.createStatement().execute(
150-
createTableQuery.trimIndent(),
151-
)
147+
connection.createStatement().execute(createTableQuery.trimIndent())
152148

153149
@Language("SQL")
154150
val insertData1 = """

0 commit comments

Comments
 (0)