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

fix(export): Fix facet export of reference type postings to JSON format #7744

Merged
merged 6 commits into from
Apr 27, 2021

Conversation

ahsanbarkati
Copy link
Contributor

@ahsanbarkati ahsanbarkati commented Apr 22, 2021

Consider this data:

_:blank-0 <name> "Carol" (initial="C") .
_:blank-0 <dgraph.type> "Person" .
_:blank-0 <friend> _:blank-1 (close="yes") .
_:blank-1 <name> "Daryl" .
_:blank-1 <dgraph.type> "Person" .

Currently export generates this JSON for it:

[
  {"uid":"0x1","name":"Carol","name|initial":"C"},
  {"uid":"0x2","name":"Daryl"},
  {"uid":"0x1","friend":[{"uid":"0x2"}],"friend|close":"yes"},
  {"uid":"0x1","dgraph.type":"Person"},
  {"uid":"0x2","dgraph.type":"Person"}
]

The above generated JSON is not right. In {"uid":"0x1","friend":[{"uid":"0x2"}],"friend|close":"yes"}, , we do not keep a mapping about the facet belongs to which uid in the list. And when this data is loaded, the facets gets lost.

After this change we will get this:

[
  {"uid":"0x1","name":"Carol","name|initial":"C"},
  {"uid":"0x2","name":"Daryl"},
  {"uid":"0x1","friend":[{"uid":"0x2", "friend|close":"yes"}]},
  {"uid":"0x1","dgraph.type":"Person"},
  {"uid":"0x2","dgraph.type":"Person"}
]

This change is Reviewable

Copy link
Contributor

@pawanrawal pawanrawal left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @manishrjain and @vvbalaji-dgraph)

@ahsanbarkati ahsanbarkati merged commit aff03e5 into master Apr 27, 2021
@ahsanbarkati ahsanbarkati deleted the ahsan/export-facet branch April 27, 2021 08:27
ahsanbarkati added a commit that referenced this pull request Apr 27, 2021
…at (#7744)

Fix the export of facets in the JSON format and add integration
test for export for various cases of facets.

(cherry picked from commit aff03e5)
ahsanbarkati added a commit that referenced this pull request Apr 27, 2021
…at (#7744) (#7756)

Fix the export of facets in the JSON format and add integration
test for export for various cases of facets.

(cherry picked from commit aff03e5)
ahsanbarkati added a commit that referenced this pull request May 27, 2021
…at (#7744) (#7756)

Fix the export of facets in the JSON format and add integration
test for export for various cases of facets.

(cherry picked from commit aff03e5)
(cherry picked from commit ea927fb)
ahsanbarkati added a commit that referenced this pull request May 27, 2021
…at (#7744) (#7756)

Fix the export of facets in the JSON format and add integration
test for export for various cases of facets.

(cherry picked from commit aff03e5)
(cherry picked from commit ea927fb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants