jorisvandenbossche commented on a change in pull request #7546: URL: https://github.com/apache/arrow/pull/7546#discussion_r445661743
########## File path: python/pyarrow/_dataset.pyx ########## @@ -845,6 +845,28 @@ cdef class RowGroupInfo: def num_rows(self): return self.info.num_rows() + @property + def statistics(self): + if not self.info.HasStatistics(): + return None + + cdef: + CStructScalar* c_statistics + CStructScalar* c_minmax + + statistics = dict() + c_statistics = self.info.statistics().get() + for i in range(c_statistics.value.size()): + 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(), + } + + return statistics + Review comment: Do we want to expose the `statistics_expression` as well? (not fully sure if it would have a use case, so maybe we should only do that if we have one) ---------------------------------------------------------------- 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: us...@infra.apache.org