11/*
2- * Licensed to the Apache Software Foundation (ASF) under one or more
3- * contributor license agreements. See the NOTICE file distributed with
4- * this work for additional information regarding copyright ownership.
5- * The ASF licenses this file to You under the Apache License, Version 2.0
6- * (the "License"); you may not use this file except in compliance with
7- * the License. You may obtain a copy of the License at
8- *
9- * http://www.apache.org/licenses/LICENSE-2.0
10- *
11- * Unless required by applicable law or agreed to in writing, software
12- * distributed under the License is distributed on an "AS IS" BASIS,
13- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14- * See the License for the specific language governing permissions and
15- * limitations under the License.
16- */
2+ * Licensed to the Apache Software Foundation (ASF) under one or more
3+ * contributor license agreements. See the NOTICE file distributed with
4+ * this work for additional information regarding copyright ownership.
5+ * The ASF licenses this file to You under the Apache License, Version 2.0
6+ * (the "License"); you may not use this file except in compliance with
7+ * the License. You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
1717
1818using System ;
1919using System . Collections ;
@@ -111,20 +111,22 @@ public static class IArrowArrayExtensions
111111#else
112112 case ArrowTypeId . Time32:
113113 Time32Array time32Array = ( Time32Array ) arrowArray ;
114- if ( time32Array . IsNull ( index ) ) { return null ; }
114+ int ? time32 = time32Array . GetValue ( index ) ;
115+ if ( time32 == null ) { return null ; }
115116 return ( ( Time32Type ) time32Array . Data . DataType ) . Unit switch
116117 {
117- TimeUnit . Second => TimeSpan . FromSeconds ( time32Array . GetSeconds ( index ) ! . Value ) ,
118- TimeUnit . Millisecond => TimeSpan . FromMilliseconds ( time32Array . GetMilliSeconds ( index ) ! . Value ) ,
118+ TimeUnit . Second => TimeSpan . FromSeconds ( time32 . Value ) ,
119+ TimeUnit . Millisecond => TimeSpan . FromMilliseconds ( time32 . Value ) ,
119120 _ => throw new InvalidDataException ( "Unsupported time unit for Time32Type" )
120121 } ;
121122 case ArrowTypeId . Time64:
122123 Time64Array time64Array = ( Time64Array ) arrowArray ;
123- if ( time64Array . IsNull ( index ) ) { return null ; }
124+ long ? time64 = time64Array . GetValue ( index ) ;
125+ if ( time64 == null ) { return null ; }
124126 return ( ( Time64Type ) time64Array . Data . DataType ) . Unit switch
125127 {
126- TimeUnit . Microsecond => TimeSpan . FromTicks ( time64Array . GetMicroSeconds ( index ) ! . Value * 10 ) ,
127- TimeUnit . Nanosecond => TimeSpan . FromTicks ( time64Array . GetNanoSeconds ( index ) ! . Value / 100 ) ,
128+ TimeUnit . Microsecond => TimeSpan . FromTicks ( time64 . Value * 10 ) ,
129+ TimeUnit . Nanosecond => TimeSpan . FromTicks ( time64 . Value / 100 ) ,
128130 _ => throw new InvalidDataException ( "Unsupported time unit for Time64Type" )
129131 } ;
130132#endif
@@ -244,9 +246,9 @@ public static class IArrowArrayExtensions
244246 switch ( time32Type . Unit )
245247 {
246248 case TimeUnit . Second :
247- return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromSeconds ( ( ( Time32Array ) array ) . GetSeconds ( index ) ! . Value ) ;
249+ return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromSeconds ( ( ( Time32Array ) array ) . GetValue ( index ) ! . Value ) ;
248250 case TimeUnit . Millisecond :
249- return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromMilliseconds ( ( ( Time32Array ) array ) . GetMilliSeconds ( index ) ! . Value ) ;
251+ return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromMilliseconds ( ( ( Time32Array ) array ) . GetValue ( index ) ! . Value ) ;
250252 default :
251253 throw new InvalidDataException ( "Unsupported time unit for Time32Type" ) ;
252254 }
@@ -255,7 +257,7 @@ public static class IArrowArrayExtensions
255257 switch ( time64Type . Unit )
256258 {
257259 case TimeUnit . Microsecond :
258- return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromTicks ( ( ( Time64Array ) array ) . GetMicroSeconds ( index ) ! . Value * 10 ) ;
260+ return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromTicks ( ( ( Time64Array ) array ) . GetValue ( index ) ! . Value * 10 ) ;
259261 case TimeUnit . Nanosecond :
260262 return ( array , index ) => array . IsNull ( index ) ? null : TimeSpan . FromTicks ( ( ( Time64Array ) array ) . GetValue ( index ) ! . Value / 100 ) ;
261263 default :
0 commit comments