Skip to content

Conversation

@maiargu
Copy link
Member

@maiargu maiargu commented Jun 10, 2025

PR is in draft mode, the changes to be discussed.

@maiargu maiargu force-pushed the exptend-operators branch from 81502b0 to da015ec Compare June 10, 2025 10:25
examples:
- [{ "ref": ["to_Connection", "AirlineID"] }, "=", { "ref": ["AirlineID"] }]
- [{ "ref": ["to_Connection", "FlightDate"] }, "<=", { "ref": ["FlightDate"] }]
- [{ "ref": ["to_Connection", "FlightDate"] }, ">=", { "ref": ["FlightDate"] }]
Copy link
Member Author

@maiargu maiargu Jun 10, 2025

Choose a reason for hiding this comment

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

Some questions from my side, to be discussed:

  1. if the operators "<=" and "<=" are allowed, are they restricted only to some specific cds. type operands?

Example, "<=" and "<=" operators :

  • allowed for operands of type "cds.Integer" | "cds.Integer64" | "cds.Decimal" | "cds.Double" | "cds.Date" | "cds.Time" | "cds.DateTime" | "cds.Timestamp" ?
  • but forbidden for operands of type "cds.Boolean" | "cds.String" | "cds.LargeString" | "cds.UUID"?
  1. Who does the check if the two operands are of the same type and it makes sense to combine them via an operator sign?

Copy link
Member

Choose a reason for hiding this comment

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

  1. Yes, I'm pretty sure this is the case, and we need to spell this out somewhere. Maybe we should create a section in the Primer or somewhere else and link to it from the interface docu. We may even have a "sub-specification" here, where we need to explain how "on" condition queries work.

  2. @stewsk - do you know if this is something CAP compiler checks? It would be possible to check via the metadata validator, but writing that validation code will be a bit more involved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @Fannon , CAP doesn't apply any restrictions on the ON condition. Any kind of condition (all operators, all types) are allowed. Accordingly, we don't have any such checks.

Copy link
Member

Choose a reason for hiding this comment

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

What happens if an operator is not known / supported by CAP or another consumer?

Copy link
Contributor

Choose a reason for hiding this comment

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

CAP doesn't care.

Copy link
Member

Choose a reason for hiding this comment

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

But wouldn't this on condition need to be resolved, in the case of an association even as a foreign key?

Maybe the example added here is a bit confusing. An "on" condition of an association or composition probably always need to return exactly one match? Its a different use case compared to a view where we want to query / select multiple results. Here comparator operations like >= make more sense to me, but we don't have Views / Queries like that in CSN Interop.

@maiargu maiargu self-assigned this Jun 10, 2025
The `on` condition is constructed by triples of:
- Reference to the target element (ID) as array with 2 items
- Equals Operator "="
- Equals Operator `=` or Smaller Equals Operator `<=` or Bigger Equals Operator `>=`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Equals Operator `=` or Smaller Equals Operator `<=` or Bigger Equals Operator `>=`
- Operator: Equals `=`, Smaller Equals`<=` or Bigger Equals `>=`

@Fannon
Copy link
Member

Fannon commented Jun 25, 2025

Let's either add it to the spec itself and then update the existing check, or maybe it's a non-issue anyway because the validation result was correct and the CSN files have to be fixed.

@Fannon Fannon closed this Jun 25, 2025
@Fannon Fannon reopened this Jun 25, 2025
@Fannon
Copy link
Member

Fannon commented Jun 25, 2025

Sorry, I closed the wrong PR. Let's keep this open until we clarified this.

The operator `=`
const: "="

SmallerEqualsOperator:
Copy link
Member

Choose a reason for hiding this comment

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

If we use smaller or bigger equals operators, the cardinality of the "on" condition has to be "to many".

We need to define for which data types a comparator like this is valid and how comparison works. So far we seem to only need it for date (time dependent references / queries)

The operator `<=`
const: "<="

BiggerEqualsOperator:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
BiggerEqualsOperator:
GreaterEqualsOperator:

@Fannon Fannon changed the title added more operators for the on condition Support more operators for the on condition Jun 25, 2025
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.

4 participants