-
Notifications
You must be signed in to change notification settings - Fork 20
fix: cast for recursive queries on sqlite #1172
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
base: main
Are you sure you want to change the base?
Conversation
@@ -238,14 +238,14 @@ SELECT | |||
|
|||
let Hierarchy = cds.ql(` | |||
SELECT | |||
HIERARCHY_LEVEL, | |||
HIERARCHY_RANK, | |||
CAST(HIERARCHY_LEVEL AS cds.Int64) AS HIERARCHY_LEVEL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this change is for sqlite
only, wouldn't it make sense to override the function in the sqlite/cql-functions.js
? :)
If this is shared coding and it doesnt hurt for the other DBs, I'm fine with it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that this is SQLite specific as Postgres will also require it. Rather the code is currently only being tested with SQLite and HANA. The tests cannot be added here yet as it requires @sap/cds@9
to function.
Also pls check this: If these fields are meant to be numbers they should always be returned as numbers, not always as strings, correct? |
forgot to mention it in the description: we have strings only with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to have this discussed in a review.
Why are these number Int64?
Do we really expect hierarchy levels or ranks > 4294967295 ?
And: Do we really always have to add such query clumsinesses ?
HIERARCHY_LEVEL, | ||
HIERARCHY_RANK, | ||
CAST(HIERARCHY_LEVEL AS cds.Int64) AS HIERARCHY_LEVEL, | ||
HIERARCHY_RANK AS HIERARCHY_RANK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bob is currently on vacation for the next two weeks, is it ok to have a review when he is back?
we currently always model it as int64 in our docs and samples. maybe also something to discuss tomorrow. |
To have the same behaviour on SQLite as on HANA, computed fields like
DistanceFromRoot
andLimitedDescendantCount
should be returned as integers casted as strings, for example"1"
.