Skip to content

New interop structure, types and precision information#114

Open
dritter-sap wants to merge 13 commits into
SAP:mainfrom
dritter-sap:dritter-sap
Open

New interop structure, types and precision information#114
dritter-sap wants to merge 13 commits into
SAP:mainfrom
dritter-sap:dritter-sap

Conversation

@dritter-sap

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

Copy link
Copy Markdown

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

cla-assistant Bot commented Oct 17, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@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

Fannon commented Oct 20, 2025

Copy link
Copy Markdown
Member

@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 thread docs/mappings/apache-spark.md Outdated
Comment thread docs/mappings/apache-spark.md Outdated
|`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?

Comment thread docs/mappings/apache-spark.md Outdated
|`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)

Comment thread docs/mappings/apache-spark.md Outdated
|`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.

Comment thread docs/mappings/apache-spark.md Outdated
|`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