Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 Destination-gcs handling v1 data protocol #20635

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

suhomud
Copy link
Contributor

@suhomud suhomud commented Dec 19, 2022

What

Destination gcs protocol V1 support

How

The main change is done in Destination s3 protocol update (#20088) plus json-avro-converter (airbytehq/json-avro-converter#17)
This PR has next change:

  • integration tests are using V1 dataset
  • minor changes for gcs test's comparator
    • base64 decoding for test comparison.
    • time comparison.

Recommended reading order

  1. GcsAvroTestDataComparator.java
  2. GcsAvroParquetDestinationAcceptanceTest.java - V1 protocol dataset $ref type
  3. GcsCsvDestinationAcceptanceTest.java - V1 protocol dataset plus $ref type
  4. for others - V1 protocol dataset

🚨 User Impact 🚨

No impact

@suhomud
Copy link
Contributor Author

suhomud commented Dec 19, 2022

/test connector=connectors/destination-gcs

🕑 connectors/destination-gcs https://github.com/airbytehq/airbyte/actions/runs/3730271587
✅ connectors/destination-gcs https://github.com/airbytehq/airbyte/actions/runs/3730271587
No Python unittests run

Build Passed

Test summary info:

All Passed

@suhomud
Copy link
Contributor Author

suhomud commented Dec 19, 2022

/test connector=connectors/destination-snowflake

🕑 connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/3730276998
✅ connectors/destination-snowflake https://github.com/airbytehq/airbyte/actions/runs/3730276998
Python tests coverage:

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 595    400    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1441    629    56%

Build Passed

Test summary info:

All Passed

@suhomud
Copy link
Contributor Author

suhomud commented Dec 19, 2022

/test connector=connectors/destination-bigquery

🕑 connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3730287260
✅ connectors/destination-bigquery https://github.com/airbytehq/airbyte/actions/runs/3730287260
Python tests coverage:

Name                                                              Stmts   Miss  Cover
-------------------------------------------------------------------------------------
normalization/transform_config/__init__.py                            2      0   100%
normalization/transform_catalog/reserved_keywords.py                 14      0   100%
normalization/transform_catalog/__init__.py                           2      0   100%
normalization/destination_type.py                                    14      0   100%
normalization/__init__.py                                             4      0   100%
normalization/transform_catalog/destination_name_transformer.py     166      8    95%
normalization/transform_catalog/table_name_registry.py              174     34    80%
normalization/transform_config/transform.py                         189     48    75%
normalization/transform_catalog/utils.py                             51     14    73%
normalization/transform_catalog/dbt_macro.py                         22      7    68%
normalization/transform_catalog/catalog_processor.py                147     80    46%
normalization/transform_catalog/transform.py                         61     38    38%
normalization/transform_catalog/stream_processor.py                 595    400    33%
-------------------------------------------------------------------------------------
TOTAL                                                              1441    629    56%

Build Passed

Test summary info:

All Passed

@suhomud
Copy link
Contributor Author

suhomud commented Dec 19, 2022

/test connector=connectors/destination-bigquery-denormalized

🕑 connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3730964775
❌ connectors/destination-bigquery-denormalized https://github.com/airbytehq/airbyte/actions/runs/3730964775
🐛 https://gradle.com/s/w36scx4jlpq6a

Build Failed

Test summary info:

Could not find result summary

@suhomud suhomud linked an issue Dec 19, 2022 that may be closed by this pull request
@suhomud suhomud marked this pull request as ready for review December 19, 2022 14:35
@suhomud suhomud requested a review from a team as a code owner December 19, 2022 14:35
Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glad to see this didn't require any changes to runtime code - code reuse 💯

@@ -85,7 +91,7 @@ private JsonNode getJsonNode(final AirbyteStream stream, final String name) {
}

private Set<Type> getExpectedSchemaType(final JsonNode fieldDefinition) {
final JsonNode typeProperty = fieldDefinition.get("type");
final JsonNode typeProperty = fieldDefinition.get("type") == null ? fieldDefinition.get("$ref") : fieldDefinition.get("type");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, suggestion to maybe considering a comment here that notes that $ref is utilized as a result of the version migration and that type is the original standard since tests are a great way to maintain knowledge of business context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is still valid since we have object and arrays (for example: "type": ["object"]) in schemas but it will be worth to mentioned the $ref in the comments since it's not obvious. Thanks for suggesting!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, both changes look great, and thanks for making this code re-useable

@@ -33,4 +36,23 @@ protected boolean compareDateTimeValues(String airbyteMessageValue, String desti
return super.compareDateTimeValues(airbyteMessageValue, format.format(dateTime));
}

@Override
protected boolean compareTime(final String airbyteMessageValue, final String destinationValue) {
var destinationDate = LocalTime.ofInstant(getInstantFromEpoch(destinationValue), ZoneOffset.UTC);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: instead of var have this be LocalTime so it's clear that the difference between this super.compareTime and this child method is that this is doing a LocalTime comparison vs String comparison

Copy link
Contributor

@ryankfu ryankfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comments but nothing blocking, great usage of code reuse

@suhomud
Copy link
Contributor Author

suhomud commented Dec 20, 2022

The fixed tests for bigquery-denormalized #20640
Will re-run after code freeze is finished

@suhomud
Copy link
Contributor Author

suhomud commented Jan 18, 2023

/test connector=connectors/destination-gcs

🕑 connectors/destination-gcs https://github.com/airbytehq/airbyte/actions/runs/3945556774
✅ connectors/destination-gcs https://github.com/airbytehq/airbyte/actions/runs/3945556774
No Python unittests run

Build Passed

Test summary info:

All Passed

@suhomud suhomud merged commit 036c46d into master Jan 18, 2023
@suhomud suhomud deleted the suhomud/17646_destination_gcs_data_types_protocol_v1 branch January 18, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update destination-gcs to handle the new data types protocol
5 participants