Skip to content

Commit 7cdd967

Browse files
frankejoeFannon
andauthored
Update mapping tables for ABAP and Apache Spark (#95)
* Update abap.md Enhancing the ABAP Data Type Mapping * Update abap.md * Update abap.md * Update abap.md * Update abap.md * Update abap.md * Update abap.md * Update abap.md * Update apache-spark.md * Update apache-spark.md * Update abap.md * Update abap.md * Update apache-spark.md --------- Co-authored-by: Simon Heimler <simon.heimler@sap.com>
1 parent 335179f commit 7cdd967

File tree

2 files changed

+57
-57
lines changed

2 files changed

+57
-57
lines changed

docs/mappings/abap.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,46 @@ description: "ABAP Type System"
55

66
# ABAP to CSN Interop
77

8-
> <span className="feature-status-draft">DRAFT</span> This mapping definition is work in progress and may be subject to further change.
8+
<span className="feature-status-draft">DRAFT</span> This mapping definition is work in progress and may be subject to further change.
99

1010
<!-- prettier-ignore -->
11-
| ABAP DataType | CDS Datatype | Properties | Comment | New CDS Datatype |
12-
|-------------- | ------------ | ---------- | ------- | ----------------- |
13-
| abap.cuky (len=5) | cds.String | length = 5 | | no change |
14-
| abap.unit (len=3) | cds.String | length = 3 | | no change |
15-
| abap.char (len=x) | cds.String | length = x | | no change |
16-
| abap.varc (len=x) | cds.String | length = x | | no change |
17-
| abap.sstring (len=x) | cds.String | length = x | | no change |
18-
| abap.numc (len=x) | cds.String | length = x | | no change |
19-
| abap.clnt (len=3) | cds.String | length = 2 | | no change |
20-
| abap.lang (len=2) | cds.String | length = 2 | | no change |
21-
| abap.accp (len=6) | cds.String | length = 6 | | no change |
22-
| special logic | cds.Boolean | | decision is taken based on certain domains | no change |
23-
| abap.utclong | cds.Timestamp | | | no change |
24-
| abap.tims | cds.Time | | | no change |
25-
| abap.timn | cds.Time | | | no change |
26-
| abap.dats | cds.Date | | | no change |
27-
| abap.datn | cds.Date | | | no change |
28-
| abap.dec(precision = x, scale = y) | cds.Decimal | precision = x, scale = y | | no change |
29-
| abap.quan(precision = x, scale = y) | cds.Decimal | precision = x, scale = y | | no change |
30-
| abap.decfloat16(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | | cds.decimal(16,?) |
31-
| abap.df16_dec(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | | cds.decimal(16,?) |
32-
| abap.df16_raw(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | | cds.decimal(16,?) |
33-
| abap.df16_scl(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | | cds.decimal(16,?) |
34-
| abap.decfloat34(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | | cds.decimal(34,?) |
35-
| abap.df34_dec(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | | cds.decimal(34,?) |
36-
| abap.df34_raw(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | | cds.decimal(34,?) |
37-
| abap.df34_scl(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | | cds.decimal(34,?) |
38-
| abap.curr(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | | cds.decimal(34,?) |
39-
| abap.int8 | cds.Integer64 | | | no change |
40-
| abap.int1 | cds.Integer | | | no change |
41-
| abap.int2 | cds.Integer | | | no change |
42-
| abap.int4 | cds.Integer | | | no change |
43-
| abap.prec | cds.Integer | | | no change |
44-
| abap.raw | cds.binary | | | default: cds.String(2 \* raw-length) - later we have to discuss how to encode e.g. images or for which data types we use cds.UUID (max 36) (for a dedicated list of abap data types) - for cds.UUID use rules from OData Data Types |
45-
| abap.fltp | cds.double | | | cds.Double |
46-
| abap.string | cds.largestring | | | cds.String length is either given or blank |
47-
| abap.lchr | cds.largestring | | | cds.String length is either given or blank |
48-
| abap.lraw | cds.largebinary | | | not supported |
49-
| abap.rawstring | cds.largebinary | | | not supported |
50-
| abap.geom_ewkb | cds.largebinary | | | not supported |
11+
| ABAP DataType | CDS Datatype | Properties | Spark Type | ABAP Format | Comment | | Transformer |
12+
|-------------- | ------------ | ---------- | ---------- | ----------- | ------- | - | ----------- |
13+
| abap.cuky (len=5) | cds.String | length = 5 | STRING(5) | | | | - |
14+
| abap.unit (len=3) | cds.String | length = 3 | STRING(3) | | | | - |
15+
| abap.char (len=x) | cds.String | length = x | STRING(x) | | | | - |
16+
| abap.varc (len=x) | cds.String | length = x | STRING(x) | | | | - |
17+
| abap.sstring (len=x) | cds.String | length = x | STRING(x) | | | | - |
18+
| abap.string | cds.LargeString | | STRING | | | | - |
19+
| abap.lchr | cds.LargeString | | STRING | | | | - |
20+
| abap.rawstring | cds.LargeString | | STRING | | | | - |
21+
| abap.geom_ewkb | cds.LargeString | | STRING | | | | - |
22+
| abap.numc (len=x) | cds.String | length = x | STRING(x) | | | | - |
23+
| abap.clnt (len=3) | cds.String | length = 3 | STRING(3) | | | | - |
24+
| abap.lang (len=2) | cds.String | length = 2 | STRING(2) | | | | - |
25+
| abap.accp (len=6) | cds.String | length = 6 | STRING(6) | | | | - |
26+
| abap.char(1) (*"@Semantic.booleanIndicator: true"*) | cds.String | length = 1 | STRING(1) | | We can't enforce the right values - therefore we must use string | | - |
27+
| abap.utclong | cds.Timestamp | "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS" | TIMESTAMP | | | | "castToTimestamp": \[\{ "sourceColumnName": "abap_tstmpl", "sourceFormat": \["yyyy-MM-dd'T'HH:mm:ss.SSSSSSS"\], "valueReplacements": \[\{"sourceValues": \[ "" \], "targetValue": "NULL_VALUE" \}\]\}\] |
28+
| abap.tims | cds.Time | | STRING(6) | "HHmmss" | type time not available in spark | | - |
29+
| abap.timn | cds.Time | | STRING(12) | "HH:mm:ss.SSS" | type time not available in spark | | - |
30+
| abap.dats | cds.Date | | DATE | "yyyyMMdd" | | | "castToDate": \[\{ "sourceColumnName": "abap_dats", "sourceFormat": \["yyyyMMdd"\], "valueReplacements": \[\{"sourceValues": \[ "00000000", "" \], "targetValue": "NULL_VALUE" \}\]\}\] |
31+
| abap.datn | cds.Date | | DATE | "yyyy-MM-dd" | | | "castToDate": \[\{ "sourceColumnName": "abap_dats", "sourceFormat": \["yyyy-MM-dd"\], "valueReplacements": \[\{"sourceValues": \[ "0000-00-00", "" \], "targetValue": "NULL_VALUE" \}\]\}\] |
32+
| abap.dec(precision = p, scale = s) | cds.Decimal | precision = p, scale = s | DECIMAL(p,s) | | | | - |
33+
| abap.quan(precision = p, scale = s) | cds.Decimal | precision = p, scale = s | DECIMAL(p,s) | | | | - |
34+
| abap.decfloat16(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | *not supported* | | | | - |
35+
| abap.df16_dec(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | *not supported* | | | | - |
36+
| abap.df16_raw(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | *not supported* | | | | - |
37+
| abap.df16_scl(precision = 16, scale = floating) | cds.Decimal | precision = 16, scale = floating | *not supported* | | | | - |
38+
| abap.decfloat34(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | *not supported* | | | | - |
39+
| abap.df34_dec(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | *not supported* | | | | - |
40+
| abap.df34_raw(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | *not supported* | | | | - |
41+
| abap.df34_scl(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = floating | *not supported* | | | | - |
42+
| abap.curr(precision = 34, scale = floating) | cds.Decimal | precision = 34, scale = 4 | DECIMAL(34, 4) | | | | - |
43+
| abap.int8 | cds.Integer64 | | BIGINT | | | | - |
44+
| abap.int1 | cds.Integer | | INT | | | | - |
45+
| abap.int2 | cds.Integer | | INT | | | | - |
46+
| abap.int4 | cds.Integer | | INT | | | | - |
47+
| abap.prec | cds.Integer | | INT | | | | - |
48+
| abap.fltp | cds.Double | | DOUBLE | | | | - |
49+
| abap.raw | *not supported* | | | *not supported* | | | - |
50+
| abap.lraw | *not supported* | | | *not supported* | | | - |

docs/mappings/apache-spark.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ description: "CSN Interop types to Apache Spark types."
1010
- DataSphere Data Types coming from here: [Link](https://help.sap.com/docs/SAP_DATASPHERE/c8a54ee704e94e15926551293243fd1d/7b1dc6e0fad147de8e50aa8dc4744aa3.html?locale=en-US)
1111

1212
<!-- prettier-ignore -->
13-
|CDS | Spark / Delta Lake | Datasphere | Comment |
14-
|--- |------------------- |----------- |-------- |
15-
|`cds.Boolean`| BOOLEAN | `cds.Boolean`| |
16-
|`cds.String` (length ) | STRING | `cds.String` | Datasphere Logic: IF `cds.String(length = undefined)` THEN `cds.String(length = 5000)`|
17-
|`cds.LargeString`| STRING | `cds.LargeString` | TODO: Check this. No length Limit?|
18-
|`cds.Integer`| INT | `cds.Integer` | |
19-
|`cds.Integer64`| BIGINT | `cds.Integer64` | |
20-
|`cds.Decimal` (precision, scale)| DECIMAL(p,s) | `cds.Decimal` | Datasphere Logic: IF `cds.Decimal(p < 17)` THEN `cds.Decimal(p = 17)` |
21-
|`cds.Decimal` (precision = 34, scale = floating) | ***not supported*** | `cds.DecimalFloat` | Decimal with scale = floating is not supported in spark |
22-
|Amounts with Currencies `cds.Decimal` (precision = 34, scale = 4) | `cds.Decimal(34, 4)` | `cds.Decimal(34, 4)` | Since spark does not support `cds.DecimalFloat` we use cds.Decimal(34,4) as compromise for now |
23-
|`cds.Double` (precision, scale)| DECIMAL(p,s) | `cds.Double` | Datasphere Logic: IF `cds.Double (precision, scale)` THEN `cds.Double()` (delete precision and scale) |
24-
|`cds.Date`| DATE | `cds.Date` | |
25-
|`cds.Time` must be expressed as `cds.String(6)` or `cds.String(12)` depending on the source representation for now + the annotation `@Semantics.time: true`| STRING | `cds.String(6)` or `cds.String(12)` | Data is in format `HHmmss` or `HH:mm:ss.SSS` - consumer must use the function to_time() to convert to `cds.Time`|
26-
|`cds.DateTime` sec precision| TIMESTAMP | `cds.Timestamp` | |
27-
|`cds.Timestamp` µs precision| TIMESTAMP | `cds.Timestamp` | |
28-
|`cds.UUID` + the annotation `@Semantics.uuid: true`| STRING (36) | `cds.UUID` | |
13+
|CDS | Spark / Delta Lake | Datasphere | Comment | Spark format |
14+
|--- |------------------- |----------- |-------- |--------------|
15+
|`cds.Boolean`| BOOLEAN | `cds.Boolean`| | |
16+
|`cds.String` (length ) | STRING | `cds.String` | Datasphere Logic: IF `cds.String(length = undefined)` THEN `cds.String(length = 5000)` | |
17+
|`cds.LargeString` (length ) | STRING | `cds.LargeString` | | |
18+
|`cds.Integer`| INT | `cds.Integer` | | |
19+
|`cds.Integer64`| BIGINT | `cds.Integer64` | | |
20+
|`cds.Decimal` (precision = p, scale = s)| DECIMAL(p,s) | `cds.Decimal` | Datasphere Logic: IF `cds.Decimal(p < 17)` THEN `cds.Decimal(p = 17)` | |
21+
|`cds.Decimal` (precision = p, scale = floating) | ***not supported*** | `cds.Decimal` | Decimal with scale = floating is not supported in spark | |
22+
|Amounts with Currencies `cds.Decimal` (precision = 34, scale = 4) | `cds.Decimal(34, 4)` | `cds.Decimal(34, 4)` | Since spark does not support `cds.DecimalFloat` we use cds.Decimal(34,4) as compromise for now | |
23+
|`cds.Double`| DOUBLE | `cds.Double` | | |
24+
|`cds.Date`| DATE | `cds.Date` | | "yyyyMMdd" |
25+
|`cds.Time` must be expressed as `cds.String(6)` or `cds.String(12)` depending on the source representation for now + the annotation `@Semantics.time: true`| STRING | `cds.String(6)` or `cds.String(12)` | Data is in format `HHmmss` or `HH:mm:ss.SSS` - consumer must use the function to_time() to convert to `cds.Time`| |
26+
|`cds.DateTime` sec precision| TIMESTAMP | `cds.Timestamp` | | |
27+
|`cds.Timestamp` µs precision| TIMESTAMP | `cds.Timestamp` | | "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS" |
28+
|`cds.UUID` + the annotation `@Semantics.uuid: true`| STRING (36) | `cds.UUID` | | | |

0 commit comments

Comments
 (0)