Skip to content

Added array support for ndjson inputcodec#5875

Merged
dlvenable merged 2 commits into
opensearch-project:mainfrom
sivagnanam-arumugam:array-support-ndjson-inputcodec
Jul 16, 2025
Merged

Added array support for ndjson inputcodec#5875
dlvenable merged 2 commits into
opensearch-project:mainfrom
sivagnanam-arumugam:array-support-ndjson-inputcodec

Conversation

@sivagnanam-arumugam
Copy link
Copy Markdown
Contributor

@sivagnanam-arumugam sivagnanam-arumugam commented Jul 4, 2025

Description

Array support for ndjson input codec,
Array line is handled in logstash json_lines codec, So added the support to data prepper.

Issues Resolved

Resolves #5874

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Copy Markdown
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

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

Thanks for providing this change. Looks good to me.

Copy link
Copy Markdown
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

void parse_with_array_of_objects_asserts_number_of_objects() throws IOException {
final NdjsonInputCodec objectUnderTest = createObjectUnderTest();

final String jsonArray = "[{\"key1\":\"value1\"},{\"key2\":\"value2\"}]";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this change support reading multiple arrays from different lines?

[{\"key1\":\"value1\"},{\"key2\":\"value2\"}]
[{\"key3\":\"value3\"},{\"key4\":\"value4\"}]

If so, we should test this too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added multiple array support and added unit test cases.
Added signed-off-by commit message.

Signed-off-by: sivagnanam-arumugam <sivagnanam.arumugam@freshworks.com>
Added test cases for multiple array support

Signed-off-by: sivagnanam-arumugam <sivagnanam.arumugam@freshworks.com>
@sivagnanam-arumugam sivagnanam-arumugam force-pushed the array-support-ndjson-inputcodec branch from 27c9f6e to 366f512 Compare July 15, 2025 09:56
Copy link
Copy Markdown
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

Thank you @sivagnanam-arumugam for this contribution and follow up changes!

@KarstenSchnitter , Would you like to take another look?

Copy link
Copy Markdown
Collaborator

@KarstenSchnitter KarstenSchnitter left a comment

Choose a reason for hiding this comment

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

Still looks good to me. Thanks for the contribution.

@dlvenable dlvenable merged commit 65e7033 into opensearch-project:main Jul 16, 2025
49 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array support in ndjson input codec

3 participants