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

Update the spec to fix the issue 782 #943

Merged
merged 44 commits into from
Jan 23, 2025
Merged

Conversation

otaviojava
Copy link
Contributor

@otaviojava otaviojava commented Jan 20, 2025

@otaviojava otaviojava requested a review from njr-11 January 20, 2025 07:47
@otaviojava
Copy link
Contributor Author

@njr-11, when you have time, could you review this one, please?

Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

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

To start out with, I reviewed the first two sections adding some suggestions for making the making the requirements more clear of what must be supported vs what is not required. I don't have expertise in these NoSQL databases, so I might have gotten some of the clarifications incorrect. I tried to use what the TCK is enforcing in the referenced issues as a guide, as well as the proposed text that was here.

I'll follow this up with reviewing the other sections but wanted to save this before an error occurs and I need to start over.

spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
When using NoSQL databases, the support for restrictions varies depending on the database type:

- **Key-Value Databases**: Support for the equals restriction and the `Not` restriction is required for the `Id` attribute. There is no requirement to support other types of restrictions, the `And` and `Or` keywords, or restrictions on other entity attributes. Queries in key-value databases are typically limited to operations using the `Id` attribute only.
- **Wide-Column Databases**: Wide-column databases must support the `AND` operator but are not required to support the `Or` operator. Restrictions must be supported for the key attribute that is annotated with `jakarta.nosql.Id`. Support for restrictions on other attributes is not required. Typically they can be used if they are indexed as secondary indexes, although support varies by database provider.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It happens in the majority of NoSQL databases of wide-column, but not all.

Those are samples, that is the reason we don't make it mandatory, I can assume to the majority, but not for all

NoSQL Database Supports AND Operator
Apache Cassandra ✅ Yes
Apache HBase ❌ No
ScyllaDB ✅ Yes
Google Bigtable ❌ No
Amazon Keyspaces ✅ Yes
Hypertable ❌ No
Azure Cosmos DB (Cassandra API) ✅ Yes

Copy link
Contributor

Choose a reason for hiding this comment

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

That's good information. I think the TCK might need to be updated because it only makes the allowance to not support for Key-Value, not Column,

        try {
            AsciiCharacter del = characters.findByIsControlTrueAndNumericValueBetween(33, 127);
            assertEquals(127, del.getNumericValue());
            assertEquals("7f", del.getHexadecimal());
            assertEquals(true, del.isControl());
        } catch (UnsupportedOperationException x) {
            if (type.isKeywordSupportAtOrBelow(DatabaseType.KEY_VALUE)) {
                // Key-Value databases might not be capable of And.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@njr-11, what do you want to do?

A) Finish those topicinat the documentation and then go to fix the TCK
B) Open a PR in parallel to fix it simultaneously.

Copy link
Contributor

@njr-11 njr-11 Jan 22, 2025

Choose a reason for hiding this comment

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

@njr-11, what do you want to do?

A) Finish those topicinat the documentation and then go to fix the TCK
B) Open a PR in parallel to fix it simultaneously.

It is completely fine to use separate PRs to split out work such as updating errors that we spot in the TCK while working on this. There is another minor error that I noticed as well. I'll get a PR (#946) open for that and we can continue on with the documentation accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, it does make sense. I reviewed and moved it.

@otaviojava
Copy link
Contributor Author

To start out with, I reviewed the first two sections adding some suggestions for making the making the requirements more clear of what must be supported vs what is not required. I don't have expertise in these NoSQL databases, so I might have gotten some of the clarifications incorrect. I tried to use what the TCK is enforcing in the referenced issues as a guide, as well as the proposed text that was here.

I'll follow this up with reviewing the other sections but wanted to save this before an error occurs and I need to start over.

Thanks, @njr-11 , NoSQL can help with that. I accepted your points, plus I give you some context.

Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

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

Some more comments. Still need to cover the last 2 sections.

spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

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

I made it through reviewing the remaining sections. I'm still unsure what to suggest for Document and Graph Databases with respect to arithmetic operations and parentheses, having noted that the TCK seems to have requirements for Graph.

spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
When using NoSQL databases, the support for restrictions varies depending on the database type:

- **Key-Value Databases**: Support for the equals restriction and the `Not` restriction is required for the `Id` attribute. There is no requirement to support other types of restrictions, the `And` and `Or` keywords, or restrictions on other entity attributes. Queries in key-value databases are typically limited to operations using the `Id` attribute only.
- **Wide-Column Databases**: Wide-column databases must support the `AND` operator but are not required to support the `Or` operator. Restrictions must be supported for the key attribute that is annotated with `jakarta.nosql.Id`. Support for restrictions on other attributes is not required. Typically they can be used if they are indexed as secondary indexes, although support varies by database provider.
Copy link
Contributor

Choose a reason for hiding this comment

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

That's good information. I think the TCK might need to be updated because it only makes the allowance to not support for Key-Value, not Column,

        try {
            AsciiCharacter del = characters.findByIsControlTrueAndNumericValueBetween(33, 127);
            assertEquals(127, del.getNumericValue());
            assertEquals("7f", del.getHexadecimal());
            assertEquals(true, del.isControl());
        } catch (UnsupportedOperationException x) {
            if (type.isKeywordSupportAtOrBelow(DatabaseType.KEY_VALUE)) {
                // Key-Value databases might not be capable of And.

Comment on lines 402 to 413
[WARNING]
====
When working with NoSQL databases, the `count` operation may not be supported, depending on the database structure and capabilities:

- **Key-Value Databases**: In general, the majority of Key-Value databases do not support counting. Their design focuses on retrieving values by keys rather than aggregating data.

- **Other NoSQL Databases**: Support for the `count` operation varies significantly:
- **Wide-Column Databases**: Counting might require additional configurations, such as enabling secondary indexes or performing costly full table scans, which can affect performance.
- **Graph and Document Databases**: These databases typically support counting, though performance may vary based on factors like indexing and query complexity.

====

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I can see why implementing count in Java would be a poor choice. I think the concern here will be whether any of this is a breaking change because we are lifting a requirement for it to work - if anyone was relying on it already, it will break if taken away, but that might as much an issue from the Jakarta Data provider as the spec itself.

spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/method-query.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
otaviojava and others added 14 commits January 22, 2025 04:33
Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

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

I proposed some updates to align with what I think was the outcome of the discussion on parentheses for Graph databases, if I understood correctly.

spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
@otaviojava
Copy link
Contributor Author

I proposed some updates to align with what I think was the outcome of the discussion on parentheses for Graph databases, if I understood correctly.

Thanks, I've modified this one. Please check.

Copy link
Contributor

@njr-11 njr-11 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 getting all of this detail written into the spec!

@otaviojava
Copy link
Contributor Author

Thanks for getting all of this detail written into the spec!

Thank you for all the support. It is not done yet, but I will create a new PR. This one is already big enough.

@otaviojava otaviojava merged commit 39b28c4 into main Jan 23, 2025
4 checks passed
@otaviojava otaviojava deleted the update-documentation-nosql branch January 23, 2025 15:43
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.

2 participants