ishaq101's picture
feat/Catalog Retrieval System (#1)
6bff5d9
raw
history blame
1.02 kB
"""Whitelisted operators + aggregation functions for IR validation."""
ALLOWED_FILTER_OPS = frozenset({
"=", "!=", "<", "<=", ">", ">=",
"in", "not_in", "is_null", "is_not_null",
"like", "between",
})
ALLOWED_AGG_FNS = frozenset({
"count", "count_distinct", "sum", "avg", "min", "max",
})
LIMIT_HARD_CAP = 10_000
# Type compatibility: which value_types may appear in a FilterClause when the
# referenced column has the given data_type. Numeric types are mutually
# compatible (decimal literal against int column is fine). Date/datetime accept
# string so the planner can emit ISO-8601 literals without mode juggling.
TYPE_COMPATIBILITY: dict[str, frozenset[str]] = {
"int": frozenset({"int", "decimal"}),
"decimal": frozenset({"int", "decimal"}),
"string": frozenset({"string"}),
"datetime": frozenset({"datetime", "date", "string"}),
"date": frozenset({"date", "datetime", "string"}),
"bool": frozenset({"bool"}),
"json": frozenset({"string"}),
}