-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Destination Iceberg v2: basic test scaffolds + related runtime classes (
- Loading branch information
Showing
15 changed files
with
208 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
airbyte-integrations/connectors/destination-iceberg-v2/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
testExecutionConcurrency=-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...erg-v2/src/main/kotlin/io/airbyte/integrations/destination/iceberg_v2/IcebergV2Checker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg_v2 | ||
|
||
import io.airbyte.cdk.load.check.DestinationChecker | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class IcebergV2Checker : DestinationChecker<IcebergV2Configuration> { | ||
override fun check(config: IcebergV2Configuration) { | ||
// TODO validate the config | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../src/main/kotlin/io/airbyte/integrations/destination/iceberg_v2/IcebergV2Configuration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg_v2 | ||
|
||
import io.airbyte.cdk.load.command.DestinationConfiguration | ||
import io.airbyte.cdk.load.command.DestinationConfigurationFactory | ||
import io.airbyte.integrations.destination.iceberg.v2.IcebergV2Specification | ||
import javax.inject.Singleton | ||
|
||
// TODO put real fields here | ||
data class IcebergV2Configuration(val something: String) : DestinationConfiguration() | ||
|
||
@Singleton | ||
class IcebergV2ConfigurationFactory : | ||
DestinationConfigurationFactory<IcebergV2Specification, IcebergV2Configuration> { | ||
override fun makeWithoutExceptionHandling( | ||
pojo: IcebergV2Specification | ||
): IcebergV2Configuration { | ||
// TODO convert from the jackson-friendly IcebergV2Specification | ||
// to the programmer-friendly IcebergV2Configuration | ||
return IcebergV2Configuration("hello world") | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...berg-v2/src/main/kotlin/io/airbyte/integrations/destination/iceberg_v2/IcebergV2Writer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg_v2 | ||
|
||
import io.airbyte.cdk.load.command.DestinationStream | ||
import io.airbyte.cdk.load.message.Batch | ||
import io.airbyte.cdk.load.message.DestinationFile | ||
import io.airbyte.cdk.load.message.DestinationRecord | ||
import io.airbyte.cdk.load.message.SimpleBatch | ||
import io.airbyte.cdk.load.write.DestinationWriter | ||
import io.airbyte.cdk.load.write.StreamLoader | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class IcebergV2Writer : DestinationWriter { | ||
override fun createStreamLoader(stream: DestinationStream): StreamLoader { | ||
// TODO instantiate an actual IcebergStreamLoader | ||
return object : StreamLoader { | ||
override val stream = stream | ||
|
||
override suspend fun processRecords( | ||
records: Iterator<DestinationRecord>, | ||
totalSizeBytes: Long | ||
) = SimpleBatch(state = Batch.State.COMPLETE) | ||
|
||
override suspend fun processFile(file: DestinationFile): Batch { | ||
throw NotImplementedError() | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...t-integration/kotlin/io/airbyte/integrations/destination/iceberg.v2/IcebergV2CheckTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg.v2 | ||
|
||
import io.airbyte.cdk.load.check.CheckIntegrationTest | ||
import io.airbyte.cdk.load.check.CheckTestConfig | ||
import java.nio.file.Path | ||
|
||
class IcebergV2CheckTest : | ||
CheckIntegrationTest<IcebergV2Specification>( | ||
successConfigFilenames = | ||
listOf(CheckTestConfig(Path.of(IcebergV2TestUtil.SOME_RANDOM_S3_CONFIG))), | ||
// TODO we maybe should add some configs that are expected to fail `check` | ||
failConfigFilenamesAndFailureReasons = mapOf(), | ||
) |
9 changes: 9 additions & 0 deletions
9
...st-integration/kotlin/io/airbyte/integrations/destination/iceberg.v2/IcebergV2SpecTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg.v2 | ||
|
||
import io.airbyte.cdk.load.spec.SpecTest | ||
|
||
class IcebergV2SpecTest : SpecTest() |
14 changes: 14 additions & 0 deletions
14
...st-integration/kotlin/io/airbyte/integrations/destination/iceberg.v2/IcebergV2TestUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg.v2 | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
|
||
object IcebergV2TestUtil { | ||
// TODO this is just here as an example, we should remove it + add real configs | ||
const val SOME_RANDOM_S3_CONFIG = "secrets/s3_dest_v2_minimal_required_config.json" | ||
fun getConfig(configPath: String): String = Files.readString(Path.of(configPath)) | ||
} |
33 changes: 33 additions & 0 deletions
33
...t-integration/kotlin/io/airbyte/integrations/destination/iceberg.v2/IcebergV2WriteTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.integrations.destination.iceberg.v2 | ||
|
||
import io.airbyte.cdk.load.test.util.FakeDataDumper | ||
import io.airbyte.cdk.load.test.util.NoopDestinationCleaner | ||
import io.airbyte.cdk.load.test.util.NoopExpectedRecordMapper | ||
import io.airbyte.cdk.load.write.BasicFunctionalityIntegrationTest | ||
import io.airbyte.cdk.load.write.StronglyTyped | ||
import org.junit.jupiter.api.Disabled | ||
|
||
abstract class IcebergV2WriteTest(path: String) : | ||
BasicFunctionalityIntegrationTest( | ||
IcebergV2TestUtil.getConfig(path), | ||
IcebergV2Specification::class.java, | ||
FakeDataDumper, | ||
NoopDestinationCleaner, | ||
NoopExpectedRecordMapper, | ||
// TODO let's validate these - I'm making some assumptions about how iceberg works | ||
isStreamSchemaRetroactive = true, | ||
supportsDedup = false, | ||
stringifySchemalessObjects = true, | ||
promoteUnionToObject = true, | ||
preserveUndeclaredFields = false, | ||
commitDataIncrementally = false, | ||
allTypesBehavior = StronglyTyped(), | ||
) | ||
|
||
// TODO replace this with a real test class for an actual config | ||
@Disabled("nowhere even close to functional") | ||
class FakeIcebergWriteTest : IcebergV2WriteTest(IcebergV2TestUtil.SOME_RANDOM_S3_CONFIG) |
14 changes: 14 additions & 0 deletions
14
...connectors/destination-iceberg-v2/src/test-integration/resources/expected-spec-cloud.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"documentationUrl" : "https://docs.airbyte.com/integrations/destinations/s3", | ||
"connectionSpecification" : { | ||
"$schema" : "http://json-schema.org/draft-07/schema#", | ||
"title" : "Iceberg V2 Destination Spec", | ||
"type" : "object", | ||
"additionalProperties" : true, | ||
"properties" : { } | ||
}, | ||
"supportsIncremental" : true, | ||
"supportsNormalization" : false, | ||
"supportsDBT" : false, | ||
"supported_destination_sync_modes" : [ "append" ] | ||
} |
14 changes: 14 additions & 0 deletions
14
...s/connectors/destination-iceberg-v2/src/test-integration/resources/expected-spec-oss.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"documentationUrl" : "https://docs.airbyte.com/integrations/destinations/s3", | ||
"connectionSpecification" : { | ||
"$schema" : "http://json-schema.org/draft-07/schema#", | ||
"title" : "Iceberg V2 Destination Spec", | ||
"type" : "object", | ||
"additionalProperties" : true, | ||
"properties" : { } | ||
}, | ||
"supportsIncremental" : true, | ||
"supportsNormalization" : false, | ||
"supportsDBT" : false, | ||
"supported_destination_sync_modes" : [ "append" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters