def is_valid_default_value(default: Any, type_hint: Any) -> bool:
    """
    Checks if the default value matches the type hint for scalar types.

    Handles Optional types by checking against each type in the Union.

    Note:
        This function is required for compatibility with Python 3.9 and lower
        due to the inability to use isinstance with subscripted generic types.
        It can be removed and type hint checks can be done directly with
        isinstance(default, type_hint) when the minimum supported Python version is 3.10+.

    Args:
        default (Any): The default value to validate.
        type_hint (Any): The type hint to validate against.

    Returns:
        bool: True if the default value is valid, False otherwise.
    """

    origin = get_origin(type_hint)
    args = get_args(type_hint)

    if default is None:
        if origin is Union and type(None) in args:
            return True
        elif type_hint is type(None):
            return True
        else:
            return False
    else:
        if origin is Union:
            return any(
                is_valid_default_value(default, arg) for arg in args if arg is not type(None)
            )
        elif isinstance(type_hint, type):
            return isinstance(default, type_hint)
        else:
            return False

    Checks if the default value matches the type hint for scalar types.

    Handles Optional types by checking against each type in the Union.

    Note:
        This function is required for compatibility with Python 3.9 and lower
        due to the inability to use isinstance with subscripted generic types.
        It can be removed and type hint checks can be done directly with
        isinstance(default, type_hint) when the minimum supported Python version is 3.10+.

    Args:
        default (Any): The default value to validate.
        type_hint (Any): The type hint to validate against.

    Returns:
        bool: True if the default value is valid, False otherwise.
    
ai/core/src/unitycatalog/ai/core/utils/callable_utils.py