Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def trino_to_feast_value_type(trino_type_as_str: str) -> ValueType:
"varchar": ValueType.STRING,
"boolean": ValueType.BOOL,
"real": ValueType.FLOAT,
"date": ValueType.STRING,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Trino date type mapped to ValueType.STRING instead of ValueType.UNIX_TIMESTAMP

The PR maps Trino's date type to ValueType.STRING, but this is inconsistent with every other type mapping in the Feast codebase and with the Trino type map's own PyArrow mapping.

Root Cause and Impact

Every other date-to-Feast-ValueType mapping in the codebase uses ValueType.UNIX_TIMESTAMP:

  • sdk/python/feast/type_map.py:224: "date": ValueType.UNIX_TIMESTAMP (pandas)
  • sdk/python/feast/type_map.py:969: "date": ValueType.UNIX_TIMESTAMP (MSSQL)
  • sdk/python/feast/type_map.py:1164: "date": ValueType.UNIX_TIMESTAMP (Spark/Hive)
  • sdk/python/feast/type_map.py:1258: "date": ValueType.UNIX_TIMESTAMP (Postgres)

Additionally, within the same file at trino_type_map.py:94, the _TRINO_TO_PA_TYPE_MAP maps "date" to pa.date32() (a date/temporal type), not pa.string(). This creates an internal inconsistency: trino_to_feast_value_type("date") returns STRING while trino_to_pa_value_type("date") returns pa.date32().

Impact: Features sourced from Trino date columns will be incorrectly typed as STRING in the Feast feature schema, which can cause type mismatches during feature retrieval, materialization, or when joining with features from other offline stores that correctly type date as UNIX_TIMESTAMP.

Suggested change
"date": ValueType.STRING,
"date": ValueType.UNIX_TIMESTAMP,
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trino's date type looks like a string in a format 'YYYY-MM-DD'. I think, it is clearer to map the date type into string

}
_trino_type_as_str: str = trino_type_as_str
trino_type_as_str = trino_type_as_str.lower()
Expand Down
Loading