-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
fix: type error bug in convert_tbl_column_to_sqla_col #31780
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Missing type null check ▹ view |
Files scanned
File Path | Reviewed |
---|---|
superset/models/helpers.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Current Korbit Configuration
General Settings
Setting Value Review Schedule Automatic excluding drafts Max Issue Count 10 Automatic PR Descriptions ✅ Issue Categories
Category Enabled Naming ✅ Database Operations ✅ Documentation ✅ Logging ✅ Error Handling ✅ Systems and Environment ✅ Objects and Data Structures ✅ Readability and Maintainability ✅ Asynchronous Processing ✅ Design Patterns ✅ Third-Party Libraries ✅ Performance ✅ Security ✅ Functionality ✅ Feedback and Support
Note
Korbit Pro is free for open source projects 🎉
Looking to add Korbit to your team? Get started with a free 2 week trial here
@@ -1419,7 +1419,7 @@ def convert_tbl_column_to_sqla_col( | |||
) -> 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) | |||
column_spec = db_engine_spec.get_column_spec(tbl_column.type, db_extra=self.db_extra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing type null check
Tell me more
What is the issue?
Missing null check for tbl_column.type before calling get_column_spec
Why this matters
If tbl_column.type is None, get_column_spec() may raise an error since some database engines cannot handle None type inputs.
Suggested change ∙ Feature Preview
Add null check before getting column spec:
column_spec = None
if tbl_column.type is not None:
column_spec = db_engine_spec.get_column_spec(tbl_column.type, db_extra=self.db_extra)
Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #31780 +/- ##
==========================================
+ Coverage 60.48% 65.52% +5.03%
==========================================
Files 1931 538 -1393
Lines 76236 39011 -37225
Branches 8568 0 -8568
==========================================
- Hits 46114 25562 -20552
+ Misses 28017 13449 -14568
+ Partials 2105 0 -2105
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
SUMMARY
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.
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: #31695
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
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
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 usingtbl_column.type
instead ofself.type
when fetching the column specification.Why are these changes being made?
The previous implementation incorrectly passed
self.type
to theget_column_spec
method, which likely resulted in an incorrect or failed type conversion. Changing it to usetbl_column.type
ensures that the column's actual type is used, aligning with the intended logic and fixing the type error.