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 2021/07/05 12:40:57 UTC

[GitHub] [arrow] jorisvandenbossche commented on a change in pull request #10654: ARROW-13258: [Python] Improve the repr of ParquetFileFragment

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



##########
File path: python/pyarrow/_dataset.pyx
##########
@@ -1057,6 +1057,23 @@ cdef class FileFragment(Fragment):
         Fragment.init(self, sp)
         self.file_fragment = <CFileFragment*> sp.get()
 
+    def __repr__(self):
+        type_name = frombytes(self.fragment.type_name())
+        if type_name != "parquet":
+            typ = " type={0}".format(type_name)
+        else:
+            # parquet has a subclass -> type embedded in class name
+            typ = ""
+        partition_dict = _get_partition_keys(self.partition_expression)
+        partition = ", ".join(
+            ["{0}={1}".format(key, val) for key, val in partition_dict.items()]

Review comment:
       I always forget in which Python version that was introduced, but it's Python 3.6, so indeed we can use f-strings!




-- 
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.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

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