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

New OBJECTARRAY implementation for SqlQuery.resultFormat #8881

Closed
wants to merge 2 commits into from

Conversation

sbespalov
Copy link

@sbespalov sbespalov commented Nov 16, 2019

Fixes #8816.

Description

This PR has:

  • added unit tests or modified existing tests to cover new code paths.
  • been tested in a test Druid cluster.

Key changed/added classes in this PR
  • ResultFormat.WRAPPEDOBJECT
  • WrappedObjectWriter

@sbespalov sbespalov force-pushed the issues/8816 branch 4 times, most recently from ccfc5e0 to 9124d13 Compare November 19, 2019 13:32
@sbespalov
Copy link
Author

@vogievetsky can you please have a look?

@@ -100,6 +100,20 @@ public Writer createFormatter(final OutputStream outputStream, final ObjectMappe
{
return new ObjectLinesWriter(outputStream, jsonMapper);
}
},

OBJECTARRAY {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be added to the doc page docs/querying/sql.md. I don't think the name is very clear though. Maybe "wrappedObject" would be clearer in relation to the other ones?

  • object: array of objects
  • array: array of arrays
  • wrappedObject: object containing an array of objects

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@Override
public void writeResponseEnd() throws IOException
{
objectWriter.writeResponseEnd(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of adding the new ObjectWriter#writeResponseEnd(boolean flush) method, IMO it makes more sense to simply call jsonGenerator.writeEndArray(); here. It reduces coupling between this class and ObjectWriter.

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@sbespalov
Copy link
Author

@gianm thanks for review!
requested changes provided, but there is a confusion with Travis build which seems failed because of something unrelated with my changes.

@sbespalov
Copy link
Author

@gianm the build seems passed now
could you please have another look?

@stale
Copy link

stale bot commented May 22, 2020

This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@druid.apache.org list. Thank you for your contributions.

@stale stale bot added the stale label May 22, 2020
@stale
Copy link

stale bot commented Jun 20, 2020

This pull request/issue has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@stale stale bot closed this Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal to add new resultFormat - to wrap the Druid SQL JSON result array in a JSON object.
3 participants