Skip to content

Commit d0894df

Browse files
committed
Add test for VECTOR result type
1 parent dde8d62 commit d0894df

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/unit/test_embeddings.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,16 @@ def test_vector_embed_text_batch_inputs():
5757
for vector in result:
5858
assert len(vector) == EXPECTED_DIMENSION
5959
assert all(isinstance(v, float) for v in vector)
60+
61+
62+
def test_vector_result_type():
63+
# Verify that the UDF result type is correctly set to VECTOR(1024)
64+
# This ensures that databend-udf parses it correctly (if it validates on definition)
65+
# or at least that the string is passed correctly.
66+
# The result type is parsed into _result_schema
67+
assert len(ai_embed_1024._result_schema) == 1
68+
field = ai_embed_1024._result_schema[0]
69+
# Check if it is a fixed size list of size 1024
70+
import pyarrow as pa
71+
assert pa.types.is_fixed_size_list(field.type)
72+
assert field.type.list_size == 1024

0 commit comments

Comments
 (0)