-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Column does not maintain data type #13122
Comments
Generic reproduce:
Related #12938 |
Triaging investigation, for the sake of understanding the problem. When a filter is constructed with a field from the table (i.e. it's not a custom column), for instance
With this filter, the FilterPopoverPicker will create a DatePicker component to let the use choose the time interval: However, when a filter is constructed from a custom column, the query looks radically different (
which will lead FilterPopoverPicker to create a (rather generic) FieldValuesWidget which doesn't work with date/time field: In the latter case, the corresponding Note that |
So finally I found out where this field type is hardcoded: it's inside (surprise) field() {
return new Field({
id: this.mbql(),
name: this.name(),
display_name: this.displayName(),
semantic_type: null,
base_type: "type/Float",
// HACK: need to thread the query through to this fake Field
query: this._query,
table: this._query ? this._query.table() : null,
});
} In order to avoid hardcoding Currently the type checker work for v39 (#14214) isn't yet bi-directional. I'm still contemplating whether I can fit it the remaining activity to close the gap between the current type-checker and something like Hindley-Milner type-system reasonably within the timeline of v39 milestone. |
Determining the type of the expression is something we should do in the shared lib I think. That information would be good to have on the backend too -- for query validation and to make sure we determine the correct type information for things like nested queries |
This should be fixed with the work in #15952. |
Describe the bug
When using the
coalesce
(orcase
) custom expressions, the resulting value does not maintain the data type of the original values. This means that I can't effectively use a filter on the subsequent values.Logs
n/a
To Reproduce
Steps to reproduce the behavior:
Issue Closed At
columnExpected behavior
I would expect the type of the original columns to be maintained.
Screenshots
Information about your Metabase Installation:
Severity
Annoying - it prevents me from effectively using
coalesce
where I want to filter the resulting value.Additional context
Surprisingly, the formatting of the column seems to be maintained. 🤔
The text was updated successfully, but these errors were encountered: