def validate_return_type(func_name: str, type_hints: dict[str, Any]) -> str:
    """
    Validates and returns the SQL return type for the function.

    Ensures that the return type is properly specified and supported for SQL conversion.

    Args:
        func_name: The name of the function.
        type_hints: The type hints of the function.

    Returns:
        The corresponding SQL return type.
    """

    if "return" not in type_hints:
        raise ValueError(
            f"Return type for function '{func_name}' is not defined. Please provide a return type."
        )

    return_type_hint = type_hints["return"]
    if return_type_hint is None or return_type_hint is type(None):
        return "NULL"
    try:
        sql_return_type = validate_type_hint(return_type_hint)
    except ValueError as e:
        base_msg = f"Error in return type for function '{func_name}': {return_type_hint}."
        origin = get_origin(return_type_hint)
        args = get_args(return_type_hint)

        if (origin in (list, tuple, dict) and not args) or (
            return_type_hint in (list, tuple, dict)
        ):
            base_msg += (
                " Please define the inner types, e.g., List[int], Tuple[str, int], Dict[str, int]."
            )
        elif origin is Union or return_type_hint is Union:
            base_msg += " Union types are not supported in return types."
        elif return_type_hint is Any:
            base_msg += " 'Any' type is not supported. Please specify a concrete return type."
        else:
            base_msg += f" Unsupported return type: {return_type_hint}."

        raise ValueError(base_msg) from e
    return sql_return_type

    Validates and returns the SQL return type for the function.

    Ensures that the return type is properly specified and supported for SQL conversion.

    Args:
        func_name: The name of the function.
        type_hints: The type hints of the function.

    Returns:
        The corresponding SQL return type.
    
ai/core/src/unitycatalog/ai/core/utils/callable_utils.py