Skip to content

Commit fdfbf64

Browse files
authored
docs(union-types): update docs for union type support (#689)
1 parent eca0ca6 commit fdfbf64

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

docs/docs/core/data_types.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ This is the list of all basic types supported by CocoIndex:
3838
| TimeDelta | A duration of time | `datetime.timedelta` | `datetime.timedelta` |
3939
| Json | | `cocoindex.Json` | Any data convertible to JSON by `json` package |
4040
| Vector[*T*, *Dim*?] | *T* can be a basic type or a numeric type. *Dim* is a positive integer and optional. | `cocoindex.Vector[T]` or `cocoindex.Vector[T, Dim]` | `numpy.typing.NDArray[T]` or `list[T]` |
41+
| Union[*T1*, *T2*, ...] | *T1*, *T2*, ... are any basic types | `T1 | T2 | ...` | `T1 | T2 | ...` |
4142

4243
Values of all data types can be represented by values in Python's native types (as described under the Native Python Type column).
4344
However, the underlying execution engine has finer distinctions for some types, specifically:

python/cocoindex/tests/test_convert.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ def eq(a: Any, b: Any) -> bool:
104104
)
105105
decoder = make_engine_value_decoder([], encoded_output_type, value_type)
106106
decoded_value = decoder(value_from_engine)
107-
assert eq(decoded_value, value), (
108-
f"{decoded_value} != {value}; {encoded_value}; {value_type}; {encoded_output_type}"
109-
)
107+
assert eq(decoded_value, value), f"{decoded_value} != {value}"
110108

111109
if other_decoded_values is not None:
112110
for other_value, other_type in other_decoded_values:

0 commit comments

Comments
 (0)