chalkruntime 3.43.76__tar.gz → 3.43.78__tar.gz
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.
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/PKG-INFO +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/convert_chalkpy_underscore.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/feature.py +5 -5
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/filter_conversion.py +4 -4
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/materializations.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/protograph_deserializer.py +3 -3
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/singletons.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/stream_resolver.py +2 -2
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/underscore.py +7 -5
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/variables.py +13 -13
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/batch_result_collector.py +14 -22
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_input.py +1 -3
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_input_upload.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_raw_output_parsing.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/vectorized_hasmany_sampler.py +39 -68
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/loader/converter.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/metadata.py +9 -17
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/filter_query_rewriter.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/message_parsing.py +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/internal_pl_utils.py +6 -6
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime.egg-info/PKG-INFO +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/pyproject.toml +1 -1
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/README.md +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/constants.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/dataframe/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/dataframe/dataframe.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/dataframe/lazyframe.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/exc/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/exc/failed_argument.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/exc/resolver_errors.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/exc/wrapped_resolver_exception.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/_sql_source_pickle_patch.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/chalk_overload.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/dataframe_resolver_correlation.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/feature_alias.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/global_graph.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/graph.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/graph_impl.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/graph_proxy.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/graph_state.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/jinja_parser.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/mat_agg_filter_expression.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/materialized_feature_view.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/maybe_named_collection.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/named_query.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/nearest_neighbor.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/overlay_graph.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/protograph_serializer.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/pseudofeatures.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/resolver.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/sklearn_model_parser.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/source_secrets.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/underscore_codec_info.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/underscore_operation_registry.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/heaptrack_launcher.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/incrementalization/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/incrementalization/group_incrementalizer.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/incrementalization/incrementalizer.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/bound_invoker.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/bound_invoker_cache.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/general_bound_invoker.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/no_arg_scalar_invoker.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/one_to_one_invoker.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/overlay_features.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/parse_external_resolver.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/partition_batch.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/query_execution_parameters.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_args_builder.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_output_metadata.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_result.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_runner.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/sample.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/validator.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/loader/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/loader/importer.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/memray_launcher.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/py.typed +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/branch_model_endpoint_config.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/config.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/entrypoint.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/env_helper.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/remote_python_function_registry_client.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/server_context_snapshot.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/service.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/server/subprocess_hook_service.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/composed_rewriter.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/contextual_query_rewriter.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/filter_injection_site.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/identity_rewriter.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/query_rewriter.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/query_rewriter_helper.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/sqlglot_import_lock.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sql_rewriter/sqlglot_parsing.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/sqlalchemy_mysql_keepalive.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/converter_utils.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/exc.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/resolver_utils.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/streaming_invoker_kernel/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/streaming_invoker_kernel/local_streaming_invoker_kernel.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/types.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/streaming/window_keys.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/__init__.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/async_helpers.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/contextvars.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/datadog.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/posix_file_lock.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/proto_bytes_cache.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/pyarrow_utils.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/tracing.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/utils/viztracer_profiling.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/valgrind_launcher.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime.egg-info/SOURCES.txt +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime.egg-info/dependency_links.txt +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime.egg-info/requires.txt +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime.egg-info/top_level.txt +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/setup.cfg +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/setup.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_branch_model_endpoint_config.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_captured_global_function_refs.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_datadog.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_feature_aliases.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_graph_cache.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_internal_pl_utils.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_mat_agg_filter_expressions.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_mat_agg_projection_expressions.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_materialized_feature_view.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_posix_file_lock.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_pyarrow_utils.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_server_context_snapshot.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_sql_max_row_version_lookback_deserialization.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_sql_retry_policy_deserialization.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_sqlalchemy_mysql_keepalive.py +0 -0
- {chalkruntime-3.43.76 → chalkruntime-3.43.78}/tests/test_subprocess_hook_service.py +0 -0
{chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/graph/convert_chalkpy_underscore.py
RENAMED
|
@@ -654,7 +654,7 @@ def _build_struct_pack_expression(
|
|
|
654
654
|
return UnderscoreOperationExpression(
|
|
655
655
|
operands=FrozenNamedCollection(struct_values),
|
|
656
656
|
operation=get_struct_pack_operation(
|
|
657
|
-
tuple(struct_names),
|
|
657
|
+
tuple(struct_names),
|
|
658
658
|
tuple(value.underscore_result_type.scalar_type for value in struct_values), # pyright: ignore[reportAttributeAccessIssue] # ty: ignore[unresolved-attribute]
|
|
659
659
|
),
|
|
660
660
|
args=tuple(struct_names),
|
|
@@ -765,7 +765,7 @@ class NestedFeatureType(NamedFeatureType, FeatureType, Generic[_InputT_co]):
|
|
|
765
765
|
return NestedFeatureType(
|
|
766
766
|
path=self.path[len(path) + 1 :],
|
|
767
767
|
underlying_ref=self.underlying,
|
|
768
|
-
)
|
|
768
|
+
)
|
|
769
769
|
|
|
770
770
|
@staticmethod
|
|
771
771
|
def absolute_to(
|
|
@@ -1124,7 +1124,7 @@ def canonicalize_typ(x: object):
|
|
|
1124
1124
|
return _to_old_style_type(x)
|
|
1125
1125
|
origin = _to_old_style_type(origin)
|
|
1126
1126
|
args = tuple(canonicalize_typ(x) for x in args)
|
|
1127
|
-
return origin[args] #
|
|
1127
|
+
return origin[args] # pyright: ignore -- pyright doesn't understand metaprogramming
|
|
1128
1128
|
|
|
1129
1129
|
|
|
1130
1130
|
@dataclasses.dataclass(frozen=True, slots=True)
|
|
@@ -3241,7 +3241,7 @@ def all_has_many_subfeatures(
|
|
|
3241
3241
|
if isinstance(ft, NestedFeatureType):
|
|
3242
3242
|
# FIXME: Support parsing nested has-many using index notation e.g.
|
|
3243
3243
|
# User.accounts[Account.type == 'CHECKING', Account.transactions[Transaction.amount > 100, Transaction.amount]]
|
|
3244
|
-
for i, x in enumerate(list(ft.walk_path_joins())):
|
|
3244
|
+
for i, x in enumerate(list(ft.walk_path_joins())):
|
|
3245
3245
|
if isinstance(x, HasManyFeatureType):
|
|
3246
3246
|
if i == 0:
|
|
3247
3247
|
subfeatures.append(x)
|
|
@@ -3261,7 +3261,7 @@ def all_has_many_subfeatures(
|
|
|
3261
3261
|
assert isinstance(ft, NestedFeatureType)
|
|
3262
3262
|
subfeatures[-1] = has_many_subfeatures_to_projection(
|
|
3263
3263
|
subfeatures[-1],
|
|
3264
|
-
[x.relative_to(subfeatures[-1]) for x in ft.flatten(graph)],
|
|
3264
|
+
[x.relative_to(subfeatures[-1]) for x in ft.flatten(graph)],
|
|
3265
3265
|
)
|
|
3266
3266
|
return tuple(subfeatures)
|
|
3267
3267
|
|
|
@@ -3485,7 +3485,7 @@ def is_primary_key_feature_type(ft: object) -> TypeGuard[ScalarFeatureType]:
|
|
|
3485
3485
|
def is_optional_has_one(ft: FeatureType) -> bool:
|
|
3486
3486
|
return isinstance(ft, NestedFeatureType) and any(
|
|
3487
3487
|
isinstance(feature_step, HasOneFeatureType) and feature_step.is_feature_nullable
|
|
3488
|
-
for feature_step in ft.walk_all_steps()
|
|
3488
|
+
for feature_step in ft.walk_all_steps()
|
|
3489
3489
|
)
|
|
3490
3490
|
|
|
3491
3491
|
|
|
@@ -177,8 +177,8 @@ class FilterParsedConverter(Generic[TExpr]):
|
|
|
177
177
|
# LHS is literal. Encode it into the rhs_dtype
|
|
178
178
|
assert rhs_converter is not None, "One side of the filter must be an expression"
|
|
179
179
|
if not self._ff._is_expr(lhs): # pyright:ignore[reportPrivateUsage]
|
|
180
|
-
|
|
181
|
-
lhs = self._ff.lit(
|
|
180
|
+
lhs_pa_values = rhs_converter.from_json_to_pyarrow([lhs]) # pyright: ignore # ty: ignore[invalid-argument-type]
|
|
181
|
+
lhs = self._ff.lit(lhs_pa_values.to_pylist()[0], rhs_converter.pyarrow_dtype)
|
|
182
182
|
if rhs_converter is None:
|
|
183
183
|
# RHS is literal. Encode it into the lhs_dtype
|
|
184
184
|
assert lhs_converter is not None, "One side of the filter must be an expression"
|
|
@@ -190,9 +190,9 @@ class FilterParsedConverter(Generic[TExpr]):
|
|
|
190
190
|
for rhs_scalar in lhs_converter.from_json_to_pyarrow(rhs) # pyright: ignore # ty:ignore[invalid-argument-type]
|
|
191
191
|
]
|
|
192
192
|
else:
|
|
193
|
-
|
|
193
|
+
rhs_pa_values = lhs_converter.from_json_to_pyarrow([rhs]) # pyright: ignore # ty: ignore[invalid-argument-type]
|
|
194
194
|
rhs = self._ff.lit(
|
|
195
|
-
|
|
195
|
+
rhs_pa_values.to_pylist()[0],
|
|
196
196
|
lhs_converter.pyarrow_dtype,
|
|
197
197
|
)
|
|
198
198
|
|
|
@@ -78,7 +78,7 @@ class TimeSeriesRuleParsedAggregationType(Enum):
|
|
|
78
78
|
"n": pa.int64(),
|
|
79
79
|
"sort_by": pa.large_list(pa.field("element", input_types[1])),
|
|
80
80
|
"values": pa.large_list(pa.field("element", input_types[0])),
|
|
81
|
-
}
|
|
81
|
+
}.items()
|
|
82
82
|
)
|
|
83
83
|
case TimeSeriesRuleParsedAggregationType.SetAgg:
|
|
84
84
|
# set_agg's intermediate state is a deduplicated array of input values. The list
|
|
@@ -1383,7 +1383,7 @@ class FromProtoConverter:
|
|
|
1383
1383
|
"min_length_arrow",
|
|
1384
1384
|
"max_length_arrow",
|
|
1385
1385
|
]:
|
|
1386
|
-
value = _extract_validation(v, name) # pyright: ignore
|
|
1386
|
+
value = _extract_validation(v, name) # pyright: ignore
|
|
1387
1387
|
validation_dict: dict[str, int | float | None] = {
|
|
1388
1388
|
"min": None,
|
|
1389
1389
|
"max": None,
|
|
@@ -2453,7 +2453,7 @@ class FromProtoConverter:
|
|
|
2453
2453
|
send_to=send_to,
|
|
2454
2454
|
output_features=output_features,
|
|
2455
2455
|
feature_expressions=transformations,
|
|
2456
|
-
format=r.message_producer.format,
|
|
2456
|
+
format=r.message_producer.format,
|
|
2457
2457
|
message_key=message_key,
|
|
2458
2458
|
)
|
|
2459
2459
|
|
|
@@ -2819,7 +2819,7 @@ class FromProtoConverter:
|
|
|
2819
2819
|
if r.HasField("incremental_settings")
|
|
2820
2820
|
else None,
|
|
2821
2821
|
is_externally_defined=is_externally_defined,
|
|
2822
|
-
output_row_order=output_row_order,
|
|
2822
|
+
output_row_order=output_row_order,
|
|
2823
2823
|
max_batch_size=max_batch_size,
|
|
2824
2824
|
venv=r.venv if r.HasField("venv") else None,
|
|
2825
2825
|
postprocessing=postprocessing_expr,
|
|
@@ -102,7 +102,7 @@ class SingletonGraphAugmenter:
|
|
|
102
102
|
# we need to replace the singleton feature with the has-one feature.
|
|
103
103
|
arg_through_has_one = SingletonGraphAugmenter.nest_singleton_feature(arg, ns)
|
|
104
104
|
assert isinstance(r.inputs, list)
|
|
105
|
-
r.inputs[i] = arg_through_has_one
|
|
105
|
+
r.inputs[i] = arg_through_has_one
|
|
106
106
|
|
|
107
107
|
if r.output and len(r.output.features) == 1:
|
|
108
108
|
df_type = r.output.features[0]
|
|
@@ -52,7 +52,7 @@ from libchalk.chalktable import Expr
|
|
|
52
52
|
|
|
53
53
|
if TYPE_CHECKING:
|
|
54
54
|
from pydantic import BaseModel
|
|
55
|
-
from pydantic.fields import FieldInfo, ModelField
|
|
55
|
+
from pydantic.fields import FieldInfo, ModelField
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
PydanticType = TypeVar("PydanticType", bound="BaseModel")
|
|
@@ -73,7 +73,7 @@ def _convert_field_v2(name: str, info: "FieldInfo") -> pa.Field:
|
|
|
73
73
|
nullable = info.is_required() is False # pyright: ignore # ty: ignore[unresolved-attribute] -- two versions of pydantic
|
|
74
74
|
|
|
75
75
|
alias = info.alias
|
|
76
|
-
typ_ = rich_to_pyarrow(annotation, alias if alias is not None else name)
|
|
76
|
+
typ_ = rich_to_pyarrow(annotation, alias if alias is not None else name)
|
|
77
77
|
return pa.field(
|
|
78
78
|
metadata={"chalk_field_name": name},
|
|
79
79
|
name=name,
|
|
@@ -1829,11 +1829,13 @@ class UnderscoreMaterializedStateOperation(UnderscoreValue):
|
|
|
1829
1829
|
return UnderscoreResultScalarType(
|
|
1830
1830
|
scalar_type=pa.large_list(
|
|
1831
1831
|
pa.struct(
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1832
|
+
(
|
|
1833
|
+
{"ts": pa.timestamp("ns", "UTC")}
|
|
1834
|
+
| {
|
|
1835
|
+
ty.time_series_rule_name(): ty.bucket_result_type(input_types)
|
|
1836
|
+
for ty in convert_materialized_aggregation_type_to_timeseries_rule_aggregation_type(agg_ty)
|
|
1837
|
+
}
|
|
1838
|
+
).items()
|
|
1837
1839
|
)
|
|
1838
1840
|
)
|
|
1839
1841
|
)
|
|
@@ -53,23 +53,23 @@ def _parse_python_type(value: object) -> types_pb.Ty:
|
|
|
53
53
|
return _any_proto_ty
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
_missing = object()
|
|
57
|
-
|
|
58
|
-
|
|
59
56
|
def get_variables(variables: Iterable[types_pb.CodeVariable]) -> Iterable[types_pb.CodeVariableValue]:
|
|
60
57
|
for variable in variables:
|
|
61
58
|
try:
|
|
62
59
|
module = importlib.import_module(variable.module)
|
|
63
60
|
except ImportError:
|
|
64
61
|
continue
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
try:
|
|
63
|
+
value = getattr(module, variable.name)
|
|
64
|
+
except AttributeError:
|
|
65
|
+
continue
|
|
66
|
+
ty = _parse_python_type(value)
|
|
67
|
+
try:
|
|
68
|
+
proto_scalar = pa_scalar_to_proto(pa.scalar(value))
|
|
69
|
+
except Exception:
|
|
70
|
+
continue
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
yield types_pb.CodeVariableValue(
|
|
73
|
+
variable=variable,
|
|
74
|
+
value=types_pb.SymbolicConst(value=proto_scalar, ty=ty),
|
|
75
|
+
)
|
{chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/batch_result_collector.py
RENAMED
|
@@ -744,10 +744,10 @@ class ResultCollector:
|
|
|
744
744
|
TS_COL_NAME,
|
|
745
745
|
pa.nulls(len(result), pa.timestamp("us", "UTC")).fill_null(cast(Any, execution_timestamp)),
|
|
746
746
|
)
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
)
|
|
747
|
+
index_column = pa.nulls(len(result), pa.int64())
|
|
748
|
+
if index is not None:
|
|
749
|
+
index_column = index_column.fill_null(index)
|
|
750
|
+
result = result.append_column(INDEX_COL_NAME, index_column)
|
|
751
751
|
try:
|
|
752
752
|
result = pa_cast(result, self._metadata.pa_schema)
|
|
753
753
|
except Exception as e:
|
|
@@ -820,15 +820,9 @@ class ResultCollector:
|
|
|
820
820
|
# This is a weird hack -- this is a much faster way of going from @features
|
|
821
821
|
# classes to arrow list[struct] type for resolvers that do things like return
|
|
822
822
|
# Features[Account.transactions]
|
|
823
|
-
struct = (
|
|
824
|
-
DataFrame(values[0]) # ty:ignore[unresolved-attribute]
|
|
825
|
-
.to_polars()
|
|
826
|
-
.collect()
|
|
827
|
-
.to_struct("foo")
|
|
828
|
-
.to_frame()
|
|
829
|
-
)
|
|
823
|
+
struct = DataFrame(values[0]).to_polars().collect().to_struct("foo").to_frame()
|
|
830
824
|
|
|
831
|
-
grouped = struct.group_by(pl.lit(1))
|
|
825
|
+
grouped = struct.group_by(pl.lit(1))
|
|
832
826
|
|
|
833
827
|
pa_arr = grouped.all()["foo"].to_arrow()
|
|
834
828
|
else:
|
|
@@ -983,7 +977,7 @@ class ResultCollector:
|
|
|
983
977
|
error: ChalkError,
|
|
984
978
|
):
|
|
985
979
|
if pkey is not None:
|
|
986
|
-
error = error.copy(update={"display_primary_key": str(pkey)})
|
|
980
|
+
error = error.copy(update={"display_primary_key": str(pkey)})
|
|
987
981
|
# Do we want to keep track of all the samples that errored? or just the observed at and pkey?
|
|
988
982
|
self._errors.append(_InvocationError(index=index, error=error))
|
|
989
983
|
if self._metadata.is_one_to_one_resolver and index is not None:
|
|
@@ -1032,13 +1026,11 @@ class ResultCollector:
|
|
|
1032
1026
|
# All are valid
|
|
1033
1027
|
col = col.fill_null(default)
|
|
1034
1028
|
else:
|
|
1035
|
-
assert not pc.any(
|
|
1036
|
-
pc.and_(col.is_valid(), pc.invert(is_valid))
|
|
1037
|
-
).as_py(), ( # ty:ignore[unresolved-attribute]
|
|
1029
|
+
assert not pc.any(pc.and_(col.is_valid(), pc.invert(is_valid))).as_py(), (
|
|
1038
1030
|
"If a row is marked as invalid, then all values must be null"
|
|
1039
1031
|
)
|
|
1040
|
-
col = pc.if_else(
|
|
1041
|
-
pc.or_(
|
|
1032
|
+
col = pc.if_else(
|
|
1033
|
+
pc.or_(
|
|
1042
1034
|
col.is_valid(),
|
|
1043
1035
|
is_valid,
|
|
1044
1036
|
),
|
|
@@ -1116,20 +1108,20 @@ def _df_has_duplicate_rows(
|
|
|
1116
1108
|
return
|
|
1117
1109
|
df = lazy_df.collect()
|
|
1118
1110
|
if ts_fqn is None:
|
|
1119
|
-
mask = df.select(pl.col(pkey_fqn)).is_duplicated()
|
|
1111
|
+
mask = df.select(pl.col(pkey_fqn)).is_duplicated()
|
|
1120
1112
|
if not mask.any():
|
|
1121
1113
|
return
|
|
1122
|
-
values = _sample_duplicate_rows(df.filter(mask), [pkey_fqn])
|
|
1114
|
+
values = _sample_duplicate_rows(df.filter(mask), [pkey_fqn])
|
|
1123
1115
|
return _DuplicateReturn(
|
|
1124
1116
|
pkeys=values[pkey_fqn],
|
|
1125
1117
|
timestamps=None,
|
|
1126
1118
|
pkey_fqn=pkey_fqn,
|
|
1127
1119
|
ts_fqn=ts_fqn,
|
|
1128
1120
|
)
|
|
1129
|
-
mask = df.select(pl.struct(pkey_fqn, ts_fqn)).is_duplicated()
|
|
1121
|
+
mask = df.select(pl.struct(pkey_fqn, ts_fqn)).is_duplicated()
|
|
1130
1122
|
if not mask.any():
|
|
1131
1123
|
return
|
|
1132
|
-
values = _sample_duplicate_rows(df.filter(mask), [pkey_fqn, ts_fqn])
|
|
1124
|
+
values = _sample_duplicate_rows(df.filter(mask), [pkey_fqn, ts_fqn])
|
|
1133
1125
|
return _DuplicateReturn(
|
|
1134
1126
|
pkeys=values[pkey_fqn],
|
|
1135
1127
|
timestamps=values[ts_fqn],
|
|
@@ -129,9 +129,7 @@ class LocalResolverInputs:
|
|
|
129
129
|
meta_col_name = get_metadata_col_name(column_name)
|
|
130
130
|
if meta_col_name in scalarish_features.column_names:
|
|
131
131
|
invalid_rows = scalarish_features.column(column_name).filter(
|
|
132
|
-
pc.invert(
|
|
133
|
-
pa_is_value_valid(scalarish_features[meta_col_name])
|
|
134
|
-
) # ty:ignore[unresolved-attribute]
|
|
132
|
+
pc.invert(pa_is_value_valid(scalarish_features[meta_col_name]))
|
|
135
133
|
)
|
|
136
134
|
assert len(invalid_rows) == invalid_rows.null_count, (
|
|
137
135
|
"All invalid rows should already have null values"
|
|
@@ -105,7 +105,7 @@ class StrictResolverInputUploadClient(ResolverInputUploadClient):
|
|
|
105
105
|
packed_arr = (
|
|
106
106
|
pl.concat([df.to_polars().select(pl.struct(pl.all()).implode().alias("packed")) for df in dfs])
|
|
107
107
|
.collect()
|
|
108
|
-
.get_column("packed")
|
|
108
|
+
.get_column("packed")
|
|
109
109
|
.to_arrow()
|
|
110
110
|
)
|
|
111
111
|
all_arrays[f"{arg_idx}_packed_df"] = packed_arr
|
{chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/resolver_raw_output_parsing.py
RENAMED
|
@@ -360,7 +360,7 @@ def resolver_raw_output_to_table(
|
|
|
360
360
|
pkey_column = table.column(pkey_feature_fqn)
|
|
361
361
|
# Only check for empty strings if pkey is a string type
|
|
362
362
|
if pa.types.is_string(pkey_column.type) or pa.types.is_large_string(pkey_column.type):
|
|
363
|
-
has_empty_pkey = pc.any(pc.equal(pkey_column, pa.scalar(""))).as_py()
|
|
363
|
+
has_empty_pkey = pc.any(pc.equal(pkey_column, pa.scalar(""))).as_py()
|
|
364
364
|
|
|
365
365
|
if has_empty_pkey:
|
|
366
366
|
return (
|
{chalkruntime-3.43.76 → chalkruntime-3.43.78}/chalkruntime/invoker/vectorized_hasmany_sampler.py
RENAMED
|
@@ -718,9 +718,7 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
718
718
|
if INDEX_COL_NAME in hm_lf.columns and has_many_feature.underlying.get_nearest_neighbor_join_info():
|
|
719
719
|
unique_on.append(INDEX_COL_NAME)
|
|
720
720
|
hm_lf_unique = hm_lf.unique(subset=unique_on)
|
|
721
|
-
if (hm_lf_unique_len := len(hm_lf_unique.lazy().collect())) != (
|
|
722
|
-
hm_lf_len := len(hm_lf.lazy().collect()) # ty:ignore[invalid-argument-type]
|
|
723
|
-
):
|
|
721
|
+
if (hm_lf_unique_len := len(hm_lf_unique.lazy().collect())) != (hm_lf_len := len(hm_lf.lazy().collect())):
|
|
724
722
|
warnings.warn(
|
|
725
723
|
f"Got duplicated results for {has_many_feature}: Num unique elements: {hm_lf_unique_len}/{hm_lf_len}"
|
|
726
724
|
)
|
|
@@ -860,7 +858,7 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
860
858
|
)
|
|
861
859
|
# try filtering out any rows that definitely don't meet ts consistency criteria to reduce join size
|
|
862
860
|
final_hm_lf_for_join = (
|
|
863
|
-
final_hm_lf_for_join.lazy()
|
|
861
|
+
final_hm_lf_for_join.lazy()
|
|
864
862
|
.join(
|
|
865
863
|
resolver_inputs_greatest_ts_per_input.lazy(),
|
|
866
864
|
right_on=left_join_cols,
|
|
@@ -890,13 +888,13 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
890
888
|
how="inner",
|
|
891
889
|
)
|
|
892
890
|
ungrouped_relevant_rows = ungrouped_relevant_rows.join(
|
|
893
|
-
final_hm_lf_for_join.lazy(),
|
|
891
|
+
final_hm_lf_for_join.lazy(),
|
|
894
892
|
on=INDEX_COL_NAME,
|
|
895
893
|
how="inner",
|
|
896
894
|
)
|
|
897
895
|
else:
|
|
898
896
|
ungrouped_relevant_rows = final_resolver_inputs_for_join.lazy().join(
|
|
899
|
-
final_hm_lf_for_join.lazy(),
|
|
897
|
+
final_hm_lf_for_join.lazy(),
|
|
900
898
|
left_on=left_join_cols,
|
|
901
899
|
right_on=right_join_cols,
|
|
902
900
|
how="inner",
|
|
@@ -971,19 +969,13 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
971
969
|
with safe_trace("VectorizedHasManySampler_get_grouped_rows_ungrouped_relevant_rows_collect"):
|
|
972
970
|
ungrouped_relevant_rows_collected = ungrouped_relevant_rows.select(expected_cols).lazy().collect()
|
|
973
971
|
|
|
974
|
-
group_input_indices: list[int] = (
|
|
975
|
-
|
|
976
|
-
)
|
|
977
|
-
group_pkeys = (
|
|
978
|
-
groups.select(pl.exclude(GROUP_TEMP_COL_NAME)).to_series().to_list() # ty:ignore[unresolved-attribute]
|
|
979
|
-
)
|
|
980
|
-
group_indices_list: list[int] = (
|
|
981
|
-
groups.select(GROUP_TEMP_COL_NAME).to_series().to_list() # ty:ignore[unresolved-attribute]
|
|
982
|
-
)
|
|
972
|
+
group_input_indices: list[int] = groups.select(RESOLVER_INPUT_IDX_COL_NAME).to_series().to_list()
|
|
973
|
+
group_pkeys = groups.select(pl.exclude(GROUP_TEMP_COL_NAME)).to_series().to_list()
|
|
974
|
+
group_indices_list: list[int] = groups.select(GROUP_TEMP_COL_NAME).to_series().to_list()
|
|
983
975
|
|
|
984
976
|
# Perform validation on df schema overall. That way we can skip validation for each group, which would be
|
|
985
977
|
# redundant since each group has the same schema.
|
|
986
|
-
_validate_df_schema(ungrouped_relevant_rows_collected, graph=graph)
|
|
978
|
+
_validate_df_schema(ungrouped_relevant_rows_collected, graph=graph)
|
|
987
979
|
|
|
988
980
|
# Map the index of the group to a tuple where the first element is the primary key for that group, and the
|
|
989
981
|
# second item is a Series of indices (relative to ungrouped_relevant_rows) that specify the row indices for
|
|
@@ -992,7 +984,7 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
992
984
|
groups_dict = {
|
|
993
985
|
group_index: (
|
|
994
986
|
group_pkey,
|
|
995
|
-
ungrouped_relevant_rows_collected[group_indices],
|
|
987
|
+
ungrouped_relevant_rows_collected[group_indices],
|
|
996
988
|
)
|
|
997
989
|
for group_indices, group_pkey, group_index in zip(group_indices_list, group_pkeys, group_input_indices)
|
|
998
990
|
}
|
|
@@ -1020,12 +1012,7 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1020
1012
|
# run in a time that scales with the pre-sliced (i.e. len(ungrouped_relevant_rows) size. This causes
|
|
1021
1013
|
# issues down the line that can slow down resolvers that try to perform ops on it. It's possible a
|
|
1022
1014
|
# future version polars will fix this issue, but for now this avoids it.
|
|
1023
|
-
empty_polars_df = (
|
|
1024
|
-
ungrouped_relevant_rows.slice(0, 0)
|
|
1025
|
-
.select(self._expected_col_names)
|
|
1026
|
-
.collect()
|
|
1027
|
-
.lazy() # ty:ignore[unresolved-attribute]
|
|
1028
|
-
)
|
|
1015
|
+
empty_polars_df = ungrouped_relevant_rows.slice(0, 0).select(self._expected_col_names).collect().lazy()
|
|
1029
1016
|
empty_chalk_df: DataFrame = DataFrame( # ... just get Chalk DF metadata right using one of them.
|
|
1030
1017
|
empty_polars_df,
|
|
1031
1018
|
missing_value_strategy="default_or_allow",
|
|
@@ -1103,7 +1090,7 @@ class PolarsVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1103
1090
|
pl.col(str(has_many_feature))
|
|
1104
1091
|
)
|
|
1105
1092
|
result = ans.select([RESOLVER_INPUT_IDX_COL_NAME, str(has_many_feature)]).collect()
|
|
1106
|
-
return result
|
|
1093
|
+
return result
|
|
1107
1094
|
|
|
1108
1095
|
def join_df_and_pack_into_struct(self) -> pl.DataFrame:
|
|
1109
1096
|
"""
|
|
@@ -1220,7 +1207,7 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1220
1207
|
|
|
1221
1208
|
# Sort by pkey, then by ts.
|
|
1222
1209
|
# This means that all entries with the same pkey will be contiguous.
|
|
1223
|
-
sorted_indices = pc.sort_indices(
|
|
1210
|
+
sorted_indices = pc.sort_indices(
|
|
1224
1211
|
hm_table,
|
|
1225
1212
|
sort_keys=[
|
|
1226
1213
|
(foreign_pkey_feature.root_fqn, "ascending"),
|
|
@@ -1251,8 +1238,8 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1251
1238
|
pa.nulls(1, type=col_foreign_pkeys.type),
|
|
1252
1239
|
]
|
|
1253
1240
|
)
|
|
1254
|
-
replaced_observed_at_array = pc.if_else(
|
|
1255
|
-
pc.equal(col_foreign_pkeys, col_foreign_pkeys_shifted),
|
|
1241
|
+
replaced_observed_at_array = pc.if_else(
|
|
1242
|
+
pc.equal(col_foreign_pkeys, col_foreign_pkeys_shifted),
|
|
1256
1243
|
replaced_observed_at_array,
|
|
1257
1244
|
pa.scalar(None, replaced_observed_at_array.type),
|
|
1258
1245
|
)
|
|
@@ -1274,9 +1261,7 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1274
1261
|
ts_col = hm_table.column(TS_COL_NAME)
|
|
1275
1262
|
|
|
1276
1263
|
# Use coalesce to replace null values in foreign_ts_col with values from ts_col
|
|
1277
|
-
combined_array = pc.if_else(
|
|
1278
|
-
pc.is_valid(foreign_ts_col), foreign_ts_col, ts_col
|
|
1279
|
-
) # ty:ignore[unresolved-attribute]
|
|
1264
|
+
combined_array = pc.if_else(pc.is_valid(foreign_ts_col), foreign_ts_col, ts_col)
|
|
1280
1265
|
# combined_array = pc.coalesce([foreign_ts_col, ts_col])
|
|
1281
1266
|
|
|
1282
1267
|
# Replace the original column in the table
|
|
@@ -1339,38 +1324,32 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1339
1324
|
|
|
1340
1325
|
# Now we need to filter out rows in the has many dataframe whose timestamps make them inapplicable.
|
|
1341
1326
|
with safe_trace("_produce_resolver_args_has_many_has_many___get_ungrouped_rows_pa_filter"):
|
|
1342
|
-
hm_oat_before_cond_1 = pc.less_equal(
|
|
1327
|
+
hm_oat_before_cond_1 = pc.less_equal(
|
|
1343
1328
|
ungrouped_relevant_rows_table.column(OBSERVED_AT_FEATURE_COL_NAME),
|
|
1344
1329
|
ungrouped_relevant_rows_table.column(RESOLVER_INPUT_PREFIX + TS_COL_NAME),
|
|
1345
1330
|
)
|
|
1346
1331
|
|
|
1347
1332
|
hm_oat_before_cond_1 = pc.fill_null(hm_oat_before_cond_1, False) # ty: ignore[invalid-argument-type]
|
|
1348
1333
|
|
|
1349
|
-
hm_oat_before_cond_2 = pc.is_null(
|
|
1350
|
-
|
|
1351
|
-
) # ty:ignore[unresolved-attribute]
|
|
1352
|
-
hm_oat_before_input_ts_expr = pc.or_(
|
|
1353
|
-
hm_oat_before_cond_1, hm_oat_before_cond_2
|
|
1354
|
-
) # ty:ignore[unresolved-attribute]
|
|
1334
|
+
hm_oat_before_cond_2 = pc.is_null(ungrouped_relevant_rows_table.column(OBSERVED_AT_FEATURE_COL_NAME))
|
|
1335
|
+
hm_oat_before_input_ts_expr = pc.or_(hm_oat_before_cond_1, hm_oat_before_cond_2)
|
|
1355
1336
|
|
|
1356
|
-
hm_oat_after_cond_1 = pc.less(
|
|
1337
|
+
hm_oat_after_cond_1 = pc.less(
|
|
1357
1338
|
ungrouped_relevant_rows_table.column(RESOLVER_INPUT_PREFIX + TS_COL_NAME),
|
|
1358
1339
|
ungrouped_relevant_rows_table.column(REPLACED_OBSERVED_AT_FEATURE_COL_NAME),
|
|
1359
1340
|
)
|
|
1360
1341
|
|
|
1361
1342
|
hm_oat_after_cond_1 = pc.fill_null(hm_oat_after_cond_1, False) # ty: ignore[invalid-argument-type]
|
|
1362
1343
|
|
|
1363
|
-
hm_oat_after_cond_2 = pc.is_null(
|
|
1344
|
+
hm_oat_after_cond_2 = pc.is_null(
|
|
1364
1345
|
ungrouped_relevant_rows_table.column(REPLACED_OBSERVED_AT_FEATURE_COL_NAME)
|
|
1365
1346
|
)
|
|
1366
|
-
hm_oat_after_input_ts_expr = pc.or_(
|
|
1367
|
-
hm_oat_after_cond_1, hm_oat_after_cond_2
|
|
1368
|
-
) # ty:ignore[unresolved-attribute]
|
|
1347
|
+
hm_oat_after_input_ts_expr = pc.or_(hm_oat_after_cond_1, hm_oat_after_cond_2)
|
|
1369
1348
|
|
|
1370
1349
|
# Combine the bf and af expressions
|
|
1371
|
-
ts_consistency_expr = pc.and_(
|
|
1350
|
+
ts_consistency_expr = pc.and_(
|
|
1372
1351
|
hm_oat_before_input_ts_expr, hm_oat_after_input_ts_expr
|
|
1373
|
-
)
|
|
1352
|
+
) # ty: ignore[no-matching-overload]
|
|
1374
1353
|
ungrouped_relevant_rows_table = ungrouped_relevant_rows_table.filter(ts_consistency_expr)
|
|
1375
1354
|
|
|
1376
1355
|
# Apply all the polars filters that were generated from the dataframe filters (like last 7 days, last month,
|
|
@@ -1402,14 +1381,12 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1402
1381
|
pl_filter_mask = converter.fill_null(pl_filter_mask, converter.lit(False, pa.bool_()))
|
|
1403
1382
|
ungrouped_relevant_rows_df = ungrouped_relevant_rows_df.filter(pl_filter_mask)
|
|
1404
1383
|
ungrouped_relevant_rows_table = pa_cast(
|
|
1405
|
-
ungrouped_relevant_rows_df.collect().to_arrow(),
|
|
1406
|
-
ungrouped_relevant_rows_table.schema,
|
|
1384
|
+
ungrouped_relevant_rows_df.collect().to_arrow(),
|
|
1385
|
+
ungrouped_relevant_rows_table.schema,
|
|
1407
1386
|
)
|
|
1408
1387
|
|
|
1409
1388
|
# Filter for rows where the foreign primary key is not null
|
|
1410
|
-
non_null_mask = pc.is_valid(
|
|
1411
|
-
ungrouped_relevant_rows_table.column(foreign_pkey_feature.root_fqn)
|
|
1412
|
-
) # ty:ignore[unresolved-attribute]
|
|
1389
|
+
non_null_mask = pc.is_valid(ungrouped_relevant_rows_table.column(foreign_pkey_feature.root_fqn))
|
|
1413
1390
|
ungrouped_relevant_rows_table = ungrouped_relevant_rows_table.filter(non_null_mask)
|
|
1414
1391
|
|
|
1415
1392
|
# Get the columns we want
|
|
@@ -1444,28 +1421,22 @@ class PyArrowVectorizedHasManySampler(VectorizedHasManySampler):
|
|
|
1444
1421
|
mask = None
|
|
1445
1422
|
for j, group_key in enumerate(group_keys):
|
|
1446
1423
|
if mask is None:
|
|
1447
|
-
mask = pc.and_(
|
|
1424
|
+
mask = pc.and_(
|
|
1448
1425
|
pc.fill_null(
|
|
1449
1426
|
pc.equal(ungrouped_relevant_rows_table.column(self._right_join_cols[j]), group_key),
|
|
1450
1427
|
False, # ty: ignore[invalid-argument-type]
|
|
1451
1428
|
),
|
|
1452
|
-
pc.equal(
|
|
1453
|
-
ungrouped_relevant_rows_table.column(RESOLVER_INPUT_IDX_COL_NAME), pa.scalar(i)
|
|
1454
|
-
), # ty: ignore[unresolved-attribute]
|
|
1429
|
+
pc.equal(ungrouped_relevant_rows_table.column(RESOLVER_INPUT_IDX_COL_NAME), pa.scalar(i)),
|
|
1455
1430
|
)
|
|
1456
1431
|
else:
|
|
1457
|
-
mask = pc.and_(
|
|
1432
|
+
mask = pc.and_(
|
|
1458
1433
|
mask,
|
|
1459
|
-
pc.and_(
|
|
1434
|
+
pc.and_(
|
|
1460
1435
|
pc.fill_null(
|
|
1461
|
-
pc.equal(
|
|
1462
|
-
ungrouped_relevant_rows_table.column(self._right_join_cols[j]), group_key
|
|
1463
|
-
), # ty: ignore[unresolved-attribute]
|
|
1436
|
+
pc.equal(ungrouped_relevant_rows_table.column(self._right_join_cols[j]), group_key),
|
|
1464
1437
|
False, # ty: ignore[invalid-argument-type]
|
|
1465
1438
|
),
|
|
1466
|
-
pc.equal(
|
|
1467
|
-
ungrouped_relevant_rows_table.column(RESOLVER_INPUT_IDX_COL_NAME), pa.scalar(i)
|
|
1468
|
-
), # ty:ignore[unresolved-attribute]
|
|
1439
|
+
pc.equal(ungrouped_relevant_rows_table.column(RESOLVER_INPUT_IDX_COL_NAME), pa.scalar(i)),
|
|
1469
1440
|
),
|
|
1470
1441
|
)
|
|
1471
1442
|
assert mask is not None, "the mask should always be constructed by this point"
|
|
@@ -1620,7 +1591,7 @@ class NestedHasManySampler:
|
|
|
1620
1591
|
unique_resolver_inputs=outer_unique,
|
|
1621
1592
|
enable_indexed_has_many_joins=False,
|
|
1622
1593
|
allow_planner_postponed_has_many_sampling_planner_option=self._allow_postponed,
|
|
1623
|
-
).collect()
|
|
1594
|
+
).collect()
|
|
1624
1595
|
|
|
1625
1596
|
# --- Step 2: rename outer idx to backup so inner samplers get fresh row indices ---
|
|
1626
1597
|
# current_rows has _OUTER_IDX=outer_idx, course cols — no RESOLVER_INPUT_IDX_COL_NAME
|
|
@@ -1723,7 +1694,7 @@ def _get_expected_pl_dtype_for_feature(
|
|
|
1723
1694
|
for path_obj in ft.path:
|
|
1724
1695
|
if is_underlying_has_many(path_obj.parent):
|
|
1725
1696
|
dtype = pl.List(inner=dtype) # pyright: ignore - polars backcompat
|
|
1726
|
-
return cast(pl.DataType, dtype)
|
|
1697
|
+
return cast(pl.DataType, dtype)
|
|
1727
1698
|
|
|
1728
1699
|
|
|
1729
1700
|
def _validate_df_schema(underlying: Union[pl.DataFrame, pl.LazyFrame], graph: ResolvedGraph):
|
|
@@ -1739,7 +1710,7 @@ def _validate_df_schema(underlying: Union[pl.DataFrame, pl.LazyFrame], graph: Re
|
|
|
1739
1710
|
if actual_dtype == expected_dtype:
|
|
1740
1711
|
continue
|
|
1741
1712
|
if isinstance(underlying, pl.LazyFrame):
|
|
1742
|
-
underlying = underlying.collect()
|
|
1713
|
+
underlying = underlying.collect()
|
|
1743
1714
|
assert isinstance(underlying, pl.DataFrame)
|
|
1744
1715
|
if len(underlying) == underlying.get_column(root_fqn).null_count() and actual_dtype != expected_dtype:
|
|
1745
1716
|
# If all values are null, then replace with a null series of the correct datatype
|
|
@@ -1749,7 +1720,7 @@ def _validate_df_schema(underlying: Union[pl.DataFrame, pl.LazyFrame], graph: Re
|
|
|
1749
1720
|
_generate_empty_series_for_dtype(
|
|
1750
1721
|
root_fqn,
|
|
1751
1722
|
expected_dtype,
|
|
1752
|
-
len(underlying),
|
|
1723
|
+
len(underlying),
|
|
1753
1724
|
)
|
|
1754
1725
|
)
|
|
1755
1726
|
elif (
|
|
@@ -1763,7 +1734,7 @@ def _validate_df_schema(underlying: Union[pl.DataFrame, pl.LazyFrame], graph: Re
|
|
|
1763
1734
|
f"Values for list feature `{root_fqn}` could not be deserialized from a JSON string to dtype `{expected_dtype}`."
|
|
1764
1735
|
) from e
|
|
1765
1736
|
|
|
1766
|
-
deser_actual_dtype = underlying[root_fqn].dtype
|
|
1737
|
+
deser_actual_dtype = underlying[root_fqn].dtype
|
|
1767
1738
|
if deser_actual_dtype != expected_dtype:
|
|
1768
1739
|
raise TypeError(
|
|
1769
1740
|
f"Values for list feature `{root_fqn}` could not be deserialized from a JSON string to dtype `{expected_dtype}`. Found type {deser_actual_dtype}, instead."
|
|
@@ -1773,12 +1744,12 @@ def _validate_df_schema(underlying: Union[pl.DataFrame, pl.LazyFrame], graph: Re
|
|
|
1773
1744
|
# dictionaries / dataclasses are of the correct type
|
|
1774
1745
|
col = pl.col(root_fqn).cast(expected_dtype)
|
|
1775
1746
|
try:
|
|
1776
|
-
underlying = underlying.with_columns(underlying.select(col))
|
|
1747
|
+
underlying = underlying.with_columns(underlying.select(col))
|
|
1777
1748
|
except (pl.exceptions.ComputeError, PolarsPanicErrorCompat) as e:
|
|
1778
1749
|
try:
|
|
1779
1750
|
series = pl.from_arrow(
|
|
1780
1751
|
underlying.select(pl.col(root_fqn))
|
|
1781
|
-
.to_arrow()[root_fqn]
|
|
1752
|
+
.to_arrow()[root_fqn]
|
|
1782
1753
|
.cast(feature.resolve_pyarrow_dtype(graph))
|
|
1783
1754
|
)
|
|
1784
1755
|
assert isinstance(series, pl.Series)
|
|
@@ -483,7 +483,7 @@ class RegistryConverter:
|
|
|
483
483
|
)
|
|
484
484
|
return FilterParsed(
|
|
485
485
|
lhs=self._convert_filter(f.lhs),
|
|
486
|
-
operation=f.operation,
|
|
486
|
+
operation=f.operation,
|
|
487
487
|
rhs=self._convert_filter(f.rhs),
|
|
488
488
|
)
|
|
489
489
|
if f.operation == "not":
|