MCPcopy Index your code
hub / github.com/feast-dev/feast / _columns_to_proto_values

Function _columns_to_proto_values

sdk/python/feast/utils.py:358–381  ·  view source on GitHub ↗

Convert table columns to proto values dict. Args: table: PyArrow RecordBatch containing the data. columns: List of (column_name, value_type) tuples to convert. allow_missing: If True, skip columns not found in table. If False, raise ValueError. Returns: Dict

(
    table: pyarrow.RecordBatch,
    columns: List[Tuple[str, ValueType]],
    allow_missing: bool = False,
)

Source from the content-addressed store, hash-verified

356
357
358def _columns_to_proto_values(
359 table: pyarrow.RecordBatch,
360 columns: List[Tuple[str, ValueType]],
361 allow_missing: bool = False,
362) -> Dict[str, List[ValueProto]]:
363 """Convert table columns to proto values dict.
364
365 Args:
366 table: PyArrow RecordBatch containing the data.
367 columns: List of (column_name, value_type) tuples to convert.
368 allow_missing: If True, skip columns not found in table. If False, raise ValueError.
369
370 Returns:
371 Dict mapping column names to lists of ValueProto.
372 """
373 result: Dict[str, List[ValueProto]] = {}
374 for column, value_type in columns:
375 if column in table.column_names:
376 result[column] = python_values_to_proto_values(
377 table.column(column).to_numpy(zero_copy_only=False), value_type
378 )
379 elif not allow_missing:
380 raise ValueError(f"Column {column} not found in table")
381 return result
382
383
384def _build_entity_keys(

Callers 2

Calls 2

columnMethod · 0.80

Tested by

no test coverage detected