-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 Redshift: fixed array contents verification for SUPER #13069
Destination Redshift: fixed array contents verification for SUPER #13069
Conversation
@marcosmarxm @alexandertsukanov FYI - not a regression in the last PR, but one more edge case that I missed. |
} else if (node.isArray()) { | ||
final Map<String, Object> output = new HashMap<>(); | ||
final int arrayLen = node.size(); | ||
for (int i = 0; i < arrayLen; i++) { | ||
final String field = String.format("[%d]", i); | ||
final JsonNode value = node.get(i); | ||
mergeMaps(output, field, flatten(value)); | ||
} | ||
return output; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @adam-bloom but can you add a unit test for this? I'll request the team to review it becsause the change can impact more than just Redshift.
Sure @marcosmarxm. There weren't any unit tests for
Again, let me know if anyone thinks there is a potential impact to behavior elsewhere, and I can make this optional behavior in |
4a0c874
to
5ec2047
Compare
@adam-bloom looks like some conflicts with the master, could you fix them after I will run the tests? Thanks. |
5ec2047
to
c09f683
Compare
@alexandertsukanov resolved |
/test connector=connectors/destination-redshift
Build FailedTest summary info:
|
@alexandertsukanov looks like the failure was in dbt/normalization. Is that test currently passing on master? Or do you think that there's a side-effect of the other use of |
Hi @alexandertsukanov @marcosmarxm - do either of you have suggestions for next steps? I don't see an obvious cause/relationship for the test that failed, and I cannot run the tests locally to verify if this test behavior changed with this change. I'm hoping to get this PR closed out soon, but don't know how to move it forward right now. |
@adam-bloom I see normalization tests are failing, let me ask somebody from Python team to take a look |
@adam-bloom please merge latest |
c09f683
to
bc9aa13
Compare
@grubberr easy enough, done! @alexandertsukanov @marcosmarxm can one of you kick of another test run for me, thanks. |
/test connector=connectors/destination-redshift
Build PassedTest summary info:
|
/publish connector=connectors/destination-redshift
|
What
Follow up to #12940. That solution relies on
Jsons.flatten
, which previously did not actually flatten arrays, but rather just converted them to strings. Redshift can store arrays within a SUPER.How
Added a case to
flatten
to handle arrays. This function is only used one other location:airbyte/airbyte-scheduler/persistence/src/main/java/io/airbyte/scheduler/persistence/job_tracker/JobTracker.java
Line 218 in a1b1c1c
As far as I can tell, that case (enum/const) should never encounter an array, so I do not believe adding this handling will result in any other negative consequences. Someone with more knowledge of the codebase than me, feel free to disagree! I can always add a switch to enable this behavior.
When flatten encounters an array, it will now flatten it into a map with keys
[<index>]
and the corresponding values. This should allow flatten to truly flatten arbitrary data.As an example:
would have previously been flattened to:
{"foo": "[{\"blue\": \"apple\"}]"}
It will now flatten to:
{"foo.[0].blue": "apple"}
Recommended reading order
x.java
y.python
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereTests
Unit
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.