diff --git a/rbc/tests/heavydb/test_text_encoding_dict.py b/rbc/tests/heavydb/test_text_encoding_dict.py index d0528f04..be93ddc3 100644 --- a/rbc/tests/heavydb/test_text_encoding_dict.py +++ b/rbc/tests/heavydb/test_text_encoding_dict.py @@ -2,6 +2,7 @@ import pytest import itertools from rbc.tests import heavydb_fixture +from rbc.heavydb import TextEncodingNone @pytest.fixture(scope="module") @@ -114,6 +115,24 @@ def fn_copy(mgr, t): str = mgr.getString(db_id, dict_id, t) return mgr.getOrAddTransient(mgr.TRANSIENT_DICT_DB_ID, mgr.TRANSIENT_DICT_ID, str) + @heavydb('TextEncodingNone(RowFunctionManager, TextEncodingDict)', devices=['cpu']) + def to_text_encoding_none_1(mgr, t): + db_id = mgr.getDictDbId('to_text_encoding_none_1', 0) + dict_id = mgr.getDictId('to_text_encoding_none_1', 0) + str = mgr.getString(db_id, dict_id, t) + return str + + @heavydb('TextEncodingNone(RowFunctionManager, TextEncodingDict)', devices=['cpu']) + def to_text_encoding_none_2(mgr, t): + db_id = mgr.getDictDbId('to_text_encoding_none_2', 0) + dict_id = mgr.getDictId('to_text_encoding_none_2', 0) + str = mgr.getString(db_id, dict_id, t) + n = len(str) + r = TextEncodingNone(n) + for i in range(n): + r[i] = str[i] + return r + @pytest.fixture(scope="module") def create_columns(heavydb): @@ -510,6 +529,19 @@ def test_udf_copy_dict_encoded_string(heavydb, col): assert list(result) == [('fun',), ('bar',), ('foo',), ('barr',), ('foooo',)] +@pytest.mark.parametrize('col', ['t1']) +@pytest.mark.parametrize('fn', ['to_text_encoding_none_1', 'to_text_encoding_none_2']) +def test_to_text_encoding_none(heavydb, fn, col): + if heavydb.version[:2] < (6, 3): + pytest.skip('Requires HeavyDB version 6.3 or newer') + + table = f"{heavydb.base_name}text" + query = f"SELECT {fn}({col}) from {table}" + _, result = heavydb.sql_execute(query) + + assert list(result) == [('fun',), ('bar',), ('foo',), ('barr',), ('foooo',)] + + def test_row_function_manager(heavydb): if heavydb.version[:2] < (6, 3): pytest.skip('Requires HeavyDB version 6.3 or newer')