forked from airbytehq/airbyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checkpointing: Worker use destination (instead of source) for state (a…
…irbytehq#3290) * Migrate BufferedStreamConsumer users (e.g. all JDBC destinations, MeiliSearch) (airbytehq#3473) * Add checkpointing test cases in Acceptance Tests (airbytehq#3473) * Add testing for emitting state in Destination Standard Test (airbytehq#3546) * Migrate BQ to support checkpointing (airbytehq#3546) * Migrate copy destinations support checkpointing (airbytehq#3547) * Checkpointing: Migrate CSV and JSON destinations (airbytehq#3551)
- Loading branch information
Showing
88 changed files
with
3,013 additions
and
639 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
58 changes: 58 additions & 0 deletions
58
airbyte-commons/src/main/java/io/airbyte/commons/util/MoreLists.java
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,58 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 Airbyte | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.airbyte.commons.util; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public class MoreLists { | ||
|
||
/** | ||
* @return returns empty optional if the list is empty or if the last element in the list is null. | ||
*/ | ||
public static <T> Optional<T> last(List<T> list) { | ||
if (list.isEmpty()) { | ||
return Optional.empty(); | ||
} | ||
return Optional.ofNullable(list.get(list.size() - 1)); | ||
} | ||
|
||
/** | ||
* Reverses a list by creating a new list with the same elements of the input list and then | ||
* reversing it. The input list will not be altered. | ||
* | ||
* @param list to reverse | ||
* @param <T> type | ||
* @return new list with elements of original reversed. | ||
*/ | ||
public static <T> List<T> reversed(List<T> list) { | ||
final ArrayList<T> reversed = new ArrayList<>(list); | ||
Collections.reverse(reversed); | ||
return reversed; | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
airbyte-commons/src/test/java/io/airbyte/commons/util/MoreListsTest.java
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,56 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 Airbyte | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.airbyte.commons.util; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import com.google.common.collect.Lists; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class MoreListsTest { | ||
|
||
@Test | ||
void testLast() { | ||
assertEquals(Optional.of(3), MoreLists.last(List.of(1, 2, 3))); | ||
assertEquals(Optional.empty(), MoreLists.last(List.of())); | ||
|
||
List<Integer> ints = new ArrayList<>(); | ||
ints.add(1); | ||
ints.add(2); | ||
ints.add(null); | ||
assertEquals(Optional.empty(), MoreLists.last(ints)); | ||
} | ||
|
||
@Test | ||
void testReverse() { | ||
final ArrayList<Integer> originalList = Lists.newArrayList(1, 2, 3); | ||
assertEquals(List.of(3, 2, 1), MoreLists.reversed(originalList)); | ||
assertEquals(List.of(1, 2, 3), originalList); | ||
} | ||
|
||
} |
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
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
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
25 changes: 25 additions & 0 deletions
25
airbyte-config/models/src/main/resources/types/ReplicationAttemptSummary.yaml
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 @@ | ||
--- | ||
"$schema": http://json-schema.org/draft-07/schema# | ||
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/ReplicationAttemptSummary.yaml | ||
title: ReplicationAttemptSummary | ||
type: object | ||
required: | ||
- status | ||
- recordsSynced | ||
- bytesSynced | ||
- startTime | ||
- endTime | ||
additionalProperties: false | ||
properties: | ||
status: | ||
"$ref": ReplicationStatus.yaml | ||
recordsSynced: | ||
type: integer | ||
minValue: 0 | ||
bytesSynced: | ||
type: integer | ||
minValue: 0 | ||
startTime: | ||
type: integer | ||
endTime: | ||
type: integer |
18 changes: 18 additions & 0 deletions
18
airbyte-config/models/src/main/resources/types/ReplicationOutput.yaml
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,18 @@ | ||
--- | ||
"$schema": http://json-schema.org/draft-07/schema# | ||
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/ReplicationOutput.yaml | ||
title: ReplicationOutput | ||
description: metadata summary of a replication attempt | ||
type: object | ||
additionalProperties: false | ||
required: | ||
- replicationAttemptSummary | ||
- state | ||
- output_catalog | ||
properties: | ||
replicationAttemptSummary: | ||
"$ref": ReplicationAttemptSummary.yaml | ||
state: | ||
"$ref": State.yaml | ||
output_catalog: | ||
existingJavaType: io.airbyte.protocol.models.ConfiguredAirbyteCatalog |
10 changes: 10 additions & 0 deletions
10
airbyte-config/models/src/main/resources/types/ReplicationStatus.yaml
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,10 @@ | ||
--- | ||
"$schema": http://json-schema.org/draft-07/schema# | ||
"$id": https://github.com/airbytehq/airbyte/blob/master/airbyte-config/models/src/main/resources/types/ReplicationStatus.yaml | ||
title: ReplicationStatus | ||
additionalProperties: false | ||
type: string | ||
enum: | ||
- completed | ||
- failed | ||
- cancelled |
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.