Skip to content

Commit 0503e79

Browse files
authored
Merge pull request #9 from datastax/develop
Develop
2 parents edc13b7 + 3ca9daf commit 0503e79

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

modules/functions/pages/compute.adoc

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ The step name is `compute` and the function's `UserConfig` is controlled in this
3636
| *Name (field)*
3737
| *Description*
3838

39-
| name
39+
| name
4040
| The name of the field to be computed. Prefix with `key.` or `value.` to compute the fields in the key or value parts of the message. +
4141
You can also compute values on the following message headers: [`destinationTopic`, `messageKey`, `properties.`]. +
4242
Please note that properties is a map of key/value pairs that are referenced by the dot notation, for example `properties.key0`.
4343

44-
| expression
45-
| Supports the <<Expression language>> syntax. It is evaluated at runtime and the result of the evaluation is assigned to the field.
44+
| expression
45+
| Supports the <<Expression language>> syntax. It is evaluated at runtime and the result of the evaluation is assigned to the field.
4646

47-
| type
48-
| The type of the computed field. this will translate to the schema type of the new field in the transformed message. The following types are currently supported [`STRING`, `INT32`, `INT64`, `FLOAT`, `DOUBLE`, `BOOLEAN`, `DATE`, `TIME`, `DATETIME`]. See <<Type parameters>>.
47+
| type
48+
| The type of the computed field. this will translate to the schema type of the new field in the transformed message. The following types are currently supported [`STRING`, `INT32`, `INT64`, `FLOAT`, `DOUBLE`, `BOOLEAN`, `DATE`, `TIME`, `DATETIME`]. See <<Type parameters>>.
4949

50-
| optional (default: true)
51-
|If true, it marks the field as optional in the schema of the transformed message. This is useful when `null` is a possible value of the compute expression.
50+
| optional (default: true)
51+
|If true, it marks the field as optional in the schema of the transformed message. This is useful when `null` is a possible value of the compute expression.
5252

5353
|===
5454

@@ -58,40 +58,40 @@ Please note that properties is a map of key/value pairs that are referenced by t
5858
[cols=3*,options]
5959
|===
6060
| *Name (field.type)*
61-
| *Description*
62-
| *Expression Examples*
61+
| *Description*
62+
| *Expression Examples*
6363

64-
| `INT32`
65-
| represents 32-bit integer.
66-
| expression1: "2147483647", expression2: "1 + 1"
64+
| `INT32`
65+
| represents 32-bit integer.
66+
| expression1: "2147483647", expression2: "1 + 1"
6767

68-
| `INT64`
69-
| represents 64-bit integer.
70-
| expression1: "9223372036854775807", expression2: "1 + 1"
68+
| `INT64`
69+
| represents 64-bit integer.
70+
| expression1: "9223372036854775807", expression2: "1 + 1"
7171

72-
| `FLOAT`
73-
| represents 32-bit floating point.
74-
| expression1: "340282346638528859999999999999999999999.999999", expression2: "1.1 + 1.1"
72+
| `FLOAT`
73+
| represents 32-bit floating point.
74+
| expression1: "340282346638528859999999999999999999999.999999", expression2: "1.1 + 1.1"
7575

76-
| `DOUBLE`
77-
| represents 64-bit floating point.
78-
| expression1: "1.79769313486231570e+308", expression2: "1.1 + 1.1"
76+
| `DOUBLE`
77+
| represents 64-bit floating point.
78+
| expression1: "1.79769313486231570e+308", expression2: "1.1 + 1.1"
7979

80-
| `BOOLEAN`
81-
| true or false
82-
| expression1: "true", expression2: "1 == 1", expression3: "value.stringField == 'matching string'"
80+
| `BOOLEAN`
81+
| true or false
82+
| expression1: "true", expression2: "1 == 1", expression3: "value.stringField == 'matching string'"
8383

84-
| `DATE`
85-
| a date without a time-zone in the https://www.rfc-editor.org/rfc/rfc3339[RFC3339 format]
86-
| expression1: "2021-12-03"
84+
| `DATE`
85+
| a date without a time-zone in the https://www.rfc-editor.org/rfc/rfc3339[RFC3339 format]
86+
| expression1: "2021-12-03"
8787

88-
| `TIME`
89-
| a time without a time-zone in the https://www.rfc-editor.org/rfc/rfc3339[RFC3339 format]
90-
| expression1: "20:15:45"
88+
| `TIME`
89+
| a time without a time-zone in the https://www.rfc-editor.org/rfc/rfc3339[RFC3339 format]
90+
| expression1: "20:15:45"
9191

92-
| `DATETIME`
92+
| `DATETIME`
9393
| a date-time with an offset from UTC in the https://www.rfc-editor.org/rfc/rfc3339[RFC3339 format]
94-
| expression1: "2022-10-02T01:02:03+02:00", expression2: "2019-10-02T01:02:03Z", expression3: "fn:now()"
94+
| expression1: "2022-10-02T01:02:03+02:00", expression2: "2019-10-02T01:02:03Z", expression3: "fn:now()"
9595

9696
|===
9797

@@ -111,7 +111,7 @@ The Expression Language supports the following operators:
111111
|Arithmetic
112112
| +, - (binary), *, / and div, % and mod, - (unary)
113113

114-
|Logical
114+
|Logical
115115
|and, &&, or \|\|, not, !
116116

117117
|Relational
@@ -128,7 +128,7 @@ The expression language supports the following functions: +
128128
| *Name (field)*
129129
| *Description*
130130
|uppercase(input)
131-
|Changes the capitalization of a string. If input is not a string, it attempts a string conversion. If the input is null, it returns null.
131+
|Changes the capitalization of a string. If input is not a string, it attempts a string conversion. If the input is null, it returns null.
132132

133133
|lowercase(input)
134134
|Changes the capitalization of a string. If input is not a string, it attempts a string conversion. If the input is null, it returns null.
@@ -163,25 +163,25 @@ The `when` condition supports the <expression language syntax>, which provides a
163163
|===
164164
| *Name (field)*
165165
| *Description*
166-
|key:
166+
|key:
167167
|the key portion of the record in a KeyValue schema.
168168

169-
|value:
169+
|value:
170170
|the value portion of the record in a KeyValue schema, or the message payload itself.
171171

172-
|messageKey:
172+
|messageKey:
173173
|the optional key messages are tagged with (aka. Partition Key).
174174

175-
|topicName:
175+
|topicName:
176176
|the optional name of the topic which the record originated from (aka. Input Topic).
177177

178-
|destinationTopic:
178+
|destinationTopic:
179179
|the name of the topic on which the transformed record will be sent (aka. Output Topic).
180180

181-
|eventTime:
181+
|eventTime:
182182
|the optional timestamp attached to the record from its source. For example, the original timestamp attached to the pulsar message.
183183

184-
|properties:
184+
|properties:
185185
|the optional user-defined properties attached to record.
186186

187187
|===
@@ -243,17 +243,17 @@ These statements would evaluate in a `when` statement:
243243
--tenant ${TENANT} \
244244
--namespace ${NAMESPACE} \
245245
--name transform-function \
246-
--inputs persistent://${TENANT}/${NAMESPACE}/${INPUT_TOPIC}
247-
--output persistent://${TENANT}/${NAMESPACE}/${OUTPUT_TOPIC} \
246+
--inputs persistent://${TENANT}/${NAMESPACE}/${INPUT_TOPIC} \
247+
--output persistent://${TENANT}/${NAMESPACE}/${OUTPUT_TOPIC} \
248248
--classname com.datastax.oss.pulsar.functions.transforms.TransformFunction \
249-
--jar functions/pulsar-transformations-2.0.1.nar
249+
--jar functions/pulsar-transformations-2.0.1.nar \
250250
--transform-function-config '{"steps": [{"type": "compute", "fields":[
251251
{"name": "key.newKeyField", "expression" : "5*3", "type": "INT32"},
252252
{"name": "value.valueField", "expression" : "fn:concat(value.valueField, '_suffix')", "type": "STRING"}]}
253253
]}'
254254
----
255255

256-
. Produce an AVRO message with the payload:
256+
. Produce an AVRO message with the payload:
257257
+
258258
[tabs]
259259
====
@@ -288,10 +288,10 @@ Result::
288288
--tenant ${TENANT} \
289289
--namespace ${NAMESPACE} \
290290
--name transform-function \
291-
--inputs persistent://${TENANT}/${NAMESPACE}/${INPUT_TOPIC}
292-
--output persistent://${TENANT}/${NAMESPACE}/${OUTPUT_TOPIC} \
291+
--inputs persistent://${TENANT}/${NAMESPACE}/${INPUT_TOPIC} \
292+
--output persistent://${TENANT}/${NAMESPACE}/${OUTPUT_TOPIC} \
293293
--classname com.datastax.oss.pulsar.functions.transforms.TransformFunction \
294-
--jar functions/pulsar-transformations-2.0.1.nar
294+
--jar functions/pulsar-transformations-2.0.1.nar \
295295
--transform-function-config `{"steps": [{"type": "compute", "fields":[
296296
{"name": "destinationTopic", "expression" : "'routed'", "type": "STRING"},
297297
{"name": "properties.k1", "expression" : "'overwritten'", "type": "STRING"},

0 commit comments

Comments
 (0)