Skip to content

Commit 3ee9fba

Browse files
committed
Use effective string storage in wide tables
1 parent cb4829d commit 3ee9fba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/openstatspec/sql/wide.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ def string_type(profile: Any) -> Text:
6161
return mysql.LONGTEXT() if profile.name == "dolt" else Text()
6262

6363

64+
def _wide_column_type(profile: Any, storage_kind: str) -> Any:
65+
"""Select the physical value type from the effective SQL profile."""
66+
return binary64_type() if storage_kind == "numeric" else string_type(profile)
67+
68+
6469
def _canonical_sha256(value: Any) -> str:
6570
return hashlib.sha256(
6671
json.dumps(value, sort_keys=True, separators=(",", ":"), default=str).encode("utf-8")
@@ -2398,7 +2403,7 @@ def create_wide_dataset(
23982403
for item in variables:
23992404
data_table.append_column(Column(
24002405
item["physical_name"],
2401-
binary64_type() if item["storage_kind"] == "numeric" else Text,
2406+
_wide_column_type(profile, item["storage_kind"]),
24022407
nullable=item["storage_kind"] == "numeric",
24032408
))
24042409
except Exception as error:

0 commit comments

Comments
 (0)