Skip to content

Conversation

@MattSchur
Copy link
Contributor

No description provided.

@MattSchur MattSchur requested a review from smahati as a code owner November 21, 2025 12:26
@MattSchur MattSchur requested a review from agoerler November 21, 2025 12:26
Copy link
Contributor

@agoerler agoerler 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 we should also document type promotion of functions

agoerler and others added 2 commits November 24, 2025 13:55
Co-authored-by: Matthias Schur <107557548+MattSchur@users.noreply.github.com>
@MattSchur MattSchur requested a review from agoerler November 24, 2025 16:09
Copy link
Contributor

@agoerler agoerler left a comment

Choose a reason for hiding this comment

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

We need to decide wether we use CDS type names Int32 or hana.Real or the constants of CdsBaseType. As we don't mention the CAP Java's CdsBaseType yet ion the documentation we could stick to the CDS type names.

Or we extend the table https://pages.github.tools.sap/cap/docs/java/cds-data#predefined-types and the table for the HANA types with a column for the CdsBaseType names.

Co-authored-by: Adrian Görler <adrian.goerler@sap.com>
@MattSchur MattSchur requested a review from agoerler November 26, 2025 14:27
@renejeglinsky renejeglinsky added the AI Review AI generated suggestions label Nov 26, 2025
@renejeglinsky renejeglinsky removed the AI Review AI generated suggestions label Nov 26, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Here's a supportive code review enhanced by AI assistance. These insights offer suggestions and observations that may help guide your development process. Please consider them as recommendations rather than definitive requirements. Your expertise and judgment remain the most important factors in making decisions about your code. The AI analysis is simply here to provide additional perspective and support your work.
Model: claude-sonnet-4-20250514 | Prompt Tokens: 1463 | Completion Tokens: 384

Comment on lines +74 to +76
### Numeric Type Determination { #type-determination }

To have a consistent behavior across different databases, the CAP Java runtime applies numeric type determination in arithmetic expressions and numeric standard functions according to the following rules.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a brief introductory sentence to provide context before diving into the rules. For example:

### Numeric Type Determination { #type-determination }

The CAP Java runtime ensures consistent behavior across different databases by applying numeric type determination rules in arithmetic expressions and numeric standard functions.

`cds.Double`, `hana.REAL`, `cds.Decimal`, `cds.Int64`, `cds.Int32`, `cds.Int16`, `cds.UInt8`

- For addition, subtraction, and multiplication, the result type is the one with highest precedence among the operands.
- For division:
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a colon after "For division" to maintain consistency with the formatting of "For addition, subtraction, and multiplication" above:

- For division:

java/cds-data.md Outdated
- **ceiling(x)**, **floor(x)**, **round(x)**: Return the same type as the input `x`.
- **min(x)**, **max(x)**, **sum(x)**: Aggregate functions return the same type as the argument `x`.
- **average(x)**: Returns `cds.Decimal` for exact numeric types and `cds.Double` for approximate numeric types.
- **count(x)**, **countdistinct(x)**: return `cds.Int64`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalize "Return" to maintain consistency with the capitalization pattern used in other function descriptions:

- **count(x)**, **countdistinct(x)**: Return `cds.Int64`.

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.

5 participants