Skip to content

Commit

Permalink
0.0.181
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer committed Jan 15, 2025
1 parent dd1ab4d commit 3923b5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions orso/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(),
Expand All @@ -298,16 +299,15 @@ 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()),
OrsoTypes.VARCHAR: pyarrow.string(),
OrsoTypes.JSONB: pyarrow.binary(),
OrsoTypes.NULL: pyarrow.null(),
}
# fmt: on

return pyarrow.field(name=self.name, type=type_map.get(self.type, pyarrow.string()))

Expand Down Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion orso/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 3923b5d

Please sign in to comment.