Skip to content

Commit 968adaf

Browse files
committed
Linter
1 parent 70fc4fd commit 968adaf

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,5 @@ public object DuckDb : DbType("duckdb") {
256256
* Checks if the DuckDB URL represents an in-memory database.
257257
* In-memory DuckDB URLs are either "jdbc:duckdb:" or "jdbc:duckdb:" followed only by whitespace.
258258
*/
259-
private fun String.isInMemoryDuckDb(): Boolean =
260-
this == "jdbc:duckdb:" || matches("jdbc:duckdb:\\s*$".toRegex())
259+
private fun String.isInMemoryDuckDb(): Boolean = this == "jdbc:duckdb:" || matches("jdbc:duckdb:\\s*$".toRegex())
261260
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public object Sqlite : DbType("sqlite") {
3232

3333
override fun convertSqlTypeToKType(tableColumnMetadata: TableColumnMetadata): KType? = null
3434

35-
override fun createConnection(dbConfig: DbConnectionConfig): Connection {
36-
return if (dbConfig.readOnly) {
35+
override fun createConnection(dbConfig: DbConnectionConfig): Connection =
36+
if (dbConfig.readOnly) {
3737
try {
3838
// Use SQLiteConfig to set read-only mode before a connection establishment
3939
val configClass = Class.forName("org.sqlite.SQLiteConfig")
@@ -49,6 +49,4 @@ public object Sqlite : DbType("sqlite") {
4949
} else {
5050
DriverManager.getConnection(dbConfig.url, dbConfig.user, dbConfig.password)
5151
}
52-
}
53-
5452
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import java.io.File
1313
import java.nio.file.Files
1414
import java.sql.Connection
1515
import java.sql.DriverManager
16-
import java.sql.SQLException
1716
import kotlin.reflect.typeOf
1817

1918
@DataSchema
@@ -50,20 +49,22 @@ interface CustomerOrderSQLite {
5049
class SqliteTest {
5150
companion object {
5251
private lateinit var connection: Connection
53-
// we are using a temporary file because we need to test requests with DBConnectionConfig,
54-
// which creates a connection under the hood and need to have access to the shared SQLite database
52+
53+
/**
54+
* We are using a temporary file because we need to test requests with DBConnectionConfig,
55+
* which creates a connection under the hood and need to have access to the shared SQLite database
56+
*/
5557
private lateinit var testDbFile: File
56-
private lateinit var DATABASE_URL: String
58+
private lateinit var databaseUrl: String
5759

5860
@BeforeClass
5961
@JvmStatic
6062
fun setUpClass() {
6163
testDbFile = Files.createTempFile("dataframe_sqlite_test_", ".db").toFile()
6264
testDbFile.deleteOnExit() // if fails
6365

64-
DATABASE_URL = "jdbc:sqlite:${testDbFile.absolutePath}"
65-
connection = DriverManager.getConnection(DATABASE_URL)
66-
66+
databaseUrl = "jdbc:sqlite:${testDbFile.absolutePath}"
67+
connection = DriverManager.getConnection(databaseUrl)
6768

6869
@Language("SQL")
6970
val createCustomersTableQuery = """
@@ -146,7 +147,6 @@ class SqliteTest {
146147
println("Warning: Could not clean up test database file: ${e.message}")
147148
}
148149
}
149-
150150
}
151151

152152
@Test
@@ -177,7 +177,7 @@ class SqliteTest {
177177
fun `read from tables with DBConnectionConfig`() {
178178
val customerTableName = "Customers"
179179

180-
val dbConnectionConfig = DbConnectionConfig(DATABASE_URL)
180+
val dbConnectionConfig = DbConnectionConfig(databaseUrl)
181181

182182
val df = DataFrame.readSqlTable(dbConnectionConfig, customerTableName).cast<CustomerSQLite>()
183183
val result = df.filter { it[CustomerSQLite::name] == "John Doe" }
@@ -231,7 +231,7 @@ class SqliteTest {
231231

232232
@Test
233233
fun `read from sql query with DBConnectionConfig`() {
234-
val dbConnectionConfig = DbConnectionConfig(DATABASE_URL)
234+
val dbConnectionConfig = DbConnectionConfig(databaseUrl)
235235

236236
val df = DataFrame.readSqlQuery(dbConnectionConfig, sqlQuery).cast<CustomerOrderSQLite>()
237237
val result = df.filter { it[CustomerOrderSQLite::customerSalary] > 1 }

0 commit comments

Comments
 (0)