Skip to content

Commit ad2c98d

Browse files
test(databricks): add explicit tests for SET VAR / SET VARIABLE [CLAUDE] (#7490)
SET VAR and SET VARIABLE were already supported via inheritance from SparkParser (fixed in #7235), but had no Databricks-specific test coverage. Adds round-trip identity tests for all main variants. Closes #7358 Co-authored-by: Giorgos Michas <geomichas96@gmail.com>
1 parent e150296 commit ad2c98d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/dialects/test_databricks.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,15 @@ def test_overlay(self):
491491
"SELECT OVERLAY('Spark SQL' PLACING 'ANSI ' FROM 7 FOR 0)",
492492
)
493493

494+
def test_set_variable(self):
495+
# Both SET VAR and SET VARIABLE are synonyms; both normalize to SET VARIABLE on output
496+
self.validate_identity("SET VAR v = 5", "SET VARIABLE v = 5")
497+
self.validate_identity("SET VARIABLE v = 5")
498+
self.validate_identity("SET VARIABLE v1 = 1, v2 = '2'")
499+
self.validate_identity("SET VARIABLE (v1, v2) = (SELECT 1, 2)")
500+
self.validate_identity("SET VARIABLE v = (SELECT MAX(c1) FROM VALUES (1), (2) AS T(c1))")
501+
self.validate_identity("SET VARIABLE v = DEFAULT")
502+
494503
def test_iff(self):
495504
# IFF is a synonym for IF in Databricks; it normalizes to IF on output
496505
self.validate_all(

0 commit comments

Comments
 (0)