1717from __future__ import annotations
1818
1919import functools
20- from typing import Protocol , TYPE_CHECKING
20+ from typing import Optional , Protocol , TYPE_CHECKING
2121
2222import bigframes .constants
2323import bigframes .exceptions
@@ -32,20 +32,23 @@ def _session(self) -> Session:
3232 ...
3333
3434
35- def requires_strict_ordering ():
35+ def requires_strict_ordering (suggestion : Optional [ str ] = None ):
3636 def decorator (meth ):
3737 @functools .wraps (meth )
3838 def guarded_meth (object : HasSession , * args , ** kwargs ):
39- enforce_ordered (object , meth .__name__ )
39+ enforce_ordered (object , meth .__name__ , suggestion )
4040 return meth (object , * args , ** kwargs )
4141
4242 return guarded_meth
4343
4444 return decorator
4545
4646
47- def enforce_ordered (object : HasSession , opname : str ) -> None :
47+ def enforce_ordered (
48+ object : HasSession , opname : str , suggestion : Optional [str ] = None
49+ ) -> None :
4850 if not object ._session ._strictly_ordered :
51+ suggestion_substr = suggestion + " " if suggestion else ""
4952 raise bigframes .exceptions .OrderRequiredError (
50- f"Op { opname } not supported when strict ordering is disabled. { bigframes .constants .FEEDBACK_LINK } "
53+ f"Op { opname } not supported when strict ordering is disabled. { suggestion_substr } { bigframes .constants .FEEDBACK_LINK } "
5154 )
0 commit comments