Skip to content

Facet encoding breaks with loop:false #4168

@campoy

Description

@campoy

What version of Dgraph are you using?

1.1.0

Have you tried reproducing the issue with the latest release?

yes

What is the hardware spec (RAM, OS)?

n/a

Steps to reproduce the issue (command/config used to run Dgraph).

Given this fully connected graph:

{
  set {
    _:a <name> "A" .
    _:b <name> "B" .
    _:c <name> "C" .
    _:d <name> "D" .

    _:a <connects> _:b  (number=1) .
    _:a <connects> _:c  (number=2) .
    _:a <connects> _:d  (number=3) .

    _:c <connects> _:a  (number=4) .
    _:c <connects> _:b  (number=5) .
    _:c <connects> _:d  (number=6) .

    _:b <connects> _:a  (number=7) .
    _:b <connects> _:c  (number=8) .
    _:b <connects> _:d  (number=9) .

    _:d <connects> _:a  (number=10) .
    _:d <connects> _:b  (number=11) .
    _:d <connects> _:c  (number=12) .
  }
}

Run the following query (assuming "A" was given uid 0x1)

{
  dcs(func: uid(0x1)) @recurse(depth: 4, loop:false) {
    dcname
    connects @facets(number)
  }
}

Expected behaviour and actual result.

I would expect to see all of the nodes connected to each other with unique number values for their facets. Instead I get this:

{
  "data": {
    "dcs": [
      {
        "connects": [
          {
            "connects": [
              {
                "connects|number": [
                  1,
                  7
                ]
              },
              {
                "connects|number": [
                  4,
                  8
                ]
              },
              {
                "connects|number": [
                  10,
                  9
                ]
              }
            ],
            "connects|number": 1
          },
          {
            "connects": [
              {
                "connects|number": [
                  1,
                  4
                ]
              },
              {
                "connects|number": [
                  7,
                  5
                ]
              },
              {
                "connects|number": [
                  10,
                  6
                ]
              }
            ],
            "connects|number": 2
          },
          {
            "connects": [
              {
                "connects|number": [
                  1,
                  10
                ]
              },
              {
                "connects|number": [
                  7,
                  11
                ]
              },
              {
                "connects|number": [
                  4,
                  12
                ]
              }
            ],
            "connects|number": 3
          }
        ]
      }
    ]
  }
}

Note that adding a second facet fixes the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/facetsIssues related to face handling, querying, etc.area/querylang/recurseRelated to the recurse directive.exp/intermediateFixing this requires some experience with the project.kind/bugSomething is broken.priority/P1Serious issue that requires eventual attention (can wait a bit)status/acceptedWe accept to investigate/work on it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions