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

Improve parsing of numeric literals in the Sparql parser #726

Merged
merged 6 commits into from Aug 8, 2022

Conversation

Qup42
Copy link
Member

@Qup42 Qup42 commented Aug 6, 2022

Numeric Literals are now parsed into variant<int64_t, double>. Cleaned up the code that previously handled the numeric literals Any. AFAIK to be standard compliant we'd need integers with arbitrary size. So removing 1 Bit in the unsigned case shouldn't make that big of a difference. Even more so since they already were converted to int64_t in some cases.

TODO:

  • touch up of the NumericLiterals tests

@joka921
Copy link
Member

joka921 commented Aug 7, 2022

Yes, QLever will (for efficiency reasons) probably never implement arbitrary precision, and we currently even lose more than 1 bit (currently 4) in the implementation (but this might not be forever).

Copy link
Member

@joka921 joka921 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 very much,
I think all of my comments are minor, the general design is already very good!
Most notably, while reviewing this I have found once again how hard it is to do stuff properly .

src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
test/SparqlAntlrParserTest.cpp Outdated Show resolved Hide resolved
test/SparqlAntlrParserTest.cpp Show resolved Hide resolved
test/SparqlAntlrParserTest.cpp Outdated Show resolved Hide resolved
src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

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

Very nice and much cleaner,
only two small cleanup suggestions.

src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
src/parser/sparqlParser/SparqlQleverVisitor.cpp Outdated Show resolved Hide resolved
Copy link
Member

@joka921 joka921 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 very much, this looks much cleaner now.
I'll have a look at that test failure (I am sure that it's nor your fault),
and then I'll merge this.

@joka921 joka921 changed the title Parse NumericLiterals typesafe as variant<int64_t, double> Improve parsing of numeric literals Aug 8, 2022
@joka921 joka921 changed the title Improve parsing of numeric literals Improve parsing of numeric literals in the Sparql parser Aug 8, 2022
@joka921 joka921 merged commit d8070b2 into ad-freiburg:master Aug 8, 2022
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.

None yet

2 participants