2828# Implements the Column class as documented in DataFrame API
2929# -----------------------------------------------------------------------------
3030
31- from typing import Any , Iterable , Optional
31+ from typing import Any , Dict , Iterable , Optional , Tuple
3232
3333from .buffer import OracleColumnBuffer
3434from .protocol import (
35+ CategoricalDescription ,
3536 Column ,
3637 Dtype ,
3738 ColumnBuffers ,
3839 ColumnNullType ,
3940 DtypeKind ,
40- Endianness ,
4141)
4242
4343from .nanoarrow_bridge import (
@@ -88,7 +88,7 @@ def _offsets_buffer(self):
8888 offsets_buffer = OracleColumnBuffer (
8989 size_in_bytes = size_bytes , address = address , buffer_type = "offsets"
9090 )
91- dtype = (DtypeKind .INT , 32 , "i" , Endianness . NATIVE )
91+ dtype = (DtypeKind .INT , 32 , "i" , "=" )
9292 return offsets_buffer , dtype
9393
9494 def _validity_buffer (self ):
@@ -99,11 +99,17 @@ def _validity_buffer(self):
9999 validity_buffer = OracleColumnBuffer (
100100 size_in_bytes = size_bytes , address = address , buffer_type = "validity"
101101 )
102- dtype = (DtypeKind .BOOL , 1 , "b" , Endianness . NATIVE )
102+ dtype = (DtypeKind .BOOL , 1 , "b" , "=" )
103103 return validity_buffer , dtype
104104
105+ def describe_categorical (self ) -> CategoricalDescription :
106+ """
107+ Returns a description of a categorical data type.
108+ """
109+ raise NotImplementedError ()
110+
105111 @property
106- def describe_null (self ) -> tuple [ColumnNullType , Optional [int ]]:
112+ def describe_null (self ) -> Tuple [ColumnNullType , Optional [int ]]:
107113 """
108114 Returns a description of the null representation used by the column.
109115 """
@@ -119,29 +125,29 @@ def dtype(self) -> Dtype:
119125 information on the storage format and the type of data in the column.
120126 """
121127 if self .ora_arrow_array .arrow_type == NANOARROW_TYPE_INT64 :
122- return (DtypeKind .INT , 64 , "l" , Endianness . NATIVE )
128+ return (DtypeKind .INT , 64 , "l" , "=" )
123129 elif self .ora_arrow_array .arrow_type == NANOARROW_TYPE_DOUBLE :
124- return (DtypeKind .FLOAT , 64 , "g" , Endianness . NATIVE )
130+ return (DtypeKind .FLOAT , 64 , "g" , "=" )
125131 elif self .ora_arrow_array .arrow_type == NANOARROW_TYPE_FLOAT :
126- return (DtypeKind .FLOAT , 64 , "g" , Endianness . NATIVE )
132+ return (DtypeKind .FLOAT , 64 , "g" , "=" )
127133 elif self .ora_arrow_array .arrow_type == NANOARROW_TYPE_STRING :
128- return (DtypeKind .STRING , 8 , "u" , Endianness . NATIVE )
134+ return (DtypeKind .STRING , 8 , "u" , "=" )
129135 elif self .ora_arrow_array .arrow_type == NANOARROW_TYPE_TIMESTAMP :
130136 if self .ora_arrow_array .time_unit == NANOARROW_TIME_UNIT_MICRO :
131- return (DtypeKind .DATETIME , 64 , "tsu:" , Endianness . NATIVE )
137+ return (DtypeKind .DATETIME , 64 , "tsu:" , "=" )
132138 elif self .ora_arrow_array .time_unit == NANOARROW_TIME_UNIT_SECOND :
133- return (DtypeKind .DATETIME , 64 , "tss:" , Endianness . NATIVE )
139+ return (DtypeKind .DATETIME , 64 , "tss:" , "=" )
134140 elif self .ora_arrow_array .time_unit == NANOARROW_TIME_UNIT_MILLI :
135- return (DtypeKind .DATETIME , 64 , "tsm:" , Endianness . NATIVE )
141+ return (DtypeKind .DATETIME , 64 , "tsm:" , "=" )
136142 elif self .ora_arrow_array .time_unit == NANOARROW_TIME_UNIT_NANO :
137- return (DtypeKind .DATETIME , 64 , "tsn:" , Endianness . NATIVE )
143+ return (DtypeKind .DATETIME , 64 , "tsn:" , "=" )
138144 elif self .ora_arrow_array .arrow_type == NANOARROW_TYPE_DECIMAL128 :
139145 array = self .ora_arrow_array
140146 return (
141147 DtypeKind .DECIMAL ,
142148 128 ,
143149 f"d:{ array .precision } .{ array .scale } " ,
144- Endianness . NATIVE ,
150+ "=" ,
145151 )
146152
147153 def get_buffers (self ) -> ColumnBuffers :
@@ -166,7 +172,7 @@ def get_chunks(self, n_chunks: Optional[int] = None) -> Iterable[Column]:
166172 yield self
167173
168174 @property
169- def metadata (self ) -> dict [str , Any ]:
175+ def metadata (self ) -> Dict [str , Any ]:
170176 """
171177 Returns metadata about the column.
172178 """
0 commit comments