You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/core/data_types.mdx
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,22 +200,22 @@ Currently, the following types are key types
200
200
-*Date*
201
201
-*Struct* with all fields being key types (using `@dataclass(frozen=True)` or `NamedTuple`)
202
202
203
-
## *Null* Values
203
+
## *None* Values
204
204
205
-
CocoIndex supports *Null* values. A *Null* value represents the absence of data or an unknown value, distinct from empty strings, zero numbers, or false boolean values.
205
+
CocoIndex supports *None* values. A *None* value represents the absence of data or an unknown value, distinct from empty strings, zero numbers, or false boolean values.
206
206
207
-
### Nullable Type
207
+
### Optional Type
208
208
209
-
For any data (e.g. a field of a *Struct*, an argument or return value of a CocoIndex function), if it is nullable, it means its value can be *Null*.
210
-
We use a `?` suffix to indicate a nullable type, e.g. *Str?*, *Person?*.
209
+
For any data (e.g. a field of a *Struct*, an argument or return value of a CocoIndex function), if it is optional, it means its value can be *None*.
210
+
We use *Optional[T]*to indicate an optional type, e.g. *Optional[Str]*, *Optional[Person]*.
211
211
212
-
In Python, *Null* is represented as `None`, so a nullable type can be represented by `T | None` or `typing.Optional[T]`.
212
+
In Python, *None* is represented as `None`, so an optional type can be represented by `T | None` or `typing.Optional[T]`.
213
213
214
-
### *Null* propagating on CocoIndex functions
214
+
### *None* propagating on CocoIndex functions
215
215
216
-
A function may specify whether each input argument is nullable or not.
217
-
Non-nullable argument means the function needs a known value for the argument to work.
218
-
However, it doesn't forbid the argument to be *Null* at runtime.
219
-
When a non-nullable argument receives a *Null* value, the function execution is skipped and the result is *Null*.
216
+
A function may specify whether each input argument is optional or not.
217
+
Non-optional argument means the function needs a known value for the argument to work.
218
+
However, it doesn't forbid the argument to be *None* at runtime.
219
+
When a non-optional argument receives a *None* value, the function execution is skipped and the result is *None*.
220
220
221
-
For example, for [`SplitRecursively` function](/docs/ops/functions#splitrecursively), the `text` and `chunk_size` arguments are not nullable. If the input value of either of them is *Null*, the function will return *Null*.
221
+
For example, for [`SplitRecursively` function](/docs/ops/functions#splitrecursively), the `text` and `chunk_size` arguments are not optional. If the input value of either of them is *None*, the function will return *None*.
0 commit comments