Mine-Echo opened a new pull request, #31780: URL: https://github.com/apache/superset/pull/31780
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY <!--- Describe the change below, including rationale and design decisions --> ``` 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 ``` I am developpydolphindb to adapt superset to DolphinDB 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. ``` class UUID(sqltypes.BINARY): __visit_name__ = "UUID" def literal_processor(self, dialect): def process(value): if value is not None: value = f'uuid("{value}")' return value return process ``` 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. The right SQL script after I modify self.type to tbl_column.type:  The issue: https://github.com/apache/superset/issues/31695 ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> Now can only test by adding breakpoint at this line and print self.type and tbl_column,type. Our pydolphindb has not been released yet and is expected to be released at the end of the month ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [x] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API <!-- Korbit AI PR Description Start --> ## Description by Korbit AI ### What change is being made? Fix a type error bug in the `convert_tbl_column_to_sqla_col` function by correctly using `tbl_column.type` instead of `self.type` when fetching the column specification. ### Why are these changes being made? The previous implementation incorrectly passed `self.type` to the `get_column_spec` method, which likely resulted in an incorrect or failed type conversion. Changing it to use `tbl_column.type` ensures that the column's actual type is used, aligning with the intended logic and fixing the type error. > Is this description stale? Ask me to generate a new description by commenting `/korbit-generate-pr-description` <!-- Korbit AI PR Description End --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
