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

Filter fix #163

Merged
merged 4 commits into from Dec 17, 2018
Merged

Filter fix #163

merged 4 commits into from Dec 17, 2018

Conversation

floriankramer
Copy link
Member

This pr removes the --patterns / -P option and replaces them with --no-patterns, making patterns the default option.
Furthermore it adds an aditional literal parsing step, that ensures literals are properly formatted regarding the count, positioning and escaping of qutation marks (as requested in #160).
Finally it adds support for filters on result tables that have more than 5 columns, presumably fixing #162.

@floriankramer floriankramer changed the title Filer fix Filter fix Dec 15, 2018
Copy link
Member

@niklas88 niklas88 left a comment

Choose a reason for hiding this comment

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

I've requested some some changes but overall this (again) looks great. I'm glad we're making --patterns default and will have proper literals. Also I feel like fixing the undocumented limitation of FILTER on 5 columns might fix eve more subtle problems.

popd
fi

# Launch the Server using the freshly baked index. Can't simply use a subshell here because
# then we can't easily get the SERVER_PID out of that subshell
pushd "$BINARY_DIR"
echo "Launching server from path $(pwd)"
./ServerMain -i "$INDEX" -p 9099 -t -a --patterns &> server_log.txt &
./ServerMain -i "$INDEX" -p 9099 -t -a &> server_log.txt &
SERVER_PID=$!
popd

Copy link
Member

@niklas88 niklas88 Dec 17, 2018

Choose a reason for hiding this comment

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

Can you also remove the -P here: https://github.com/ad-freiburg/QLever/blob/master/Dockerfile#L39 otherwise it will break docker run without additional arguments

Copy link
Member Author

Choose a reason for hiding this comment

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

Done


optind = 1;
// Process command line arguments.
while (true) {
int c = getopt_long(argc, argv, "i:p:j:tauhPml", options, NULL);
int c = getopt_long(argc, argv, "i:p:j:tauhml", options, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

Either keep "P" for no patterns or remove "P" in line 33

Copy link
Member Author

Choose a reason for hiding this comment

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

The way I understand getopt we need a val in line 33 which will then be the value that getopt returns. If yout hink it helps readability I could swap out 'P' for a val;ue outside the ascii range (e.g. 128).

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, no then it's fine

@@ -91,7 +92,7 @@ int main(int argc, char** argv) {
optind = 1;
// Process command line arguments.
while (true) {
int c = getopt_long(argc, argv, "q:Ii:tc:lahuP", options, NULL);
int c = getopt_long(argc, argv, "q:Ii:tc:lahu", options, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

same as above

return ValueReader<T>::get(l[lhs]) <
ValueReader<T>::get(r[lhs]);
});
res->insert(res->end(), lower, upper);
}
} else {
getEngine().filter(
*static_cast<vector<RT>*>(subRes->_fixedSizeData),
[lhs, rhs, &subRes](const RT& e) { return e[lhs] == rhs; }, res);
input, [lhs, rhs, &subRes](const RT& e) { return e[lhs] == rhs; },
Copy link
Member

Choose a reason for hiding this comment

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

I think that lambda doesn't actually need the &subRes

bool onlyAddTextIndex = false;
bool keepTemporaryFiles = false;
optind = 1;
// Process command line arguments.
while (true) {
int c = getopt_long(argc, argv, "t:n:i:w:d:alT:K:PhAks:N", options, NULL);
int c = getopt_long(argc, argv, "t:n:i:w:d:alT:K:hAks:N", options, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

same as before


// _____________________________________________________________________________
string SparqlParser::parseLiteral(const string& literal, bool isEntireString,
size_t off) {
Copy link
Member

Choose a reason for hiding this comment

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

can you add size_t off /*defaults to 0*/) so this is clear without looking into the header?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

* If isEntireString is true an exception is thrown if the entire string
* is not a literal (apart from any leading and trailing whitespace).
**/
static string parseLiteral(const string& literal, bool isEntireString,
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for this method to SparqlParserTest

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@niklas88
Copy link
Member

niklas88 commented Dec 17, 2018

Ok I can confirm that this fixes the behavior described in #162 and the example query mentioned there.

Copy link
Member

@niklas88 niklas88 left a comment

Choose a reason for hiding this comment

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

LGTM pending Travis

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