5252 "Arguments" ,
5353 "Function" ,
5454 "InvocationType" ,
55- "GlobalInitResult " ,
55+ "InitResult " ,
5656 "Level" ,
5757 "Message" ,
5858 "OutputSpec" ,
@@ -253,11 +253,11 @@ def deserialize(cls, data: bytes) -> Self:
253253
254254
255255@dataclass (frozen = True , slots = True )
256- class GlobalInitResult :
256+ class InitResult :
257257 """Result from the global initialization phase of a function.
258258
259259 When a function supports parallel execution (max_processes > 1), the first
260- worker runs perform_init() which returns a GlobalInitResult . This result
260+ worker runs perform_init() which returns a InitResult . This result
261261 contains an identifier that is passed to all subsequent parallel workers
262262 via retrieve_init(), allowing them to share state or coordinate processing.
263263
@@ -285,7 +285,7 @@ def has_identifier(cls, data: pa.RecordBatch) -> bool:
285285 return cls ._IDENTIFIER_FIELD_NAME in data .schema .names
286286
287287 def schema (self ) -> pa .Schema :
288- """Return Arrow schema used when serializing GlobalInitResult .
288+ """Return Arrow schema used when serializing InitResult .
289289
290290 Returns:
291291 Arrow schema with fields for each serialized attribute.
@@ -298,10 +298,10 @@ def schema(self) -> pa.Schema:
298298 )
299299
300300 def serialize (self ) -> bytes :
301- """Serialize GlobalInitResult to an Arrow RecordBatch.
301+ """Serialize InitResult to an Arrow RecordBatch.
302302
303303 Returns:
304- RecordBatch containing serialized GlobalInitResult fields.
304+ RecordBatch containing serialized InitResult fields.
305305
306306 """
307307 batch = pa .RecordBatch .from_pylist (
@@ -315,20 +315,20 @@ def serialize(self) -> bytes:
315315 return vgi .ipc_utils .serialize_record_batch (batch )
316316
317317 @classmethod
318- def deserialize (cls , data : pa .RecordBatch ) -> "GlobalInitResult " :
319- """Deserialize GlobalInitResult from an Arrow RecordBatch.
318+ def deserialize (cls , data : pa .RecordBatch ) -> "InitResult " :
319+ """Deserialize InitResult from an Arrow RecordBatch.
320320
321321 Args:
322- data: RecordBatch containing serialized GlobalInitResult fields.
322+ data: RecordBatch containing serialized InitResult fields.
323323
324324 Returns:
325- Deserialized GlobalInitResult instance.
325+ Deserialized InitResult instance.
326326
327327 """
328328 first_row = vgi .ipc_utils .validate_single_row_batch (
329- data , "GlobalInitResult " , required_fields = [cls ._IDENTIFIER_FIELD_NAME ]
329+ data , "InitResult " , required_fields = [cls ._IDENTIFIER_FIELD_NAME ]
330330 )
331- return GlobalInitResult (
331+ return InitResult (
332332 global_init_identifier = first_row [cls ._IDENTIFIER_FIELD_NAME ],
333333 )
334334
@@ -383,13 +383,13 @@ class Invocation:
383383 # The unique identifier for the call, typically this may be a uuid.
384384 invocation_id : bytes | None
385385
386- global_init_identifier : GlobalInitResult | None = None
386+ global_init_identifier : InitResult | None = None
387387 arguments : Arguments = Arguments ()
388388 client_features : frozenset [str ] = frozenset ()
389389 attach_id : bytes | None = None
390390
391391 def with_global_init_identifier (
392- self , global_init_identifier : GlobalInitResult
392+ self , global_init_identifier : InitResult
393393 ) -> "Invocation" :
394394 """Return a new Invocation with the given global_init_identifier."""
395395 return replace (self , global_init_identifier = global_init_identifier )
@@ -423,7 +423,7 @@ def serialize(self) -> bytes:
423423 "function_type" : self .function_type .value ,
424424 "invocation_id" : self .invocation_id ,
425425 "correlation_id" : self .correlation_id ,
426- GlobalInitResult ._IDENTIFIER_FIELD_NAME : (
426+ InitResult ._IDENTIFIER_FIELD_NAME : (
427427 self .global_init_identifier .global_init_identifier
428428 if self .global_init_identifier
429429 else None
@@ -441,7 +441,7 @@ def serialize(self) -> bytes:
441441 pa .field ("invocation_id" , pa .binary (), nullable = True ),
442442 pa .field ("correlation_id" , pa .string (), nullable = False ),
443443 pa .field (
444- GlobalInitResult ._IDENTIFIER_FIELD_NAME ,
444+ InitResult ._IDENTIFIER_FIELD_NAME ,
445445 pa .binary (),
446446 nullable = True ,
447447 ),
@@ -486,13 +486,13 @@ def deserialize(data: pa.RecordBatch) -> "Invocation":
486486 # Parse function_type from string value
487487 function_type = InvocationType (first_row ["function_type" ])
488488
489- # Parse global_init_identifier - only create GlobalInitResult if field exists
489+ # Parse global_init_identifier - only create InitResult if field exists
490490 # and has a non-None value
491491 global_init_identifier = None
492- if GlobalInitResult ._IDENTIFIER_FIELD_NAME in data .schema .names :
493- identifier_value = first_row [GlobalInitResult ._IDENTIFIER_FIELD_NAME ]
492+ if InitResult ._IDENTIFIER_FIELD_NAME in data .schema .names :
493+ identifier_value = first_row [InitResult ._IDENTIFIER_FIELD_NAME ]
494494 if identifier_value is not None :
495- global_init_identifier = GlobalInitResult (identifier_value )
495+ global_init_identifier = InitResult (identifier_value )
496496
497497 # Parse client_features - default to empty set for backward compatibility
498498 client_features : frozenset [str ] = frozenset ()
@@ -1211,7 +1211,7 @@ def enqueue_work(self, work_items: list[bytes]) -> int:
12111211 ValueError: If init_identifier has not been set.
12121212
12131213 Example:
1214- def perform_init(self, init_input: pa.RecordBatch) -> GlobalInitResult :
1214+ def perform_init(self, init_input: pa.RecordBatch) -> InitResult :
12151215 result = super().perform_init(init_input)
12161216 # Create work items (e.g., ranges to process)
12171217 work_items = [struct.pack(">QQ", start, end) for start, end in ranges]
@@ -1314,20 +1314,20 @@ def _validate_input_schema(self, batch: pa.RecordBatch) -> None:
13141314 context = f"input to { type (self ).__name__ } " ,
13151315 )
13161316
1317- def perform_init (self , init_input : pa .RecordBatch ) -> GlobalInitResult :
1317+ def perform_init (self , init_input : pa .RecordBatch ) -> InitResult :
13181318 """Perform a new init call and store it in the storage."""
13191319 self .init_data = self .InitDataCls .deserialize (init_input )
13201320 assert self .init_data is not None
13211321 self .init_identifier = self .init_storage .create (self .init_data .serialize ())
1322- return GlobalInitResult (self .init_identifier )
1322+ return InitResult (self .init_identifier )
13231323
1324- def retrieve_init (self , init_input : GlobalInitResult ) -> None :
1324+ def retrieve_init (self , init_input : InitResult ) -> None :
13251325 """Retrieve and store init data from the storage."""
13261326 if init_input .global_init_identifier is None :
13271327 raise ValueError (
13281328 "global_init_identifier is required but was None. "
1329- "This indicates the GlobalInitResult was not properly initialized. "
1330- "Ensure perform_init() returns a GlobalInitResult with a valid "
1329+ "This indicates the InitResult was not properly initialized. "
1330+ "Ensure perform_init() returns a InitResult with a valid "
13311331 "identifier."
13321332 )
13331333 self .init_identifier = init_input .global_init_identifier
0 commit comments