def heavydb():

    for o in heavydb_fixture(globals()):
        if not o.has_cuda:
            pytest.skip("cuda is not enabled")
        define(o)
        yield o
Пример #2
0
def heavydb():

    for o in heavydb_fixture(globals(), minimal_version=(5, 6)):
        define(o)

        def require_loadtime(kind, _cache=[None]):
            msg = _cache[0]
            if kind == 'lt':
                try:
                    if msg is not None:
                        raise msg
                    if o.has_cuda:
                        o.sql_execute('select lt_device_selection_udf_gpu(0)')
                    else:
                        o.sql_execute('select lt_device_selection_udf_cpu(0)')
                except Exception as msg:
                    _cache[0] = msg
                    pytest.skip(
                        f'test requires load-time device selection UDFs ({msg}):'
                        f' run server with `--udf ../Tests/device_selection_samples.cpp`'
                        ' or check server logs for errors')

        o.require_loadtime = require_loadtime
        yield o
Пример #3
0
def heavydb():
    for o in heavydb_fixture(globals()):
        define(o)
        yield o
Пример #4
0
def heavydb():

    for o in heavydb_fixture(globals(), minimal_version=(5, 7)):
        define(o)
        o.base_name = os.path.splitext(os.path.basename(__file__))[0]
        yield o
Пример #5
0
def heavydb():

    for o in heavydb_fixture(globals(), minimal_version=(5, 6)):
        define(o)
        yield o
Пример #6
0
def heavydb():
    for o in heavydb_fixture(globals(), minimal_version=(5, 6),
                             debug=not True):
        yield o
Пример #7
0
def heavydb():
    for o in heavydb_fixture(globals()):
        yield o
Пример #8
0
def heavydb():

    for o in heavydb_fixture(globals(), load_test_data=False):
        define(o)
        yield o
Пример #9
0
def test_table_load(mth, suffix):

    load_columnar = mth == 'columnar'

    count = 0
    for heavydb in heavydb_fixture(globals(), load_columnar=load_columnar):
        heavydb.require_version(
            (5, 7, 0), 'Requires heavydb-internal PR 5465 [rbc PR 330]')
        if load_columnar and suffix == 'arraynull':
            heavydb.require_version(
                (5, 7, 0), 'Requires heavydb-internal PR 5492 [rbc issue 245]')
        count += 1
        descr, result = heavydb.sql_execute(
            f'select * from {heavydb.table_name}{suffix}')
        result = list(result)
        colnames = [d.name for d in descr]

    assert count == 1

    if suffix == '':
        assert colnames == ['f4', 'f8', 'i1', 'i2', 'i4', 'i8', 'b']
        assert result == [(0.0, 0.0, 0, 0, 0, 0, 1), (1.0, 1.0, 1, 1, 1, 1, 0),
                          (2.0, 2.0, 2, 2, 2, 2, 1), (3.0, 3.0, 3, 3, 3, 3, 0),
                          (4.0, 4.0, 4, 4, 4, 4, 1)]
    elif suffix == '10':
        assert colnames == ['f4', 'f8', 'i1', 'i2', 'i4', 'i8', 'b']
        assert result == [(0.0, 0.0, 0, 0, 0, 0, 1), (1.0, 1.0, 1, 1, 1, 1, 0),
                          (2.0, 2.0, 2, 2, 2, 2, 1), (3.0, 3.0, 3, 3, 3, 3, 0),
                          (4.0, 4.0, 4, 4, 4, 4, 1), (5.0, 5.0, 5, 5, 5, 5, 0),
                          (6.0, 6.0, 6, 6, 6, 6, 1), (7.0, 7.0, 7, 7, 7, 7, 0),
                          (8.0, 8.0, 8, 8, 8, 8, 1), (9.0, 9.0, 9, 9, 9, 9, 0)]
    elif suffix == 'null':
        assert colnames == ['f4', 'f8', 'i1', 'i2', 'i4', 'i8', 'b']
        assert result == [(None, 0.0, 0, None, 0, 0, None),
                          (1.0, 1.0, None, 1, 1, None, 0),
                          (2.0, None, 2, 2, None, 2, 1),
                          (None, 3.0, 3, None, 3, 3, None),
                          (4.0, 4.0, None, 4, 4, None, 1)]
    elif suffix == 'array':
        assert colnames == ['f4', 'f8', 'i1', 'i2', 'i4', 'i8', 'b']
        assert result == [
            ([], [], [], [], [], [], []),
            ([1.0], [1.0], [1], [1], [1], [1], [0]),
            ([2.0, 3.0], [2.0, 3.0], [2, 3], [2, 3], [2, 3], [2, 3], [1, 0]),
            ([3.0, 4.0,
              5.0], [3.0, 4.0,
                     5.0], [3, 4, 5], [3, 4, 5], [3, 4, 5], [3, 4,
                                                             5], [0, 1, 0]),
            ([4.0, 5.0, 6.0, 7.0], [4.0, 5.0, 6.0, 7.0], [4, 5, 6, 7],
             [4, 5, 6, 7], [4, 5, 6, 7], [4, 5, 6, 7], [1, 0, 1, 0])
        ]
    elif suffix == 'arraynull':
        assert colnames == ['f4', 'f8', 'i1', 'i2', 'i4', 'i8', 'b']
        assert result == [(None, [], None, [], None, [], None),
                          ([1.0], None, [None], None, [1], None, [0]),
                          (None, [None,
                                  3.0], None, [2, None], None, [2, 3], None),
                          ([None, 4.0,
                            5.0], None, [3, None,
                                         5], None, [3, 4,
                                                    None], None, [None, 1, 0]),
                          (None, [4.0, None, 6.0,
                                  7.0], None, [4, 5, None,
                                               7], None, [None, 5, 6,
                                                          None], None)]
    else:
        raise NotImplementedError(suffix)