Default to varchar(max) for inferred string columns#385
Open
sdebruyn wants to merge 1 commit into
Open
Conversation
The previous `varchar(8000)` default in TYPE_LABELS, string_type() and string_size() silently truncated any inferred-width string column at 8000 characters. Fabric Warehouse supports varchar(max); use that as the default when no explicit size is provided. string_size() now returns -1 as the sentinel for max, mirroring how T-SQL represents varchar(max) in sys.columns. string_type() and can_expand_to() were updated to handle the sentinel.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #384.
FabricColumndefaultedSTRING/VARCHAR/NVARCHARtoVARCHAR(8000)inTYPE_LABELS, and bothstring_type()andstring_size()fell back to8000when no explicit size was supplied. Any inferred-width string column was silently hard-capped at 8000 characters — long-text source columns (JSON payloads, free-text fields, serialized blobs) lost the tail beyond byte 8000 with no warning or error.Fabric Warehouse supports
varchar(max), so this PR makes that the default when no size is provided.Changes
TYPE_LABELS:STRING,VARCHAR, andNVARCHARnow map toVARCHAR(MAX).string_type(size): returnsvarchar(max)whensizeisNoneor non-positive; otherwisevarchar({size}).string_size(): returns-1(the T-SQL sentinel forvarchar(max)) whenchar_sizeisNone, instead of8000.can_expand_to(): treats-1as the widest possible size so comparisons stay correct.Users who want a fixed-width column can still declare it explicitly via a contract or by setting
char_sizedirectly.Testing
The maintainers can wire this through the project's test suite. Happy to extend the change with adapter unit tests covering the new sentinel paths if that's the preferred follow-up.