Fix: Standardize parameter case handling in parser #50
+93
−6
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.
Description
This pull request addresses an inconsistency in how parameter keys are handled across different AST nodes in the SQL parser.
The Problem:
The parser previously exhibited inconsistent behavior in handling the case of parameter keys within
USING
andSET
clauses. While nodes likeCreateKnowledgeBase
andEvaluateKnowledgeBase
normalized keys to lowercase, other nodes such asCreateSkill
,CreateAgent
, andCreateChatBot
(and theirUPDATE
counterparts) did not. This could lead to unpredictable, case-sensitive behavior and potential bugs in downstream applications that expect consistent key names.The Solution:
This PR standardizes parameter case handling by ensuring all parameter keys passed through
USING
andSET
clauses are converted to lowercase. The normalization has been applied consistently to the parsing rules for the following commands:CREATE AGENT
/UPDATE AGENT
CREATE SKILL
/UPDATE SKILL
CREATE CHATBOT
/UPDATE CHATBOT
This change aligns their behavior with the existing implementation for
KNOWLEDGE_BASE
, ensuring that all parameter keys are case-insensitive.Verification:
To validate the fix and prevent future regressions, a new test file has been added:
tests/test_mindsdb/test_case_handling.py
This file contains specific tests that create and update Agents, Skills, and Chatbots using mixed-case parameter keys and assert that they are correctly normalized to lowercase in the resulting AST.
Fix #49