Build entity key protos for each row. Args: num_rows: Number of rows to generate entity keys for. join_keys: Dict mapping join key names to their value types. proto_values: Dict mapping column names to lists of ValueProto values. Returns: List of EntityKeyPr
(
num_rows: int,
join_keys: Dict[str, ValueType],
proto_values: Dict[str, List[ValueProto]],
)
| 382 | |
| 383 | |
| 384 | def _build_entity_keys( |
| 385 | num_rows: int, |
| 386 | join_keys: Dict[str, ValueType], |
| 387 | proto_values: Dict[str, List[ValueProto]], |
| 388 | ) -> List[EntityKeyProto]: |
| 389 | """Build entity key protos for each row. |
| 390 | |
| 391 | Args: |
| 392 | num_rows: Number of rows to generate entity keys for. |
| 393 | join_keys: Dict mapping join key names to their value types. |
| 394 | proto_values: Dict mapping column names to lists of ValueProto values. |
| 395 | |
| 396 | Returns: |
| 397 | List of EntityKeyProto, one per row. |
| 398 | """ |
| 399 | return [ |
| 400 | EntityKeyProto( |
| 401 | join_keys=list(join_keys.keys()), |
| 402 | entity_values=[ |
| 403 | proto_values[k][idx] for k in join_keys if k in proto_values |
| 404 | ], |
| 405 | ) |
| 406 | for idx in range(num_rows) |
| 407 | ] |
| 408 | |
| 409 | |
| 410 | def _convert_arrow_to_proto( |
no test coverage detected