carloea2 commented on code in PR #8488: URL: https://github.com/apache/texera/pull/8488#discussion_r4001987438
########## amber/src/main/python/core/models/table.py: ########## @@ -25,6 +26,20 @@ class Table(pandas.DataFrame): + @staticmethod + def empty_of(schema) -> pandas.DataFrame: + """ + The declared columns with no rows under them. + + ``from_tuple_likes`` reads the column names off the tuples it is given, + so with none to read it produces a frame of no columns at all, and an + operator naming any of its own columns raises KeyError. A port that + carried no rows still has a schema, and this is what it looks like as a + table. Building it through Arrow gives each column the dtype it would + have had with rows in it. + """ + return pa.Table.from_pylist([], schema=schema.as_arrow_schema()).to_pandas() Review Comment: Retested 90e381a. All three local pytest cases pass, including as_tuples on declared empty input. This finding is fixed. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
