@@ -139,6 +139,18 @@ def _from_sequence_of_strings(
139
139
"""Construct a new ExtensionArray from a sequence of strings."""
140
140
return cls ._from_sequence (strings , dtype = dtype , copy = copy )
141
141
142
+ @classmethod
143
+ def _concat_same_type (cls , to_concat ) -> JSONArray :
144
+ """Concatenate multiple JSONArray."""
145
+ chunks = [array for ea in to_concat for array in ea ._pa_array .iterchunks ()]
146
+ arr = pa .chunked_array (chunks , type = pa .large_string ())
147
+ return cls (arr )
148
+
149
+ @classmethod
150
+ def _from_factorized (cls , values , original ):
151
+ """Reconstruct an ExtensionArray after factorization."""
152
+ return cls ._from_sequence (values , dtype = original .dtype )
153
+
142
154
@staticmethod
143
155
def _seralizate_json (value ):
144
156
"""A static method that converts a JSON value into a string representation."""
@@ -174,11 +186,6 @@ def insert(self, loc: int, item) -> JSONArray:
174
186
val = JSONArray ._seralizate_json (item )
175
187
return super ().insert (loc , val )
176
188
177
- @classmethod
178
- def _from_factorized (cls , values , original ):
179
- """Reconstruct an ExtensionArray after factorization."""
180
- return cls ._from_sequence (values , dtype = original .dtype )
181
-
182
189
def __getitem__ (self , item ):
183
190
"""Select a subset of self."""
184
191
item = check_array_indexer (self , item )
@@ -237,10 +244,3 @@ def __iter__(self):
237
244
yield self ._dtype .na_value
238
245
else :
239
246
yield val
240
-
241
- @classmethod
242
- def _concat_same_type (cls , to_concat ) -> JSONArray :
243
- """Concatenate multiple JSONArray."""
244
- chunks = [array for ea in to_concat for array in ea ._pa_array .iterchunks ()]
245
- arr = pa .chunked_array (chunks , type = pa .large_string ())
246
- return cls (arr )
0 commit comments