@@ -117,7 +117,7 @@ Value TransformDictionaryToStruct(optional_ptr<ClientContext> context, const PyD
117117 const LogicalType &target_type = LogicalType::UNKNOWN ) {
118118 auto struct_keys = TransformStructKeys (dict.keys , dict.len , target_type);
119119
120- bool struct_target = target_type.id () == LogicalTypeId::STRUCT ;
120+ bool struct_target = target_type.id () == LogicalTypeId::STRUCT || target_type. id () == LogicalTypeId:: TUPLE ;
121121 if (struct_target && dict.len != StructType::GetChildCount (target_type)) {
122122 throw InvalidInputException (" We could not convert the object %s to the desired target type (%s)" ,
123123 dict.ToString (), target_type.ToString ());
@@ -252,7 +252,7 @@ Value TransformTupleToStruct(optional_ptr<ClientContext> context, py::handle ele
252252 auto tuple = py::cast<py::tuple>(ele);
253253 auto size = py::len (tuple);
254254
255- D_ASSERT (target_type.id () == LogicalTypeId::STRUCT );
255+ D_ASSERT (target_type.id () == LogicalTypeId::STRUCT || target_type. id () == LogicalTypeId:: TUPLE );
256256 auto child_types = StructType::GetChildTypes (target_type);
257257 auto child_count = child_types.size ();
258258 if (size != child_count) {
@@ -558,7 +558,7 @@ struct PythonValueConversion {
558558
559559 static void HandleTuple (optional_ptr<ClientContext> context, Value &result, const LogicalType &target_type,
560560 py::handle ele, idx_t list_size) {
561- if (target_type.id () == LogicalTypeId::STRUCT ) {
561+ if (target_type.id () == LogicalTypeId::STRUCT || target_type. id () == LogicalTypeId:: TUPLE ) {
562562 result = TransformTupleToStruct (context, ele, target_type);
563563 return ;
564564 }
@@ -584,6 +584,7 @@ struct PythonValueConversion {
584584 PyDictionary dict = PyDictionary (py::reinterpret_borrow<py::object>(ele));
585585 switch (target_type.id ()) {
586586 case LogicalTypeId::STRUCT :
587+ case LogicalTypeId::TUPLE :
587588 return TransformDictionaryToStruct (context, dict, target_type);
588589 case LogicalTypeId::MAP :
589590 return TransformDictionaryToMap (context, dict, target_type);
@@ -886,6 +887,7 @@ struct PythonVectorConversion {
886887 auto &result_type = result.GetType ();
887888 switch (result_type.id ()) {
888889 case LogicalTypeId::STRUCT :
890+ case LogicalTypeId::TUPLE :
889891 ConvertTupleToStruct (context, result, result_offset, ele, tuple_size);
890892 break ;
891893 case LogicalTypeId::ARRAY :
@@ -981,6 +983,7 @@ void TransformPythonObjectInternal(optional_ptr<ClientContext> context, py::hand
981983 auto &conversion_target = OP::ConversionTarget (result, param);
982984 switch (conversion_target.id ()) {
983985 case LogicalTypeId::STRUCT :
986+ case LogicalTypeId::TUPLE :
984987 case LogicalTypeId::UNKNOWN :
985988 case LogicalTypeId::LIST :
986989 case LogicalTypeId::ARRAY :
0 commit comments