@@ -87,94 +87,83 @@ impl OutputBuilder for VariantOutputBuilder<'_> {
8787 ) -> arrow:: error:: Result < ArrayRef > {
8888 // TODO(perf): avoid builders entirely (and write the raw variant directly as we know the metadata is the same)
8989 match typed_value. data_type ( ) {
90- DataType :: Int8 => {
91- cast_partially_shredded_primitive ! (
92- typed_value,
93- variant_array,
94- Int8Type ,
95- DataType :: Int8
96- )
97- }
98- DataType :: Int16 => {
99- cast_partially_shredded_primitive ! (
100- typed_value,
101- variant_array,
102- Int16Type ,
103- DataType :: Int16
104- )
105- }
106- DataType :: Int32 => {
107- cast_partially_shredded_primitive ! (
108- typed_value,
109- variant_array,
110- Int32Type ,
111- DataType :: Int32
112- )
113- }
114- DataType :: Int64 => {
115- cast_partially_shredded_primitive ! (
116- typed_value,
117- variant_array,
118- Int64Type ,
119- DataType :: Int64
120- )
121- }
122- DataType :: UInt8 => {
123- cast_partially_shredded_primitive ! (
124- typed_value,
125- variant_array,
126- UInt8Type ,
127- DataType :: UInt8
128- )
129- }
130- DataType :: UInt16 => {
131- cast_partially_shredded_primitive ! (
132- typed_value,
133- variant_array,
134- UInt16Type ,
135- DataType :: Int16
136- )
137- }
138- DataType :: UInt32 => {
139- cast_partially_shredded_primitive ! (
140- typed_value,
141- variant_array,
142- UInt32Type ,
143- DataType :: UInt32
144- )
145- }
146- DataType :: UInt64 => {
147- cast_partially_shredded_primitive ! (
148- typed_value,
149- variant_array,
150- UInt64Type ,
151- DataType :: UInt64
152- )
153- }
154- DataType :: Float16 => {
155- cast_partially_shredded_primitive ! (
156- typed_value,
157- variant_array,
158- Float16Type ,
159- DataType :: Float16
160- )
161- }
162- DataType :: Float32 => {
163- cast_partially_shredded_primitive ! (
164- typed_value,
165- variant_array,
166- Float32Type ,
167- DataType :: Float32
168- )
169- }
170- DataType :: Float64 => {
171- cast_partially_shredded_primitive ! (
172- typed_value,
173- variant_array,
174- Float64Type ,
175- DataType :: Float64
176- )
177- }
90+ DataType :: Int8 => cast_partially_shredded_primitive ! (
91+ typed_value,
92+ variant_array,
93+ Int8Type ,
94+ DataType :: Int8
95+ ) ,
96+
97+ DataType :: Int16 => cast_partially_shredded_primitive ! (
98+ typed_value,
99+ variant_array,
100+ Int16Type ,
101+ DataType :: Int16
102+ ) ,
103+
104+ DataType :: Int32 => cast_partially_shredded_primitive ! (
105+ typed_value,
106+ variant_array,
107+ Int32Type ,
108+ DataType :: Int32
109+ ) ,
110+
111+ DataType :: Int64 => cast_partially_shredded_primitive ! (
112+ typed_value,
113+ variant_array,
114+ Int64Type ,
115+ DataType :: Int64
116+ ) ,
117+
118+ DataType :: UInt8 => cast_partially_shredded_primitive ! (
119+ typed_value,
120+ variant_array,
121+ UInt8Type ,
122+ DataType :: UInt8
123+ ) ,
124+
125+ DataType :: UInt16 => cast_partially_shredded_primitive ! (
126+ typed_value,
127+ variant_array,
128+ UInt16Type ,
129+ DataType :: Int16
130+ ) ,
131+
132+ DataType :: UInt32 => cast_partially_shredded_primitive ! (
133+ typed_value,
134+ variant_array,
135+ UInt32Type ,
136+ DataType :: UInt32
137+ ) ,
138+
139+ DataType :: UInt64 => cast_partially_shredded_primitive ! (
140+ typed_value,
141+ variant_array,
142+ UInt64Type ,
143+ DataType :: UInt64
144+ ) ,
145+
146+ DataType :: Float16 => cast_partially_shredded_primitive ! (
147+ typed_value,
148+ variant_array,
149+ Float16Type ,
150+ DataType :: Float16
151+ ) ,
152+
153+ DataType :: Float32 => cast_partially_shredded_primitive ! (
154+ typed_value,
155+ variant_array,
156+ Float32Type ,
157+ DataType :: Float32
158+ ) ,
159+
160+ DataType :: Float64 => cast_partially_shredded_primitive ! (
161+ typed_value,
162+ variant_array,
163+ Float64Type ,
164+ DataType :: Float64
165+ ) ,
166+
178167 dt => {
179168 // https://github.com/apache/arrow-rs/issues/8086
180169 Err ( ArrowError :: NotYetImplemented ( format ! (
@@ -193,94 +182,83 @@ impl OutputBuilder for VariantOutputBuilder<'_> {
193182 ) -> arrow:: error:: Result < ArrayRef > {
194183 // TODO(perf): avoid builders entirely (and write the raw variant directly as we know the metadata is the same)
195184 match typed_value. data_type ( ) {
196- DataType :: Int8 => {
197- cast_perfectly_shredded_primitive ! (
198- typed_value,
199- variant_array,
200- Int8Type ,
201- DataType :: Int8
202- )
203- }
204- DataType :: Int16 => {
205- cast_perfectly_shredded_primitive ! (
206- typed_value,
207- variant_array,
208- Int16Type ,
209- DataType :: Int16
210- )
211- }
212- DataType :: Int32 => {
213- cast_perfectly_shredded_primitive ! (
214- typed_value,
215- variant_array,
216- Int32Type ,
217- DataType :: Int32
218- )
219- }
220- DataType :: Int64 => {
221- cast_perfectly_shredded_primitive ! (
222- typed_value,
223- variant_array,
224- Int64Type ,
225- DataType :: Int64
226- )
227- }
228- DataType :: UInt8 => {
229- cast_perfectly_shredded_primitive ! (
230- typed_value,
231- variant_array,
232- UInt8Type ,
233- DataType :: UInt8
234- )
235- }
236- DataType :: UInt16 => {
237- cast_perfectly_shredded_primitive ! (
238- typed_value,
239- variant_array,
240- UInt16Type ,
241- DataType :: Int16
242- )
243- }
244- DataType :: UInt32 => {
245- cast_perfectly_shredded_primitive ! (
246- typed_value,
247- variant_array,
248- UInt32Type ,
249- DataType :: UInt32
250- )
251- }
252- DataType :: UInt64 => {
253- cast_perfectly_shredded_primitive ! (
254- typed_value,
255- variant_array,
256- UInt64Type ,
257- DataType :: UInt64
258- )
259- }
260- DataType :: Float16 => {
261- cast_perfectly_shredded_primitive ! (
262- typed_value,
263- variant_array,
264- Float16Type ,
265- DataType :: Float16
266- )
267- }
268- DataType :: Float32 => {
269- cast_perfectly_shredded_primitive ! (
270- typed_value,
271- variant_array,
272- Float32Type ,
273- DataType :: Float32
274- )
275- }
276- DataType :: Float64 => {
277- cast_perfectly_shredded_primitive ! (
278- typed_value,
279- variant_array,
280- Float64Type ,
281- DataType :: Float64
282- )
283- }
185+ DataType :: Int8 => cast_perfectly_shredded_primitive ! (
186+ typed_value,
187+ variant_array,
188+ Int8Type ,
189+ DataType :: Int8
190+ ) ,
191+
192+ DataType :: Int16 => cast_perfectly_shredded_primitive ! (
193+ typed_value,
194+ variant_array,
195+ Int16Type ,
196+ DataType :: Int16
197+ ) ,
198+
199+ DataType :: Int32 => cast_perfectly_shredded_primitive ! (
200+ typed_value,
201+ variant_array,
202+ Int32Type ,
203+ DataType :: Int32
204+ ) ,
205+
206+ DataType :: Int64 => cast_perfectly_shredded_primitive ! (
207+ typed_value,
208+ variant_array,
209+ Int64Type ,
210+ DataType :: Int64
211+ ) ,
212+
213+ DataType :: UInt8 => cast_perfectly_shredded_primitive ! (
214+ typed_value,
215+ variant_array,
216+ UInt8Type ,
217+ DataType :: UInt8
218+ ) ,
219+
220+ DataType :: UInt16 => cast_perfectly_shredded_primitive ! (
221+ typed_value,
222+ variant_array,
223+ UInt16Type ,
224+ DataType :: Int16
225+ ) ,
226+
227+ DataType :: UInt32 => cast_perfectly_shredded_primitive ! (
228+ typed_value,
229+ variant_array,
230+ UInt32Type ,
231+ DataType :: UInt32
232+ ) ,
233+
234+ DataType :: UInt64 => cast_perfectly_shredded_primitive ! (
235+ typed_value,
236+ variant_array,
237+ UInt64Type ,
238+ DataType :: UInt64
239+ ) ,
240+
241+ DataType :: Float16 => cast_perfectly_shredded_primitive ! (
242+ typed_value,
243+ variant_array,
244+ Float16Type ,
245+ DataType :: Float16
246+ ) ,
247+
248+ DataType :: Float32 => cast_perfectly_shredded_primitive ! (
249+ typed_value,
250+ variant_array,
251+ Float32Type ,
252+ DataType :: Float32
253+ ) ,
254+
255+ DataType :: Float64 => cast_perfectly_shredded_primitive ! (
256+ typed_value,
257+ variant_array,
258+ Float64Type ,
259+ DataType :: Float64
260+ ) ,
261+
284262 dt => {
285263 // https://github.com/apache/arrow-rs/issues/8087
286264 Err ( ArrowError :: NotYetImplemented ( format ! (
0 commit comments