Skip to content

Commit 9e4ff9e

Browse files
author
Marius Posta
authored
bulk-cdk-toolkit-extract-jdbc: cosmetic changes (#44007)
1 parent 75e0adf commit 9e4ff9e

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

airbyte-cdk/bulk/toolkits/extract-jdbc/src/main/kotlin/io/airbyte/cdk/command/JdbcSourceConfiguration.kt

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Copyright (c) 2024 Airbyte, Inc., all rights reserved. */
22
package io.airbyte.cdk.command
33

4-
import io.airbyte.cdk.read.LimitState
54
import io.micronaut.context.annotation.Factory
65
import jakarta.inject.Singleton
76

@@ -19,10 +18,7 @@ interface JdbcSourceConfiguration : SourceConfiguration {
1918
/** Ordered set of schemas for the connector to consider. */
2019
val schemas: Set<String>
2120

22-
/** How many rows to query in the first batch. */
23-
val initialLimit: LimitState
24-
get() = LimitState.minimum
25-
21+
/** When set, each table is queried individually to check for SELECT privileges. */
2622
val checkPrivileges: Boolean
2723
get() = true
2824

airbyte-cdk/bulk/toolkits/extract-jdbc/src/main/kotlin/io/airbyte/cdk/read/MemoryFetchSizeEstimator.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import kotlin.math.min
1212
class MemoryFetchSizeEstimator(
1313
val maxMemoryBytes: Long,
1414
val maxConcurrency: Int,
15-
) : StreamPartitionsCreatorUtils.FetchSizeEstimator {
15+
) {
1616
private val log = KotlinLogging.logger {}
1717

18-
override fun apply(rowByteSizeSample: Sample<Long>): Int {
18+
fun apply(rowByteSizeSample: Sample<Long>): Int {
1919
val maxRowBytes: Long = rowByteSizeSample.sampledValues.maxOrNull() ?: 0L
2020
log.info {
2121
"maximum row size in ${rowByteSizeSample.kind.name} table is $maxRowBytes bytes"

airbyte-cdk/bulk/toolkits/extract-jdbc/src/main/kotlin/io/airbyte/cdk/read/StreamPartitionsCreatorUtils.kt

-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import io.airbyte.cdk.discover.Field
88
import io.airbyte.cdk.util.Jsons
99
import io.github.oshai.kotlinlogging.KotlinLogging
1010
import java.io.OutputStream
11-
import java.util.function.Function
1211
import kotlin.random.Random
1312

1413
/** Utilities for [StreamPartitionsCreator] that don't rely directly on its input state. */
@@ -73,8 +72,6 @@ class StreamPartitionsCreatorUtils(
7372
return lbs.zip(ubs)
7473
}
7574

76-
fun interface FetchSizeEstimator : Function<Sample<Long>, Int>
77-
7875
fun rowByteSizeEstimator(): (ObjectNode) -> Long {
7976
val countingOutputStream =
8077
object : OutputStream() {

airbyte-cdk/bulk/toolkits/extract-jdbc/src/main/kotlin/io/airbyte/cdk/read/StreamReadContext.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ import java.util.concurrent.atomic.AtomicReference
1414
import kotlinx.coroutines.sync.Semaphore
1515

1616
/**
17-
* A [StreamReadContextManager] may be injected in a
18-
* [io.airbyte.cdk.source.PartitionsCreatorFactory] to provide it, and the
19-
* [io.airbyte.cdk.source.PartitionsCreator] and [io.airbyte.cdk.source.PartitionReader] instances
20-
* it creates, with a set of global singletons useful for implementing stream READs for a JDBC
21-
* source.
17+
* A [StreamReadContextManager] may be injected in a [io.airbyte.cdk.read.PartitionsCreatorFactory]
18+
* to provide it, and the[io.airbyte.cdk.read.PartitionsCreator] and
19+
* [io.airbyte.cdk.read.PartitionReader] instances it creates, with a set of global singletons
20+
* useful for implementing stream READs for a JDBC source.
2221
*
2322
* For each stream in the configured catalog, these global singletons are packaged in a
2423
* [StreamReadContext] which bundles them with the corresponding [Stream] as well as a couple
@@ -61,7 +60,7 @@ class StreamReadContext(
6160
val outputConsumer: OutputConsumer,
6261
val stream: Stream,
6362
) {
64-
val transientLimitState: TransientState<LimitState> = TransientState(configuration.initialLimit)
63+
val transientLimitState: TransientState<LimitState> = TransientState(LimitState.minimum)
6564

6665
val transientCursorUpperBoundState: TransientState<JsonNode?> = TransientState(null)
6766

0 commit comments

Comments
 (0)