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

[ADJvoENI] apoc.schema.properties.distinct(Count) can hang #257

Merged
merged 3 commits into from Jan 13, 2023

Conversation

vga91
Copy link
Collaborator

@vga91 vga91 commented Nov 28, 2022

The test cases about 2nd scenario (ie fulltext indexes) is to be completed,
because it is to understand if the solution is good or not,
as it is in limbo between a bugfix and a feature.
That is, currently fulltext indexes are just not supported, hence the infinite hang.

To solve I created several if(isFulltexIndexes) { fullTextImplementation } else { currentImplementation}.

Alternatively we can do something like if(isFulltexIndexes) { skipCurrentFulltextIndex }, and document this.

But I think this is not a correct behavior, because as a user I would expect apoc.schema.properties to support any type of index, so maybe this is a bugfix and not a feature.

Wdyt?

@vga91 vga91 force-pushed the apoc.schema.properties-can-hang branch 2 times, most recently from 1df2697 to e78fda6 Compare November 28, 2022 13:30
@Lojjs Lojjs self-assigned this Nov 29, 2022
Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

I think it would be ok to add support for fulltext index (we have e.g. added support for new types of constraints recently), but the way you have implemented it will not work. I would say in case you manage to write a good filtering step, we can add the support, otherwise we can document that it is not supported and skip it rather than hang the procs.

Also had some ideas for tests and documentation, where the docs things can be added to the already existing Trello card

WITH *
CALL apoc.schema.properties.distinct("LabelNotExistent", "prop")
YIELD value RETURN *""",
r -> assertEquals(Collections.emptyList(), r.get("value"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally you can see your own writes in Cypher, so if possible I think this should return 2. If that is not feasible, I think we should at least document that properties created in the same transaction will not be shown. You could add it to this card perhaps: https://trello.com/c/MBiu8YIz/1827-improve-documentation-about-apocschemapropertiesdistinctcount

core/src/test/java/apoc/index/SchemaIndexTest.java Outdated Show resolved Hide resolved
core/src/test/java/apoc/index/SchemaIndexTest.java Outdated Show resolved Hide resolved
try {
indexSession = read.indexReadSession( indexDescriptor );
}catch (Exception e) {
// we skip indexScan if it's still populating
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be good to add something about this in the documentation. Should in that case be part of this card https://trello.com/c/MBiu8YIz/1827-improve-documentation-about-apocschemapropertiesdistinctcount which is about adding that you need an index for these procedures

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I missed this point. I added it as a checklist's item

core/src/test/java/apoc/index/SchemaIndexTest.java Outdated Show resolved Hide resolved
core/src/main/java/apoc/index/SchemaIndex.java Outdated Show resolved Hide resolved
@jexp
Copy link
Member

jexp commented Dec 15, 2022

@Lojjs @vga91 what's the status of this one?

@Lojjs
Copy link
Contributor

Lojjs commented Dec 16, 2022

@Lojjs @vga91 what's the status of this one?

I'm waiting for Giuseppe to respond to my review comments, but I think he had more pressing things to do around triggers

@vga91
Copy link
Collaborator Author

vga91 commented Dec 16, 2022

Yes, I've started making the various changes,
but at this moment I've left it aside to complete the pr of the triggers in 5.x.

I'll finish this pr asap

@vga91 vga91 force-pushed the apoc.schema.properties-can-hang branch 2 times, most recently from d2f2493 to c0adb5a Compare January 9, 2023 09:36
Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

I think the behaviour is OK now, but there is still some edge cases users might be surprised over. Take a look at my new comments and let me know what you think. I can collect all docs improvements into a checklist on the already existing docs card if you like

core/src/main/java/apoc/index/SchemaIndex.java Outdated Show resolved Hide resolved
core/src/test/java/apoc/index/SchemaIndexTest.java Outdated Show resolved Hide resolved
Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

I think this looks good now, please backport to 4.4 as well

@vga91 vga91 force-pushed the apoc.schema.properties-can-hang branch from 3bd7141 to 11e1c00 Compare January 11, 2023 08:24
@vga91 vga91 force-pushed the apoc.schema.properties-can-hang branch from 11e1c00 to 2766d1e Compare January 12, 2023 16:23
@vga91 vga91 merged commit 99a2864 into dev Jan 13, 2023
@vga91 vga91 deleted the apoc.schema.properties-can-hang branch January 13, 2023 08:35
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jan 13, 2023
…c#257)

* [ADJvoENI] apoc.schema.properties.distinct(Count) can hang

* [ADJvoENI] changes review

* [ADJvoENI] moved getProperty method - added distinct method in order to remove idxs duplicates
vga91 added a commit to neo4j-contrib/neo4j-apoc-procedures that referenced this pull request Jan 13, 2023
…c#257) (#3404)

* [ADJvoENI] apoc.schema.properties.distinct(Count) can hang (neo4j/apoc#257)

* [ADJvoENI] apoc.schema.properties.distinct(Count) can hang

* [ADJvoENI] changes review

* [ADJvoENI] moved getProperty method - added distinct method in order to remove idxs duplicates

* [ADJvoENI] fixed compilation errs
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

3 participants