Skip to content

Dgraph Live cannot parse negative years #5778

@EnricoMi

Description

@EnricoMi

What version of Dgraph are you using?

v20.03.3

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

Unrelated

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

Start a fresh temporary dgraph instance with docker:

docker run -it --rm dgraph/standalone:v20.03.3 /bin/bash

Inside, run the following commands:

dgraph zero > /dev/null 2>&1 < /dev/null &
dgraph alpha --lru_mb 1024 > /dev/null 2>&1 < /dev/null &
echo "<a> <p> \"-0001-02-03\"^^<http://www.w3.org/2001/XMLSchema#date> ." > a.rdf

Wait a bit until dgraph alpha is up, then

dgraph live --files a.rdf

It fails on the date value with:

Error while processing data file "a.rdf": During parsing chunk in processLoadFile: while parsing line "<a> <p> \"-0001-02-03\"^^<http://www.w3.org/2001/XMLSchema#date> .\n": parsing time "-0001-02-03" as "2006-01-02T15:04:05": cannot parse "-0001-02-03" as "2006"

Negative years are defined by XMLSchema as BC: https://www.w3.org/TR/xmlschema-2/#dateTime.

Expected behaviour and actual result.

The example date should be parsed as -0001-02-03, i.e. 3rd of February of year 1 BC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/parsingIssues related to the parser or lexer.exp/intermediateFixing this requires some experience with the project.investigateRequires further investigationkind/bugSomething is broken.status/more-info-neededThe issue has been sent back to the reporter asking for clarificationsstatus/needs-attentionThis issue needs more eyes on it, more investigation might be required before accepting/rejecting it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions