diff --git a/tests/integration/standard/test_types.py b/tests/integration/standard/test_types.py index 6bf25ce163..d742f84ffb 100644 --- a/tests/integration/standard/test_types.py +++ b/tests/integration/standard/test_types.py @@ -663,20 +663,22 @@ def test_can_insert_nested_tuples(self): s.encoder.mapping[tuple] = s.encoder.cql_encode_tuple # create a table with multiple sizes of nested tuples - # Note: Scylla limits CQL expression nesting depth to 12, so the - # deepest tuple tested here is 12 levels deep. + # Note: Scylla limits CQL expression nesting depth to 12 (every + # recursive `term` counts, including the innermost scalar value), so a + # nested tuple literal can be at most 11 levels deep before the server + # rejects it with "expression nested too deeply". s.execute("CREATE TABLE nested_tuples (" "k int PRIMARY KEY, " "v_1 frozen<%s>," "v_2 frozen<%s>," "v_3 frozen<%s>," - "v_12 frozen<%s>" + "v_11 frozen<%s>" ")" % (self.nested_tuples_schema_helper(1), self.nested_tuples_schema_helper(2), self.nested_tuples_schema_helper(3), - self.nested_tuples_schema_helper(12))) + self.nested_tuples_schema_helper(11))) - for i in (1, 2, 3, 12): + for i in (1, 2, 3, 11): # create tuple created_tuple = self.nested_tuples_creator_helper(i) diff --git a/tests/integration/standard/test_udts.py b/tests/integration/standard/test_udts.py index 7533601757..520df49413 100644 --- a/tests/integration/standard/test_udts.py +++ b/tests/integration/standard/test_udts.py @@ -389,7 +389,12 @@ def test_can_insert_nested_registered_udts(self): with self._cluster_default_dict_factory() as c: s = c.connect(self.keyspace_name, wait_for_all_pools=True) - max_nesting_depth = 12 + # Scylla caps CQL expression nesting depth at 12 (every recursive + # `term` counts). A UDT literal `{value: ...}` adds two term levels + # per nesting, so a UDT literal inserted via a simple statement can + # be at most 10 levels deep before the server rejects it with + # "expression nested too deeply". + max_nesting_depth = 10 # create the schema self.nested_udt_schema_helper(s, max_nesting_depth) @@ -454,7 +459,12 @@ def test_can_insert_nested_registered_udts_with_different_namedtuples(self): with self._cluster_default_dict_factory() as c: s = c.connect(self.keyspace_name, wait_for_all_pools=True) - max_nesting_depth = 12 + # Scylla caps CQL expression nesting depth at 12 (every recursive + # `term` counts). A UDT literal `{value: ...}` adds two term levels + # per nesting, so a UDT literal inserted via a simple statement can + # be at most 10 levels deep before the server rejects it with + # "expression nested too deeply". + max_nesting_depth = 10 # create the schema self.nested_udt_schema_helper(s, max_nesting_depth)