Skip to content

Commit dcbe2da

Browse files
committed
merge-conflict
2 parents e70c0c0 + 1cc8a63 commit dcbe2da

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @datastax/docs-team

docs-src/pulsar-sink-core/modules/ROOT/pages/cfgPulsarMapUdt.adoc

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ In the example `stocks_topic`, the key is a basic string and the value is regula
4848
{"symbol":"F", "value":10, "exchange":"NYSE", "industry":"AUTO", "ts":"2018-11-26T19:26:27.483"}
4949
----
5050

51+
|===
52+
5153
The DataStax keyspace name is `stocks_keyspace`. In the stocks keyspace create the user defined type, `stocks_type`:
5254

5355
[source,language-cql]
@@ -59,7 +61,6 @@ CREATE TYPE stocks_keyspace.stocks_type (
5961
industry text,
6062
value double);
6163
----
62-
|===
6364

6465
Define a table named `stocks_udt_table` that has a column for the primitive string field `name` and a second column that uses the type, `stocks_type`:
6566

@@ -80,3 +81,49 @@ topic:
8081
stocks_udt_table:
8182
mapping: 'name=key,stocks=value'
8283
----
84+
85+
== Mapping complex user defined types
86+
87+
The DataStax Apache Pulsar™ Connector supports mapping complex user defined types of `map`, `set`, and `list`.
88+
89+
The DataStax keyspace name is `stocks_keyspace`. In the stocks keyspace create the user defined type, `stocks_complex_type`:
90+
91+
[source,language-cql]
92+
----
93+
CREATE TYPE stocks_keyspace.stocks_complex_type (
94+
symbol text,
95+
ts timestamp,
96+
exchange text,
97+
industry text,
98+
value double,
99+
trailing_five_days_value frozen<list<double>>,
100+
similar_symbols frozen<set<text>>,
101+
stats frozen<map<text, double>>);
102+
----
103+
104+
* `trailing_five_days_value frozen<list<double>>` contains a `list` of the value of the stock in the last five days, for example `[10.0, 11.0, 12.0, 23.0, 10.0]`. Values in a list do not need to be unique.
105+
* `similar_symbols frozen<set<text>>` contains a `set` of symbols in the same industry, or performing similarly, for example `["M", "GM", "F"]`. Values in a set must be unique.
106+
* `stats frozen<map<text, double>>` contains a `map` of key-value pairs, for example `{"open": 11.0, "high": 20.0, "low": 9.0}`.
107+
108+
Define a table named `stocks_complex_udt_table` that has a column for the primitive string field `name` and a second column that uses the type, `stocks_complex_type`:
109+
110+
[source,language-cql]
111+
----
112+
CREATE TABLE stocks_keyspace.stocks_complex_udt_table (
113+
name text primary key,
114+
stocks_complex FROZEN<stocks_complex_type>);
115+
----
116+
117+
Configure the connector settings and use the following for the map specification:
118+
119+
[source,language-yaml]
120+
----
121+
topic:
122+
stocks_topic:
123+
stocks_keyspace:
124+
stocks_complex_udt_table:
125+
mapping: 'name=key,stocks_complex=value'
126+
----
127+
128+
129+

0 commit comments

Comments
 (0)