Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/cloud/bigquery_storage_v1/types/arrow.py: 94%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

17 statements  

1# -*- coding: utf-8 -*- 

2# Copyright 2025 Google LLC 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15# 

16from __future__ import annotations 

17 

18from typing import MutableMapping, MutableSequence 

19 

20import proto # type: ignore 

21 

22__protobuf__ = proto.module( 

23 package="google.cloud.bigquery.storage.v1", 

24 manifest={ 

25 "ArrowSchema", 

26 "ArrowRecordBatch", 

27 "ArrowSerializationOptions", 

28 }, 

29) 

30 

31 

32class ArrowSchema(proto.Message): 

33 r"""Arrow schema as specified in 

34 https://arrow.apache.org/docs/python/api/datatypes.html and 

35 serialized to bytes using IPC: 

36 

37 https://arrow.apache.org/docs/format/Columnar.html#serialization-and-interprocess-communication-ipc 

38 

39 See code samples on how this message can be deserialized. 

40 

41 Attributes: 

42 serialized_schema (bytes): 

43 IPC serialized Arrow schema. 

44 """ 

45 

46 serialized_schema: bytes = proto.Field( 

47 proto.BYTES, 

48 number=1, 

49 ) 

50 

51 

52class ArrowRecordBatch(proto.Message): 

53 r"""Arrow RecordBatch. 

54 

55 Attributes: 

56 serialized_record_batch (bytes): 

57 IPC-serialized Arrow RecordBatch. 

58 row_count (int): 

59 [Deprecated] The count of rows in 

60 ``serialized_record_batch``. Please use the 

61 format-independent ReadRowsResponse.row_count instead. 

62 """ 

63 

64 serialized_record_batch: bytes = proto.Field( 

65 proto.BYTES, 

66 number=1, 

67 ) 

68 row_count: int = proto.Field( 

69 proto.INT64, 

70 number=2, 

71 ) 

72 

73 

74class ArrowSerializationOptions(proto.Message): 

75 r"""Contains options specific to Arrow Serialization. 

76 

77 Attributes: 

78 buffer_compression (google.cloud.bigquery_storage_v1.types.ArrowSerializationOptions.CompressionCodec): 

79 The compression codec to use for Arrow 

80 buffers in serialized record batches. 

81 """ 

82 

83 class CompressionCodec(proto.Enum): 

84 r"""Compression codec's supported by Arrow. 

85 

86 Values: 

87 COMPRESSION_UNSPECIFIED (0): 

88 If unspecified no compression will be used. 

89 LZ4_FRAME (1): 

90 LZ4 Frame 

91 (https://github.com/lz4/lz4/blob/dev/doc/lz4_Frame_format.md) 

92 ZSTD (2): 

93 Zstandard compression. 

94 """ 

95 COMPRESSION_UNSPECIFIED = 0 

96 LZ4_FRAME = 1 

97 ZSTD = 2 

98 

99 buffer_compression: CompressionCodec = proto.Field( 

100 proto.ENUM, 

101 number=2, 

102 enum=CompressionCodec, 

103 ) 

104 

105 

106__all__ = tuple(sorted(__protobuf__.manifest))