Skip to content

Commit 6429c9c

Browse files
committed
Handle AutoMap flag in TCallableArgsHelper the right way
commit_hash:98f3bddb416cee821c3779e58ffe8a92d61304de (cherry picked from commit b8c84f9)
1 parent 4a1a98c commit 6429c9c

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

yql/essentials/public/udf/udf_type_builder.h

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ using IFunctionTypeInfoBuilderImpl = IFunctionTypeInfoBuilder1;
705705
class IFunctionTypeInfoBuilder: public IFunctionTypeInfoBuilderImpl {
706706
public:
707707
IFunctionTypeInfoBuilder();
708-
708+
709709
IFunctionTypeInfoBuilder& Implementation(
710710
TUniquePtr<IBoxedValue> impl) {
711711
ImplementationImpl(std::move(impl));
@@ -884,13 +884,6 @@ struct TTypeBuilderHelper<TOptional<T>> {
884884
}
885885
};
886886

887-
template <typename T>
888-
struct TTypeBuilderHelper<TAutoMap<T>> {
889-
static TType* Build(const IFunctionTypeInfoBuilder& builder) {
890-
return TTypeBuilderHelper<T>::Build(builder);
891-
}
892-
};
893-
894887
template <typename TKey, typename TValue>
895888
struct TTypeBuilderHelper<TDict<TKey, TValue>> {
896889
static TType* Build(const IFunctionTypeInfoBuilder& builder) {
@@ -987,6 +980,29 @@ struct TCallableArgsHelper<TArg, TArgs...> {
987980
}
988981
};
989982

983+
template <typename TArg, typename... TArgs>
984+
struct TCallableArgsHelper<TAutoMap<TArg>, TArgs...> {
985+
static void Arg(
986+
ICallableTypeBuilder& callableBuilder,
987+
const IFunctionTypeInfoBuilder& builder)
988+
{
989+
callableBuilder.Arg(TTypeBuilderHelper<TArg>::Build(builder))
990+
#if UDF_ABI_COMPATIBILITY_VERSION_CURRENT >= UDF_ABI_COMPATIBILITY_VERSION(2, 38)
991+
// XXX: Unfortunately, ICallableTypeBuilder provides Flags
992+
// method only since UDF ABI 2.38. However, AutoMap flag
993+
// has been silently ignored by this builder and also by
994+
// the TTypeBuilderHelper specialization for AutoMap type.
995+
// Hence, the correct AutoMap type processing is wrapped
996+
// with this compatibility macro, since the caller of
997+
// ICallableTypeBuilder has to explicitly set AutoMap flag
998+
// for the particular argument anyway.
999+
.Flags(ICallablePayload::TArgumentFlags::AutoMap)
1000+
#endif
1001+
;
1002+
TCallableArgsHelper<TArgs...>::Arg(callableBuilder, builder);
1003+
}
1004+
};
1005+
9901006
template <typename TReturn, typename... TArgs>
9911007
struct TTypeBuilderHelper<TReturn(*)(TArgs...)> {
9921008
static TType* Build(const IFunctionTypeInfoBuilder& builder) {

0 commit comments

Comments
 (0)