Skip to content

New interop structure, types and precision information#114

Open
dritter-sap wants to merge 12 commits intoSAP:mainfrom
dritter-sap:main
Open

New interop structure, types and precision information#114
dritter-sap wants to merge 12 commits intoSAP:mainfrom
dritter-sap:main

Conversation

@dritter-sap
Copy link
Copy Markdown
Collaborator

@dritter-sap dritter-sap commented Oct 17, 2025

We reworked the current interop as agreed into three parts (splitting spark and dsp):

  • spark
  • dsp

and added a type mapping for hana

  • hana

@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Oct 17, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ Fannon
❌ dritter-sap
You have signed the CLA already but the status is still pending? Let us recheck it.

@jalberti
Copy link
Copy Markdown

Thank you for your contribution, it is greatly appreciated!

May I suggest that when introducing new types, a new source, please start with a new document, see ABAP example, introducing first the types of the source system, mapping them into CDS types, and optionally provide their Spark equivalents, with respective cast instructions. Then, for any CDS types, we can introduce a mapping into a target type system.

The Spark type document needs work that aligns with this strategy. We can work on this in a distinct separate PR.

Thank you!

@Fannon
Copy link
Copy Markdown
Member

Fannon commented Oct 20, 2025

@dritter-sap : Thanks for bringing this up. I think we need to discuss it in CSN Interop WS, we already did it to some degree.

First, like @jalberti mentioned the types would first need to get introduced into the CSN Interop Types itself.

But here I see a problem: Types like hana.* are by definition not interoperable. So if we need types here, we need to generalize them so it's not Database specific. Also, we need to be VERY careful when introducing new types, as consumers who do not expect them to come up might break.

In most cases it would be safer to work with annotations here that could guide how a Database maps it to its own type. This is also how JSON Schema works: There are only a few real technical types that are completely stable. The rest is describes with "format" and via constraints like "maxValue".

FYI, @andreasbalzar

Comment on lines +30 to +31
hana.ST_GEOMETRY | STRING | `cds.String` | CSN with type info | | |
hana.ST_POINT | STRING | `cds.String` | CSN with type info | | |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We can't introduce hana.* types into the CSN interop specification, because they are by definition not Interoperable - they are HANA DB specific.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

that is reworked, kindly check.

|`cds.Integer`| INT | | |
|`cds.Integer64`| BIGINT | | |
|`cds.Decimal` (precision = p, scale = s) | DECIMAL(p,s) | | |
|`cds.Decimal` (precision = p, scale = floating) | ***not supported*** | Decimal with scale = floating is not supported in spark | |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Our proposal is to support this with cds.Decimal (precision = p, scale = floating) gets mapped to STRING in delta. Do you want to add this in the current PR or a later one?

|`cds.Decimal` (precision = p, scale = s) | DECIMAL(p,s) | | |
|`cds.Decimal` (precision = p, scale = floating) | ***not supported*** | Decimal with scale = floating is not supported in spark | |
|Amounts with Currencies `cds.Decimal` (precision = 34, scale = 4) | `cds.Decimal(34, 4)` | Since spark does not support `cds.DecimalFloat` we use cds.Decimal(34,4) as compromise for now | |
|`cds.Decimal` (no arguments) | ***not supported*** | | |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same for cds.Decimal (no arguments)

|`cds.Timestamp` µs precision | TIMESTAMP | | "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS" |
|`cds.UUID` + the annotation `@Semantics.uuid: true` | STRING (36) | | |
|hana.ST_GEOMETRY (in DSP, not in CDS) | STRING | CSN with type info | |
|hana.ST_POINT | STRING | CSN with type info | |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

new proposal to map cds.Vector to delta STRING.

|`cds.Integer`| INT | | |
|`cds.Integer64`| BIGINT | | |
|`cds.Decimal` (precision = p, scale = s) | DECIMAL(p,s) | | |
|`cds.Decimal` (precision = p, scale = floating) | ***not supported*** | Decimal with scale = floating is not supported in spark | |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HANA type SMALLDECIMAL seem to be not in the list. But I think, it may be fine to not include for now as there is no CDS type associated with it and so anyway CAP consumer/producer of DP can not consume/produce such type.

@dritter-sap dritter-sap changed the title WIP/do not review: New types and precision information New structure, types and precision information Dec 15, 2025
@dritter-sap dritter-sap changed the title New structure, types and precision information New interop structure, types and precision information Dec 15, 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