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

apply filterStringFunction when customIndexFn #3992

Merged
merged 1 commit into from
Sep 18, 2019

Conversation

sjhewitt
Copy link
Contributor

@sjhewitt sjhewitt commented Sep 13, 2019

fix for #3991


This change is Reviewable

@sjhewitt sjhewitt requested review from manishrjain and a team as code owners September 13, 2019 19:11
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ A review job has been created and sent to the PullRequest network.


@sjhewitt you can click here to see the review status or cancel the code review job.

@CLAassistant
Copy link

CLAassistant commented Sep 13, 2019

CLA assistant check
All committers have signed the CLA.

Copy link

@pullrequest pullrequest bot 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 left an inline comment regarding bounds checks in the customIndexedFn.


Reviewed with ❤️ by PullRequest

case customIndexFn:
filter.tokens = arg.srcFn.tokens
filter.match = defaultMatch
filter.tokName = arg.q.SrcFunc.Args[0]
Copy link

Choose a reason for hiding this comment

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

Would len(arg.q.SrcFunc.Args) be valuable here to guard against indexing this when nothing is present, or simply overkill?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured this has already been checked by the parseSrcFn and must be valid in order to reach this point

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. It looks good but I'll let @pawanrawal take another look since he's more familiar with Dgraph's query code.

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @manishrjain and @pullrequest[bot])


worker/task.go, line 1405 at r1 (raw file):

Previously, pullrequest[bot] wrote…

Would len(arg.q.SrcFunc.Args) be valuable here to guard against indexing this when nothing is present, or simply overkill?

Let's add a check just to be sure. Just return an error if Args is nil or of length 0.

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.

Nice work @sjhewitt. Thanks for your contribution.

The PR looks good but the test case result doesn't look right. Also noticed that these tests are not being skipped in CI https://teamcity.dgraph.io/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=23939&_focus=15583. @danielmai could you please have a look why that is the case?

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @manishrjain, @pullrequest[bot], and @sjhewitt)


systest/plugin_test.go, line 150 at r1 (raw file):

				}}`, `
				{ "q": [
					{ "word": "marine" }

Shouldn't this return airmen?

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

⚠️ Warning

PullRequest detected a force-push on this branch. This may have caused some information to be lost, and additional time may be required to complete review of the code. Read More

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.

:lgtm:

Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @manishrjain, @martinmr, @pawanrawal, @pullrequest[bot], and @sjhewitt)

@danielmai
Copy link
Contributor

Also noticed that these tests are not being skipped in CI

dgraph/test.sh

Line 58 in c6ecca1

Tests are always run with -short=true."

dgraph/test.sh

Lines 198 to 201 in c6ecca1

if [[ $TEST_SET == unit ]]; then
Info "Running only unit tests"
GO_TEST_OPTS+=( "-short=true" )
fi

We've always been setting -short=true via test.sh. We can remove so that these tests are run. The only reason only short tests ran was so that the test suite finished quicker. Now that we're running the tests somewhat in parallel, this is less of a concern, so they'll be OK to run now.

I'll open a PR to fix test script for CI.

danielmai added a commit that referenced this pull request Sep 16, 2019
As mentioned in #3992, the plugin tests were being skipped when running
tests via ./test.sh. This is because some tests were being skipped when
the -short=true flag is set for go test.

* The -short=true setting is now an option for test.sh, settable via
  ./test.sh --short. It is not set by default, so short tests are not
  skipped.
* Update usage text with all the current flags.
* Rename the test tag :full: to :systest: since systest tests are what
  gets run.
@danielmai
Copy link
Contributor

@sjhewitt TestPlugins now runs in CI with #4002 merged. You can merge the latest master to pick up the test changes.

@sjhewitt
Copy link
Contributor Author

@pawanrawal looks like the CI tests pass now

@pawanrawal pawanrawal merged commit 76a5e66 into dgraph-io:master Sep 18, 2019
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.

5 participants