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