Conversation
MySQL's information_schema returns display widths (e.g., 10 for INT, 11 for INT(11)) as numeric_precision. These display widths were being incorrectly preserved as Strata's semantic precision, causing false type-change diffs like "INTEGER → INTEGER(10)" during round-trip operations (export → generate). Fixes #26 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes MySQL schema export/import round-trip stability by preventing MySQL information_schema.numeric_precision (which can reflect INTEGER display width) from being mapped into Strata’s semantic ColumnType::INTEGER { precision }, avoiding false type-change diffs like INTEGER → INTEGER(10).
Changes:
- Strip MySQL display widths for
int/integerby always settingColumnType::INTEGER { precision: None }when parsing. - Strip display widths for non-BOOLEAN
tinyintby settingprecision: None. - Add regression tests covering the display-width stripping behavior and a parse→format round-trip assertion.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
MySQL's
information_schemareturns display widths (e.g.,10forINT,11forINT(11)) asnumeric_precision. TheMySqlTypeMapper::parse_sql_type()was passing these display widths directly as Strata's semanticprecision, causing false type-change diffs likeINTEGER → INTEGER(10)during round-trip operations (export→generate).Fix: Strip display widths for
int/integerandtinyint(non-BOOLEAN) types by settingprecision: Noneinstead of usingmetadata.numeric_precision.Related Issue
Fixes #26
Type of Change
Test Plan
Added regression tests:
test_mysql_parse_int_strips_display_width— INT withnumeric_precision=10test_mysql_parse_integer_strips_display_width— INTEGER keyword varianttest_mysql_parse_int_11_strips_display_width— INT(11) signed defaulttest_mysql_parse_tinyint_non_boolean_strips_display_width— TINYINT with precision ≠ 3test_mysql_int_roundtrip_no_spurious_precision— Full parse → format round-tripChecklist
cargo fmtandcargo clippycargo test)