calc-flow-python 4.0.0__cp313-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- calc_flow/__init__.py +169 -0
- calc_flow/_native.pyd +0 -0
- calc_flow/_native.pyi +366 -0
- calc_flow/array.py +1324 -0
- calc_flow/capabilities.py +775 -0
- calc_flow/config.py +219 -0
- calc_flow/errors.py +25 -0
- calc_flow/join_spec.py +156 -0
- calc_flow/pipeline.py +1123 -0
- calc_flow/py.typed +0 -0
- calc_flow/runtime.py +979 -0
- calc_flow/store.py +138 -0
- calc_flow/symbolic/__init__.py +65 -0
- calc_flow/symbolic/_generated_rolling_kernels.py +23 -0
- calc_flow/symbolic/analyzer.py +2280 -0
- calc_flow/symbolic/domains.py +77 -0
- calc_flow/symbolic/errors.py +58 -0
- calc_flow/symbolic/expr.py +662 -0
- calc_flow/symbolic/lower/__init__.py +31 -0
- calc_flow/symbolic/lower/planners.py +1270 -0
- calc_flow/symbolic/lower/program.py +840 -0
- calc_flow/symbolic/lower/segments.py +836 -0
- calc_flow/symbolic/lower/strategies.py +1472 -0
- calc_flow/symbolic/nodes.py +603 -0
- calc_flow/symbolic/ops.py +1155 -0
- calc_flow/symbolic/optimizer.py +600 -0
- calc_flow/symbolic/program.py +377 -0
- calc_flow/symbolic/types.py +110 -0
- calc_flow/symbolic/windows.py +153 -0
- calc_flow/udf.py +19 -0
- calc_flow_python-4.0.0.dist-info/METADATA +376 -0
- calc_flow_python-4.0.0.dist-info/RECORD +35 -0
- calc_flow_python-4.0.0.dist-info/WHEEL +4 -0
- calc_flow_python-4.0.0.dist-info/licenses/LICENSE +202 -0
- calc_flow_python-4.0.0.dist-info/sboms/calc-flow-python.cyclonedx.json +10081 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Domain admission templates for symbolic declarations.
|
|
2
|
+
|
|
3
|
+
The exact message templates are frozen by
|
|
4
|
+
``.codex/artifacts/api-notes/symbolic-computation-engine.md`` section 2.3.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
COLUMN_OPERATOR_ERROR = (
|
|
10
|
+
"symbolic column operator {operator} requires ColumnExpr or a strict"
|
|
11
|
+
" scalar literal; got {type}"
|
|
12
|
+
)
|
|
13
|
+
ARRAY_OPERATOR_ERROR = (
|
|
14
|
+
"symbolic array operator {operator} requires ArrayExpr,"
|
|
15
|
+
" Parameter[ArrayExpr], or a strict scalar literal; got {type}"
|
|
16
|
+
)
|
|
17
|
+
TABLE_OPERATOR_ERROR = (
|
|
18
|
+
"symbolic table expressions do not support scalar operator {operator};"
|
|
19
|
+
" select a column or use table/window operations"
|
|
20
|
+
)
|
|
21
|
+
NAMESPACE_ERROR = (
|
|
22
|
+
"calc_flow.symbolic.{function}.{parameter}: expected {expected}; got {type}"
|
|
23
|
+
)
|
|
24
|
+
BOOL_ERROR = (
|
|
25
|
+
"symbolic expressions have no truth value; use &, |, and ~ for symbolic"
|
|
26
|
+
" boolean composition, or identical() for structural identity"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def type_name(value: object, /) -> str:
|
|
31
|
+
"""Return the module-qualified type name without a representation."""
|
|
32
|
+
|
|
33
|
+
value_type = type(value)
|
|
34
|
+
return f"{value_type.__module__}.{value_type.__qualname__}"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def column_operator_error(operator: str, operand: object, /) -> TypeError:
|
|
38
|
+
return TypeError(
|
|
39
|
+
COLUMN_OPERATOR_ERROR.format(operator=operator, type=type_name(operand))
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def array_operator_error(operator: str, operand: object, /) -> TypeError:
|
|
44
|
+
return TypeError(
|
|
45
|
+
ARRAY_OPERATOR_ERROR.format(operator=operator, type=type_name(operand))
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def table_operator_error(operator: str, /) -> TypeError:
|
|
50
|
+
return TypeError(TABLE_OPERATOR_ERROR.format(operator=operator))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def namespace_error(
|
|
54
|
+
function: str,
|
|
55
|
+
parameter: str,
|
|
56
|
+
expected: str,
|
|
57
|
+
operand: object,
|
|
58
|
+
/,
|
|
59
|
+
) -> TypeError:
|
|
60
|
+
return TypeError(
|
|
61
|
+
NAMESPACE_ERROR.format(
|
|
62
|
+
function=function,
|
|
63
|
+
parameter=parameter,
|
|
64
|
+
expected=expected,
|
|
65
|
+
type=type_name(operand),
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def is_strict_scalar_type(value: object, /) -> bool:
|
|
71
|
+
"""Admit exactly the strict JSON scalar host types by exact type."""
|
|
72
|
+
|
|
73
|
+
return value is None or type(value) in (bool, int, float, str)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def bool_error() -> TypeError:
|
|
77
|
+
return TypeError(BOOL_ERROR)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Frozen symbolic issue codes and the lowering ``CompileError`` boundary.
|
|
2
|
+
|
|
3
|
+
The codes are the frozen vocabulary of
|
|
4
|
+
``.codex/artifacts/api-notes/symbolic-computation-engine.md`` section 4. Every
|
|
5
|
+
engine-originated symbolic failure begins with a stable path followed by the
|
|
6
|
+
code, matching ``{path}: {code}: {message}``.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import NoReturn
|
|
12
|
+
|
|
13
|
+
from calc_flow.errors import CompileError
|
|
14
|
+
|
|
15
|
+
CAPABILITY_MISMATCH = "capability_mismatch"
|
|
16
|
+
DUPLICATE_NAME = "duplicate_name"
|
|
17
|
+
INVALID_LITERAL = "invalid_literal"
|
|
18
|
+
ORDERING_REQUIRED = "ordering_required"
|
|
19
|
+
SCHEMA_MISMATCH = "schema_mismatch"
|
|
20
|
+
UNBOUNDED_STATE = "unbounded_state"
|
|
21
|
+
UNKNOWN_PRIMITIVE_VERSION = "unknown_primitive_version"
|
|
22
|
+
UNRESOLVED_TYPE = "unresolved_type"
|
|
23
|
+
UNSUPPORTED_MODE = "unsupported_mode"
|
|
24
|
+
UNSUPPORTED_TYPE = "unsupported_type"
|
|
25
|
+
|
|
26
|
+
ISSUE_CODES: tuple[str, ...] = (
|
|
27
|
+
CAPABILITY_MISMATCH,
|
|
28
|
+
DUPLICATE_NAME,
|
|
29
|
+
INVALID_LITERAL,
|
|
30
|
+
ORDERING_REQUIRED,
|
|
31
|
+
SCHEMA_MISMATCH,
|
|
32
|
+
UNBOUNDED_STATE,
|
|
33
|
+
UNKNOWN_PRIMITIVE_VERSION,
|
|
34
|
+
UNRESOLVED_TYPE,
|
|
35
|
+
UNSUPPORTED_MODE,
|
|
36
|
+
UNSUPPORTED_TYPE,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"CAPABILITY_MISMATCH",
|
|
41
|
+
"DUPLICATE_NAME",
|
|
42
|
+
"INVALID_LITERAL",
|
|
43
|
+
"ISSUE_CODES",
|
|
44
|
+
"ORDERING_REQUIRED",
|
|
45
|
+
"SCHEMA_MISMATCH",
|
|
46
|
+
"UNBOUNDED_STATE",
|
|
47
|
+
"UNKNOWN_PRIMITIVE_VERSION",
|
|
48
|
+
"UNRESOLVED_TYPE",
|
|
49
|
+
"UNSUPPORTED_MODE",
|
|
50
|
+
"UNSUPPORTED_TYPE",
|
|
51
|
+
"raise_compile",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def raise_compile(path: str, code: str, message: str, /) -> NoReturn:
|
|
56
|
+
"""Raise one ``CompileError`` in the frozen ``{path}: {code}: {message}`` shape."""
|
|
57
|
+
|
|
58
|
+
raise CompileError(f"{path}: {code}: {message}")
|