@@ -139,6 +139,18 @@ def _from_sequence_of_strings(
139139 """Construct a new ExtensionArray from a sequence of strings."""
140140 return cls ._from_sequence (strings , dtype = dtype , copy = copy )
141141
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+
142154 @staticmethod
143155 def _seralizate_json (value ):
144156 """A static method that converts a JSON value into a string representation."""
@@ -174,11 +186,6 @@ def insert(self, loc: int, item) -> JSONArray:
174186 val = JSONArray ._seralizate_json (item )
175187 return super ().insert (loc , val )
176188
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-
182189 def __getitem__ (self , item ):
183190 """Select a subset of self."""
184191 item = check_array_indexer (self , item )
@@ -237,10 +244,3 @@ def __iter__(self):
237244 yield self ._dtype .na_value
238245 else :
239246 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