You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def convert_tbl_column_to_sqla_col(
self,
tbl_column: "TableColumn",
label: Optional[str] = None,
template_processor: Optional[BaseTemplateProcessor] = None,
) -> Column:
label = label or tbl_column.column_name
db_engine_spec = self.db_engine_spec
column_spec = db_engine_spec.get_column_spec(self.type, db_extra=self.db_extra)
type_ = column_spec.sqla_type if column_spec else None
if expression := tbl_column.expression:
if template_processor:
expression = template_processor.process_template(expression)
col = literal_column(expression, type_=type_)
else:
col = sa.column(tbl_column.column_name, type_=type_)
col = self.make_sqla_column_compatible(col, label)
return col
why here use self.type but not tbl.column? I think the latter is right. column_spec = db_engine_spec.get_column_spec(self.type, db_extra=self.db_extra)
When debugging, I found self,type is "table", then column_spec will be None. I think self.type is not native type of the column, here we should pass tal_column. type, which is "IPADDR" in my case.
After I modify this, I successfully processed data types by literal_processor while using filters. For example, I process "127.0.0.1" to "ipaddr("127.0.0.1")" when filtering.
Is this really a bug in superset? Or did I just understand it wrong somewhere?
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
No response
Checklist
I have searched Superset docs and Slack and didn't find a solution to my problem.
I have searched the GitHub issue tracker and didn't find a similar bug report.
I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
The text was updated successfully, but these errors were encountered:
The issue you're encountering with the convert_tbl_column_to_sqla_col function, where self.type is used instead of tbl_column.type, does appear to be a bug. The use of self.type results in None for column_spec, which is not the intended behavior. Changing it to tbl_column.type resolves the issue by correctly using the type of the table column being converted [1].
Bug description
function convert_tbl_column_to_sqla_col is at superset/models/helpers.py
https://github.com/apache/superset/blob/master/superset/models/helpers.py#L1403
why here use self.type but not tbl.column? I think the latter is right.
column_spec = db_engine_spec.get_column_spec(self.type, db_extra=self.db_extra)
When debugging, I found self,type is "table", then column_spec will be None. I think self.type is not native type of the column, here we should pass tal_column. type, which is "IPADDR" in my case.
After I modify this, I successfully processed data types by literal_processor while using filters. For example, I process "127.0.0.1" to "ipaddr("127.0.0.1")" when filtering.
Is this really a bug in superset? Or did I just understand it wrong somewhere?
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
No response
Checklist
The text was updated successfully, but these errors were encountered: