File tree 3 files changed +9
-2
lines changed
airbyte-cdk/java/airbyte-cdk
core/src/main/java/io/airbyte/cdk/integrations/base
main/java/io/airbyte/integrations/base/destination/typing_deduping
test/java/io/airbyte/integrations/base/destination/typing_deduping
3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 5
5
package io .airbyte .cdk .integrations .base ;
6
6
7
7
import java .util .List ;
8
+ import java .util .Set ;
8
9
9
10
public final class JavaBaseConstants {
10
11
@@ -34,7 +35,7 @@ private JavaBaseConstants() {}
34
35
35
36
// Meta was introduced later, so to avoid triggering raw table soft-reset in v1->v2
36
37
// use this column list.
37
- public static final List <String > V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META = List .of (
38
+ public static final Set <String > V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META = Set .of (
38
39
COLUMN_NAME_AB_RAW_ID ,
39
40
COLUMN_NAME_AB_EXTRACTED_AT ,
40
41
COLUMN_NAME_AB_LOADED_AT ,
Original file line number Diff line number Diff line change 5
5
package io .airbyte .integrations .base .destination .typing_deduping ;
6
6
7
7
import static io .airbyte .cdk .integrations .base .JavaBaseConstants .LEGACY_RAW_TABLE_COLUMNS ;
8
+ import static io .airbyte .cdk .integrations .base .JavaBaseConstants .V2_RAW_TABLE_COLUMN_NAMES ;
8
9
import static io .airbyte .cdk .integrations .base .JavaBaseConstants .V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META ;
9
10
10
11
import io .airbyte .protocol .models .v0 .DestinationSyncMode ;
@@ -89,7 +90,10 @@ private boolean doesV1RawTableMatchExpectedSchema(final DialectTableDefinition e
89
90
* @param existingV2AirbyteRawTable the v2 raw table
90
91
*/
91
92
private void validateAirbyteInternalNamespaceRawTableMatchExpectedV2Schema (final DialectTableDefinition existingV2AirbyteRawTable ) {
92
- if (!schemaMatchesExpectation (existingV2AirbyteRawTable , V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META )) {
93
+ // Account for the fact that the meta column was added later, so skip the rebuilding of the raw
94
+ // table.
95
+ if (!(schemaMatchesExpectation (existingV2AirbyteRawTable , V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META ) ||
96
+ schemaMatchesExpectation (existingV2AirbyteRawTable , V2_RAW_TABLE_COLUMN_NAMES ))) {
93
97
throw new UnexpectedSchemaException ("Destination V2 Raw Table does not match expected Schema" );
94
98
}
95
99
}
Original file line number Diff line number Diff line change 5
5
package io .airbyte .integrations .base .destination .typing_deduping ;
6
6
7
7
import static io .airbyte .cdk .integrations .base .JavaBaseConstants .LEGACY_RAW_TABLE_COLUMNS ;
8
+ import static io .airbyte .cdk .integrations .base .JavaBaseConstants .V2_RAW_TABLE_COLUMN_NAMES ;
8
9
import static io .airbyte .cdk .integrations .base .JavaBaseConstants .V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META ;
9
10
import static org .mockito .ArgumentMatchers .any ;
10
11
@@ -97,6 +98,7 @@ public static BaseDestinationV1V2Migrator makeMockMigrator(final boolean v2Names
97
98
Mockito .when (migrator .doesAirbyteInternalNamespaceExist (any ())).thenReturn (v2NamespaceExists );
98
99
final var existingTable = v2TableExists ? Optional .of ("v2_raw" ) : Optional .empty ();
99
100
Mockito .when (migrator .getTableIfExists ("raw" , "raw_table" )).thenReturn (existingTable );
101
+ Mockito .when (migrator .schemaMatchesExpectation ("v2_raw" , V2_RAW_TABLE_COLUMN_NAMES )).thenReturn (false );
100
102
Mockito .when (migrator .schemaMatchesExpectation ("v2_raw" , V2_RAW_TABLE_COLUMN_NAMES_WITHOUT_META )).thenReturn (v2RawSchemaMatches );
101
103
102
104
Mockito .when (migrator .convertToV1RawName (any ())).thenReturn (new NamespacedTableName ("v1_raw_namespace" , "v1_raw_table" ));
You can’t perform that action at this time.
0 commit comments