fix(pinot): dialect date truncation (#35420)

Co-authored-by: bito-code-review[bot] <188872107+bito-code-review[bot]@users.noreply.github.com>
This commit is contained in:
Beto Dealmeida
2025-10-01 13:16:46 -04:00
committed by GitHub
parent 28389de93e
commit aa97d2fe03
2 changed files with 88 additions and 0 deletions

View File

@@ -78,6 +78,12 @@ class Pinot(MySQL):
exp.DataType.Type.UBIGINT: "UNSIGNED",
}
TRANSFORMS = {
**MySQL.Generator.TRANSFORMS,
}
# Remove DATE_TRUNC transformation - Pinot supports standard SQL DATE_TRUNC
TRANSFORMS.pop(exp.DateTrunc, None)
def datatype_sql(self, expression: exp.DataType) -> str:
# Don't use MySQL's VARCHAR size requirement logic
# Just use TYPE_MAPPING for all types
@@ -95,3 +101,8 @@ class Pinot(MySQL):
return f"{type_sql} UNSIGNED{nested}"
return f"{type_sql}{nested}"
def cast_sql(self, expression: exp.Cast, safe_prefix: str | None = None) -> str:
# Pinot doesn't support MySQL's TIMESTAMP() function
# Use standard CAST syntax instead
return super(MySQL.Generator, self).cast_sql(expression, safe_prefix)