Repository navigation
fix: ELT() function fully compatible with MySQL - #23841
Merged
mergify[bot] merged 7 commits intoMar 12, 2026
Merged
Conversation
Fix eltCheck to always cast the first argument to int64, resolving panic when using INT/SMALLINT/TINYINT/UNSIGNED column as index. The root cause was that eltCheck skipped casting for integer types other than int64 (e.g. int32), but the Elt executor hardcodes GenerateFunctionFixedTypeParameter[int64], causing type mismatch. Also adds test coverage for: - INT/SMALLINT/TINYINT/UNSIGNED index types - Float index (MySQL rounds to nearest integer) - Boolean index (TRUE=1, FALSE=0) - Expression as index - ELT + FIELD complement Closes matrixorigin#22992
…c types BOOL is not covered by IsInteger() or tryToMatch(BOOL, int64) in MO, so explicitly list bool/integer/float/decimal/bit for direct cast to int64.
gouhongshen
force-pushed
the
fix/elt-mysql-compat
branch
from
March 11, 2026 08:58
08ad861 to
d71194e
Compare
aunjgr
approved these changes
Mar 11, 2026
Contributor
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status🛑 Queue command has been cancelled |
Contributor
Merge Queue Status
This pull request spent 10 seconds in the queue, with no time running CI. Required conditions to merge
|
1 of 7 tasks
This branch was previously deployed
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #22992
What this PR does / why we need it:
Fix the
ELT()function to be fully compatible with MySQL.Root Cause:
eltCheckskipped casting for integer types other thanint64(e.g.int32,int16,bool), but theEltexecutor hardcodesGenerateFunctionFixedTypeParameter[int64], causing a type mismatch panic when usingINT/SMALLINT/TINYINTcolumns orBOOLvalues as the index argument.Fix:
In
eltCheck, explicitly handle all numeric types (bool,integer,float,decimal,bit) by always casting the first argument toint64. For other types (e.g.varchar), fall back totryToMatch.Test Coverage:
Updated BVT tests (52 SQL statements) covering:
ELT(TRUE, ...)/ELT(FALSE, ...)ELT(1.9, ...)→ 2ELT('2', ...)@bvt:issue#22992skip tags