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

Add "hidden" property attribute #1847

Merged
merged 2 commits into from
Dec 30, 2024
Merged

Add "hidden" property attribute #1847

merged 2 commits into from
Dec 30, 2024

Conversation

gramian
Copy link
Collaborator

@gramian gramian commented Dec 2, 2024

What does this PR do?

This new boolean property attribute called hidden excludes properties from a projection containing a * (star).

Motivation

ZetaSQL

Related issues

#1439

Additional Notes

This is the interesting change set: https://github.com/ArcadeData/arcadedb/pull/1503/files#diff-1ebfff8995bc54eab127a05a7f09d799b215972c6aa872635f37d86e824fb0b3

  • Basically now the any projection with a * (isAll) gets parsed property by property not by copy any more.
  • SELECT * FROM x works, but SELECT FROM x does not.
    • @lvca I cannot figure out why this is not working.

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios

@robfrank robfrank marked this pull request as ready for review December 30, 2024 13:32
@robfrank
Copy link
Collaborator

@gramian I added the missing part, essentially I updated the sql grammar and added some tests.

So, how it works?

If a property is configure to be hidden, when using the

SELECT * FROM TypeWithHiddenPropery

than the hidden property isn't present in the result set.

But, when not using the *:

SELECT  FROM TypeWithHiddenPropery

than the hidden property IS present in the result set.

After a fast call with @lvca, we think this is the right way to implement the feature. When a the query is written without a projection, the * in this case, it means the the query should fetch the whole content, hidded properties included.

WDYT?

@gramian
Copy link
Collaborator Author

gramian commented Dec 30, 2024

Hmm, OK.

I always thought of SELECT FROM as short form of SELECT * FROM. Are there other differences between these two forms? Performance-wise for example?

@robfrank
Copy link
Collaborator

robfrank commented Dec 30, 2024

They are working differently in the parser. The * generates a projection that is then interpreted as "all" , while the "blank" doesn't generate any projection.
On performace side, I think it depends more on the whole query structure rather than a single part of the statement.

If you think the feature is valuable in this incarnation, we can merge it :)

@gramian
Copy link
Collaborator Author

gramian commented Dec 30, 2024

It definitely is.

I am thinking about documentation for users, so when to use which and why. So given a large document, meaning many properties, SELECT FROM would be slightly faster as just the entire document is returned, right? And this ties now in with hidden; because the whole doc is returned the hidden properties are included, whereas using SELECT * FROM computes a projection in which hidden is applied. What else needs to be stated in this regard?

The point being hidden is aimed only at projections.

@robfrank
Copy link
Collaborator

exactly: you get to the point.

@lvca
Copy link
Contributor

lvca commented Dec 30, 2024

Exactly. SELECT FROM returns the whole record, instead * returns all the properties for the record. The result overlaps most of the times, but with the new hidden feature I think select from should still return the hidden properties, because you're asking the object itself.

@mergify mergify bot merged commit 176a961 into ArcadeData:main Dec 30, 2024
2 of 3 checks passed
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.

3 participants