From 3923b5d7df531634399f050b041a818652b1c209 Mon Sep 17 00:00:00 2001 From: joocer Date: Wed, 15 Jan 2025 00:36:18 +0000 Subject: [PATCH] 0.0.181 --- orso/schema.py | 16 ++++++++++++---- orso/version.py | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/orso/schema.py b/orso/schema.py index 5a71a65..7656a06 100644 --- a/orso/schema.py +++ b/orso/schema.py @@ -276,7 +276,7 @@ def to_flatcolumn(self) -> "FlatColumn": precision=self.precision, lowest_value=self.lowest_value, highest_value=self.highest_value, - null_count=self.null_count + null_count=self.null_count, ) @property @@ -290,6 +290,7 @@ def all_names(self): def arrow_field(self): import pyarrow + # fmt: off type_map: dict = { OrsoTypes.BOOLEAN: pyarrow.bool_(), OrsoTypes.BLOB: pyarrow.binary(), @@ -298,9 +299,7 @@ def arrow_field(self): OrsoTypes.TIME: pyarrow.time32("ms"), OrsoTypes.INTERVAL: pyarrow.month_day_nano_interval(), OrsoTypes.STRUCT: pyarrow.binary(), # convert structs to JSON strings/BSONs - OrsoTypes.DECIMAL: pyarrow.decimal128( - self.precision or DECIMAL_PRECISION, self.scale or 10 - ), + OrsoTypes.DECIMAL: pyarrow.decimal128(self.precision or DECIMAL_PRECISION, self.scale or 10), OrsoTypes.DOUBLE: pyarrow.float64(), OrsoTypes.INTEGER: pyarrow.int64(), OrsoTypes.ARRAY: pyarrow.list_(pyarrow.string()), @@ -308,6 +307,7 @@ def arrow_field(self): OrsoTypes.JSONB: pyarrow.binary(), OrsoTypes.NULL: pyarrow.null(), } + # fmt: on return pyarrow.field(name=self.name, type=type_map.get(self.type, pyarrow.string())) @@ -492,7 +492,15 @@ class RelationSchema: aliases: List[str] = field(default_factory=list) columns: List[FlatColumn] = field(default_factory=list) primary_key: Optional[str] = None + row_count_metric: Optional[int] = None + """Statistic of the number of rows in the relation.""" + row_count_estimate: Optional[int] = None + """Estimate of the number of rows in the relation.""" + data_size_metric: Optional[int] = None + """Statistic of the size of the data in the relation.""" + data_size_estimate: Optional[int] = None + """Estimate of the size of the data in the relation.""" def __iter__(self): """Return an iterator over column names.""" diff --git a/orso/version.py b/orso/version.py index 4c884b8..065a1ea 100644 --- a/orso/version.py +++ b/orso/version.py @@ -10,5 +10,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__: str = "0.0.180" +__version__: str = "0.0.181" __author__: str = "@joocer"