-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Destination S3V2: Only fail on bad types for avro and parquet (parity… (
- Loading branch information
1 parent
8688072
commit 666e847
Showing
21 changed files
with
334 additions
and
171 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
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
46 changes: 46 additions & 0 deletions
46
...core/load/src/test/kotlin/io/airbyte/cdk/load/data/FailOnAllUnknownTypesExceptNullTest.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,46 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.load.data | ||
|
||
import com.fasterxml.jackson.databind.node.JsonNodeFactory | ||
import io.airbyte.cdk.load.test.util.Root | ||
import io.airbyte.cdk.load.test.util.SchemaRecordBuilder | ||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
|
||
class FailOnAllUnknownTypesExceptNullTest { | ||
@Test | ||
fun testBasicTypeBehavior() { | ||
val nullType = JsonNodeFactory.instance.objectNode().put("type", "null") | ||
val (inputSchema, expectedOutput) = | ||
SchemaRecordBuilder<Root>() | ||
.with(UnknownType(nullType)) | ||
.with( | ||
UnknownType( | ||
JsonNodeFactory.instance | ||
.objectNode() | ||
.set( | ||
"type", | ||
JsonNodeFactory.instance.arrayNode().add("null").add("null") | ||
) | ||
) | ||
) | ||
.build() | ||
FailOnAllUnknownTypesExceptNull().map(inputSchema).let { | ||
Assertions.assertEquals(expectedOutput, it) | ||
} | ||
} | ||
|
||
@Test | ||
fun `test throws on non-null unknown types`() { | ||
val (inputSchema, _) = | ||
SchemaRecordBuilder<Root>() | ||
.with(UnknownType(JsonNodeFactory.instance.objectNode().put("type", "whatever"))) | ||
.build() | ||
Assertions.assertThrows(IllegalStateException::class.java) { | ||
FailOnAllUnknownTypesExceptNull().map(inputSchema) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.