OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_fsi.py
Go to the documentation of this file.
1 import os
2 import pytest
3 import pyarrow as pa
4 from pyarrow import csv
5 import heavydbe as dbe
6 import ctypes
7 ctypes._dlopen('libDBEngine.so', ctypes.RTLD_GLOBAL)
8 
9 def test_init():
10  global engine
11  engine = dbe.PyDbEngine(
12  enable_fsi=1,
13  calcite_port=9091,
14  )
15  assert bool(engine.closed) == False
16 
17 root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
18 
20  csv_file = root + "/Tests/Import/datafiles/trips_with_headers_top1000.csv"
21 
22  r = engine.executeDDL("""CREATE TEMPORARY TABLE trips (
23 trip_id BIGINT,
24 vendor_id TEXT ENCODING NONE,
25 pickup_datetime TIMESTAMP,
26 dropoff_datetime TIMESTAMP,
27 store_and_fwd_flag TEXT ENCODING DICT,
28 rate_code_id BIGINT,
29 pickup_longitude DOUBLE,
30 pickup_latitude DOUBLE,
31 dropoff_longitude DOUBLE,
32 dropoff_latitude DOUBLE,
33 passenger_count BIGINT,
34 trip_distance DOUBLE,
35 fare_amount DOUBLE,
36 extra DOUBLE,
37 mta_tax DOUBLE,
38 tip_amount DOUBLE,
39 tolls_amount DOUBLE,
40 ehail_fee DOUBLE,
41 improvement_surcharge DOUBLE,
42 total_amount DOUBLE,
43 payment_type TEXT ENCODING DICT,
44 trip_type BIGINT,
45 pickup TEXT ENCODING DICT,
46 dropoff TEXT ENCODING NONE,
47 cab_type TEXT ENCODING DICT,
48 precipitation DOUBLE,
49 snow_depth BIGINT,
50 snowfall DOUBLE,
51 max_temperature BIGINT,
52 min_temperature BIGINT,
53 average_wind_speed DOUBLE,
54 pickup_nyct2010_gid BIGINT,
55 pickup_ctlabel DOUBLE,
56 pickup_borocode BIGINT,
57 pickup_boroname TEXT ENCODING NONE,
58 pickup_ct2010 BIGINT,
59 pickup_boroct2010 BIGINT,
60 pickup_cdeligibil TEXT ENCODING DICT,
61 pickup_ntacode TEXT ENCODING DICT,
62 pickup_ntaname TEXT ENCODING DICT,
63 pickup_puma BIGINT,
64 dropoff_nyct2010_gid BIGINT,
65 dropoff_ctlabel DOUBLE,
66 dropoff_borocode BIGINT,
67 dropoff_boroname TEXT ENCODING NONE,
68 dropoff_ct2010 BIGINT,
69 dropoff_boroct2010 BIGINT,
70 dropoff_cdeligibil TEXT ENCODING NONE,
71 dropoff_ntacode TEXT ENCODING NONE,
72 dropoff_ntaname TEXT ENCODING NONE,
73 dropoff_puma BIGINT) WITH (storage_type='CSV:""" + csv_file + """', fragment_size=100);""")
74 
75  r = engine.executeDML("select * from trips;")
76  assert r
77  assert r.colCount() == 51
78  assert r.rowCount() == 999
79 
80 
81 
82 if __name__ == "__main__":
83  pytest.main(["-v", __file__])
def test_init
Definition: test_fsi.py:9
def test_FSI_DDL
Definition: test_fsi.py:19