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 S3-Glue: fix parsing empty object in schema #19907

Merged
merged 9 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
- name: S3 Glue
destinationDefinitionId: 471e5cab-8ed1-49f3-ba11-79c687784737
dockerRepository: airbyte/destination-s3-glue
dockerImageTag: 0.1.0
dockerImageTag: 0.1.1
documentationUrl: https://docs.airbyte.com/integrations/destinations/s3-glue
releaseStage: alpha
- name: SFTP-JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ ENV APPLICATION destination-s3-glue

COPY --from=build /airbyte /airbyte

LABEL io.airbyte.version=0.1.0
LABEL io.airbyte.version=0.1.1
LABEL io.airbyte.name=airbyte/destination-s3-glue
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,17 @@ private String transformSchemaRecursive(JsonNode jsonNode) {
yield arrayType;
}
case "object" -> {
String objectType = "struct<";
Map<String, JsonNode> properties = objectMapper.convertValue(jsonNode.get("properties"), new TypeReference<>() {});
String columnTypes = properties.entrySet().stream()
.map(p -> p.getKey() + " : " + transformSchemaRecursive(p.getValue()))
.collect(Collectors.joining(","));
objectType += (columnTypes + ">");
yield objectType;
if (jsonNode.has("properties")) {
String objectType = "struct<";
Map<String, JsonNode> properties = objectMapper.convertValue(jsonNode.get("properties"), new TypeReference<>() {});
String columnTypes = properties.entrySet().stream()
.map(p -> p.getKey() + " : " + transformSchemaRecursive(p.getValue()))
.collect(Collectors.joining(","));
objectType += (columnTypes + ">");
yield objectType;
} else {
yield "string";
}
}
default -> type;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Preconditions;

import io.airbyte.commons.functional.CheckedBiConsumer;
import io.airbyte.commons.functional.CheckedBiFunction;
import io.airbyte.commons.json.Jsons;
import io.airbyte.integrations.base.AirbyteMessageConsumer;
import io.airbyte.integrations.base.AirbyteStreamNameNamespacePair;

import io.airbyte.integrations.destination.NamingConventionTransformer;
import io.airbyte.integrations.destination.buffered_stream_consumer.BufferedStreamConsumer;
import io.airbyte.integrations.destination.buffered_stream_consumer.OnCloseFunction;
Expand All @@ -22,6 +23,7 @@
import io.airbyte.integrations.destination.s3.WriteConfig;
import io.airbyte.protocol.models.AirbyteMessage;
import io.airbyte.protocol.models.AirbyteStream;
import io.airbyte.protocol.models.AirbyteStreamNameNamespacePair;
import io.airbyte.protocol.models.ConfiguredAirbyteCatalog;
import io.airbyte.protocol.models.ConfiguredAirbyteStream;
import io.airbyte.protocol.models.DestinationSyncMode;
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/destinations/s3-glue.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,4 +245,5 @@ Output files can be compressed. The default option is GZIP compression. If compr

| Version | Date | Pull Request | Subject |
| :------ | :--------- | :------------------------------------------------------- | :------------- |
| 0.1.1 | 2022-12-13 | [19907](https://github.com/airbytehq/airbyte/pull/19907) | Fix parsing empty object in schema |
| 0.1.0 | 2022-11-17 | [18695](https://github.com/airbytehq/airbyte/pull/18695) | Initial Commit |