1
- __all__ = ['omnisci_fixture ' , 'sql_execute' ]
1
+ __all__ = ['heavydb_fixture ' , 'sql_execute' ]
2
2
3
3
4
4
import os
@@ -23,97 +23,97 @@ def assert_equal(actual, desired):
23
23
24
24
25
25
def sql_execute (query ):
26
- """Execute a SQL statement to omniscidb server using global instance.
26
+ """Execute a SQL statement to heavydb server using global instance.
27
27
28
28
Use when the query does not require registration of new UDF/UDTFs.
29
29
"""
30
- rbc_omnisci = pytest .importorskip ('rbc.omniscidb ' )
31
- omnisci = next (rbc_omnisci . global_omnisci_singleton )
32
- return omnisci .sql_execute (query )
30
+ rbc_heavydb = pytest .importorskip ('rbc.heavydb ' )
31
+ heavydb = next (rbc_heavydb . global_heavydb_singleton )
32
+ return heavydb .sql_execute (query )
33
33
34
34
35
- def omnisci_fixture (caller_globals , minimal_version = (0 , 0 ),
35
+ def heavydb_fixture (caller_globals , minimal_version = (0 , 0 ),
36
36
suffices = ['' , '10' , 'null' , 'array' , 'arraynull' ],
37
37
load_columnar = True , load_test_data = True , debug = False ):
38
38
"""Usage from a rbc/tests/test_xyz.py file:
39
39
40
40
.. code-block:: python
41
41
42
42
import pytest
43
- from rbc.tests import omnisci_fixture
43
+ from rbc.tests import heavydb_fixture
44
44
45
45
@pytest.fixture(scope='module')
46
46
def omnisci():
47
- from o in omnisci_fixture (globals()):
47
+ from o in heavydb_fixture (globals()):
48
48
# do some customization here
49
49
yield o
50
50
51
51
This fixture creates the following tables:
52
52
53
- f'{omnisci .table_name}' - contains columns f8, f4, i8, i4, i2, i1,
53
+ f'{heavydb .table_name}' - contains columns f8, f4, i8, i4, i2, i1,
54
54
b with row size 5.
55
55
56
- f'{omnisci .table_name}10' - contains columns f8, f4, i8, i4, i2,
56
+ f'{heavydb .table_name}10' - contains columns f8, f4, i8, i4, i2,
57
57
i1, b with row size 10.
58
58
59
- f'{omnisci .table_name}null' - contains columns f8, f4, i8, i4, i2,
59
+ f'{heavydb .table_name}null' - contains columns f8, f4, i8, i4, i2,
60
60
i1, b with row size 5, contains null
61
61
values
62
62
63
- f'{omnisci .table_name}array' - contains arrays f8, f4, i8, i4, i2,
63
+ f'{heavydb .table_name}array' - contains arrays f8, f4, i8, i4, i2,
64
64
i1, b with row size 5
65
65
66
- f'{omnisci .table_name}arraynull' - contains arrays f8, f4, i8, i4, i2,
66
+ f'{heavydb .table_name}arraynull' - contains arrays f8, f4, i8, i4, i2,
67
67
i1, b with row size 5, contains null
68
68
values.
69
69
"""
70
- rbc_omnisci = pytest .importorskip ('rbc.omniscidb ' )
71
- available_version , reason = rbc_omnisci .is_available ()
70
+ rbc_heavydb = pytest .importorskip ('rbc.heavydb ' )
71
+ available_version , reason = rbc_heavydb .is_available ()
72
72
73
73
def require_version (version , message = None , label = None ):
74
74
"""Execute pytest.skip(...) if version is older than available_version.
75
75
76
- Some tests can be run only when using omniscidb server built
77
- from a particular branch of omniscidb . So, when the specified
78
- version and the omniscidb version match exactly and these
76
+ Some tests can be run only when using heavydb server built
77
+ from a particular branch of heavydb . So, when the specified
78
+ version and the heavydb version match exactly and these
79
79
correspond to the current development version, if the
80
80
specified label does not match with the value of envrinment
81
81
variable OMNISCIDB_DEV_LABEL, then the corresponing test will
82
- be skipped. Use label 'docker-dev' when using omniscidb dev
82
+ be skipped. Use label 'docker-dev' when using heavydb dev
83
83
docker image.
84
84
85
85
"""
86
- # The available version (of the omniscidb server) has date and
86
+ # The available version (of the heavydb server) has date and
87
87
# hash bits, however, these are useless for determining the
88
88
# version ordering (in the case of available_version[:3] ==
89
89
# version) because the date corresponds to the date of
90
90
# building the server and the hash corresponds to some commit
91
- # of some repository (omniscidb or omniscidb -internal) and it
91
+ # of some repository (heavydb or heavydb -internal) and it
92
92
# does not provide easy date information.
93
93
#
94
94
# The condition available_version[:3] == version can appear in
95
95
# the following cases (given in the order of from newer to
96
96
# older):
97
- # 1. omniscidb is built against a omniscidb -internal PR branch
97
+ # 1. heavydb is built against a heavydb -internal PR branch
98
98
# (assuming it is rebased against master)
99
- # 2. omniscidb is built against omniscidb -internal master branch
100
- # 3. omniscidb is built against omniscidb master branch
101
- # 4. omniscidb is built against omniscidb dev docker
102
- # 5. omniscidb is built against omniscidb/omniscidb -internal release tag
99
+ # 2. heavydb is built against heavydb -internal master branch
100
+ # 3. heavydb is built against heavydb master branch
101
+ # 4. heavydb is built against heavydb dev docker
102
+ # 5. heavydb is built against heavydb/heavydb -internal release tag
103
103
#
104
104
# rbc testing suite may use features that exists in the head
105
105
# of the above list but not in the tail of it. So we have a
106
106
# problem of deciding if a particular test should be disabled
107
107
# or not for a given case while there is no reliable way to
108
- # tell from omniscidb version if the server has the particular
108
+ # tell from heavydb version if the server has the particular
109
109
# feature or not. To resolve this, we use label concept as
110
110
# explained in the doc-string.
111
111
#
112
112
113
113
if not available_version :
114
114
pytest .skip (reason )
115
115
116
- # Requires update when omniscidb -internal bumps up version number:
116
+ # Requires update when heavydb -internal bumps up version number:
117
117
current_development_version = (6 , 0 , 0 )
118
118
if available_version [:3 ] > current_development_version :
119
119
warnings .warn (f'{ available_version } ) is newer than development version'
@@ -163,8 +163,8 @@ def require_version(version, message=None, label=None):
163
163
filename = caller_globals ['__file__' ]
164
164
table_name = os .path .splitext (os .path .basename (filename ))[0 ]
165
165
166
- config = rbc_omnisci .get_client_config (debug = debug )
167
- m = rbc_omnisci . RemoteOmnisci (** config )
166
+ config = rbc_heavydb .get_client_config (debug = debug )
167
+ m = rbc_heavydb . RemoteHeavyDB (** config )
168
168
169
169
if not load_test_data :
170
170
yield m
@@ -176,7 +176,7 @@ def require_version(version, message=None, label=None):
176
176
# todo: TEXT ENCODING DICT, TEXT ENCODING NONE, TIMESTAMP, TIME,
177
177
# DATE, DECIMAL/NUMERIC, GEOMETRY: POINT, LINESTRING, POLYGON,
178
178
# MULTIPOLYGON, See
179
- # https://www.omnisci.com/docs/latest/5_datatypes.html
179
+ # https://docs.heavy.ai/sql/data-definition-ddl/datatypes-and-fixed-encoding
180
180
colnames = ['f4' , 'f8' , 'i1' , 'i2' , 'i4' , 'i8' , 'b' ]
181
181
table_defn = ',\n ' .join ('%s %s' % (n , t )
182
182
for t , n in zip (sqltypes , colnames ))
0 commit comments