test_composite_index_with_pk | Failure | TypeError: '<' not supported between instances of 'str' and 'int'
self = <abc.TestCQLNodes3RF3_Upgrade_current_5_0_x_To_indev_5_0_x object at 0x7fec59f7fa30>
@pytest.mark.no_vnodes
def test_composite_index_with_pk(self):
cursor = self.prepare(ordered=True)
cursor.execute("""
CREATE TABLE blogs (
blog_id int,
time1 int,
time2 int,
author text,
content text,
PRIMARY KEY (blog_id, time1, time2)
)
""")
cursor.execute("CREATE INDEX ON blogs(author)")
for is_upgraded, cursor in self.do_upgrade(cursor):
logger.debug("Querying {} node".format("upgraded" if is_upgraded else "old"))
cursor.execute("TRUNCATE blogs")
req = "INSERT INTO blogs (blog_id, time1, time2, author, content) VALUES (%d, %d, %d, '%s', '%s')"
cursor.execute(req % (1, 0, 0, 'foo', 'bar1'))
cursor.execute(req % (1, 0, 1, 'foo', 'bar2'))
cursor.execute(req % (2, 1, 0, 'foo', 'baz'))
cursor.execute(req % (3, 0, 1, 'gux', 'qux'))
query = "SELECT blog_id, content FROM blogs WHERE author='foo'"
assert_all(cursor, query, [[1, 'bar1'], [1, 'bar2'], [2, 'baz']])
query = "SELECT blog_id, content FROM blogs WHERE time1 > 0 AND author='foo' ALLOW FILTERING"
assert_one(cursor, query, [2, 'baz'])
query = "SELECT blog_id, content FROM blogs WHERE time1 = 1 AND author='foo' ALLOW FILTERING"
assert_one(cursor, query, [2, 'baz'])
query = "SELECT blog_id, content FROM blogs WHERE time1 = 1 AND time2 = 0 AND author='foo' ALLOW FILTERING"
assert_one(cursor, query, [2, 'baz'])
query = "SELECT content FROM blogs WHERE time1 = 1 AND time2 = 1 AND author='foo' ALLOW FILTERING"
assert_none(cursor, query)
query = "SELECT content FROM blogs WHERE time1 = 1 AND time2 > 0 AND author='foo' ALLOW FILTERING"
assert_none(cursor, query)
assert_invalid(cursor, "SELECT content FROM blogs WHERE time2 >= 0 AND author='foo'")
# as discussed in CASSANDRA-8148, some queries that should have required ALLOW FILTERING
# in 2.0 have been fixed for 2.2
> if self.get_node_version(is_upgraded) < '2.2':
upgrade_tests/cql_tests.py:1818:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
upgrade_tests/upgrade_base.py:227: in get_node_version
return max(node_versions) if is_upgraded else min(node_versions)
/usr/lib/python3.8/distutils/version.py:64: in __gt__
c = self._cmp(other)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = LooseVersion ('5.0-rc1'), other = LooseVersion ('5.0.1')
def _cmp (self, other):
if isinstance(other, str):
other = LooseVersion(other)
if self.version == other.version:
return 0
> if self.version < other.version:
E TypeError: '<' not supported between instances of 'str' and 'int'
/usr/lib/python3.8/distutils/version.py:337: TypeError | 61.321 |