You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/03 14:33:40 UTC

[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #7623: ARROW-9108: [C++][Dataset] Add supports for missing type in Statistics to Scalar conversion

jorisvandenbossche commented on a change in pull request #7623:
URL: https://github.com/apache/arrow/pull/7623#discussion_r449610259



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -861,10 +861,15 @@ cdef class RowGroupInfo:
             name = frombytes(c_statistics.type.get().field(i).get().name())
             c_minmax = <CStructScalar*> c_statistics.value[i].get()
 
-            statistics[name] = {
-                'min': pyarrow_wrap_scalar(c_minmax.value[0]).as_py(),
-                'max': pyarrow_wrap_scalar(c_minmax.value[1]).as_py(),
-            }
+            try:
+                statistics[name] = {
+                    'min': pyarrow_wrap_scalar(c_minmax.value[0]).as_py(),
+                    'max': pyarrow_wrap_scalar(c_minmax.value[1]).as_py(),
+                }
+            except ValueError:
+                # Don't threat failure to parse/convert a single Scalar as a

Review comment:
       ```suggestion
                   # Don't treat failure to parse/convert a single Scalar as a
   ```

##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -861,10 +861,15 @@ cdef class RowGroupInfo:
             name = frombytes(c_statistics.type.get().field(i).get().name())
             c_minmax = <CStructScalar*> c_statistics.value[i].get()
 
-            statistics[name] = {
-                'min': pyarrow_wrap_scalar(c_minmax.value[0]).as_py(),
-                'max': pyarrow_wrap_scalar(c_minmax.value[1]).as_py(),
-            }
+            try:
+                statistics[name] = {
+                    'min': pyarrow_wrap_scalar(c_minmax.value[0]).as_py(),
+                    'max': pyarrow_wrap_scalar(c_minmax.value[1]).as_py(),
+                }
+            except ValueError:
+                # Don't threat failure to parse/convert a single Scalar as a

Review comment:
       Do you have examples where you still got an error?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org