vastdb 1.3.9__py3-none-any.whl → 1.3.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,13 +112,18 @@ def test_insert_empty(session, clean_bucket_name):
112
112
  data = [[None] * 5, [None] * 5]
113
113
  all_nulls = pa.table(schema=columns, data=data)
114
114
  no_columns = all_nulls.select([])
115
+ no_rows = pa.table(schema=columns, data=[[] for _ in columns])
115
116
 
116
117
  with session.transaction() as tx:
117
118
  t = tx.bucket(clean_bucket_name).create_schema('s').create_table('t', columns)
118
119
  t.insert(all_nulls)
120
+
119
121
  with pytest.raises(errors.NotImplemented):
120
122
  t.insert(no_columns)
121
123
 
124
+ row_ids = t.insert(no_rows).to_pylist()
125
+ assert row_ids == []
126
+
122
127
 
123
128
  def test_exists(session, clean_bucket_name):
124
129
  with session.transaction() as tx:
@@ -140,7 +145,8 @@ def test_exists(session, clean_bucket_name):
140
145
  assert s.tables() == [t]
141
146
 
142
147
 
143
- def test_list_tables(session, clean_bucket_name):
148
+ @pytest.mark.parametrize("num_tables,page_size", [(10, 3)])
149
+ def test_list_tables(session, clean_bucket_name, num_tables, page_size):
144
150
  with session.transaction() as tx:
145
151
  s = tx.bucket(clean_bucket_name).create_schema('s1')
146
152
  assert s.tables() == []
@@ -148,12 +154,14 @@ def test_list_tables(session, clean_bucket_name):
148
154
 
149
155
  tables = [
150
156
  s.create_table(f't{i}', pa.schema([(f'x{i}', pa.int64())]))
151
- for i in range(10)
157
+ for i in range(num_tables)
152
158
  ]
153
159
  assert tables == s.tables()
154
160
  tablenames = [t.name for t in tables]
155
161
  assert s.tablenames() == tablenames
156
162
 
163
+ assert s.tablenames(page_size=page_size) == tablenames
164
+
157
165
 
158
166
  def test_update_table(session, clean_bucket_name):
159
167
  columns = pa.schema([
@@ -269,6 +277,24 @@ def test_select_with_multisplits(session, clean_bucket_name):
269
277
  assert actual == expected
270
278
 
271
279
 
280
+ def test_select_with_limit(session, clean_bucket_name):
281
+ columns = pa.schema([
282
+ ('a', pa.int32())
283
+ ])
284
+
285
+ data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
286
+ data = data * 1000
287
+ expected = pa.table(schema=columns, data=[data])
288
+ limit_rows = 10
289
+
290
+ with prepare_data(session, clean_bucket_name, 's', 't', expected) as t:
291
+ start = time.time()
292
+ actual = t.select(predicate=(t['a'] < 3), limit_rows=limit_rows).read_all()
293
+ end = time.time()
294
+ log.info(f"actual: {actual} elapsed time: {end - start}")
295
+ assert len(actual) == limit_rows
296
+
297
+
272
298
  def test_select_with_priority(session, clean_bucket_name):
273
299
  columns = pa.schema([
274
300
  ('a', pa.int32())
@@ -313,8 +339,13 @@ def test_timezones(session, clean_bucket_name):
313
339
 
314
340
  inserted = pa.table(schema=columns_with_tz, data=data)
315
341
  with prepare_data(session, clean_bucket_name, 's', 't', inserted) as table:
316
- assert table.arrow_schema == columns_without_tz
317
- assert table.select().read_all() == pa.table(schema=columns_without_tz, data=data)
342
+ try:
343
+ table.tx._rpc.features.check_timezone()
344
+ assert table.arrow_schema == columns_with_tz
345
+ assert table.select().read_all() == pa.table(schema=columns_with_tz, data=data)
346
+ except errors.NotSupportedVersion:
347
+ assert table.arrow_schema == columns_without_tz
348
+ assert table.select().read_all() == pa.table(schema=columns_without_tz, data=data)
318
349
 
319
350
 
320
351
  def test_types(session, clean_bucket_name):
@@ -365,6 +396,7 @@ def test_types(session, clean_bucket_name):
365
396
  assert select(None) == expected
366
397
  for t in [table, ibis._]:
367
398
  assert select(t['tb'] == False) == expected.filter(pc.field('tb') == False) # noqa: E712
399
+ assert select(t['tb'] == True) == expected.filter(pc.field('tb') == True) # noqa: E712
368
400
  assert select(t['a1'] == 2) == expected.filter(pc.field('a1') == 2)
369
401
  assert select(t['a2'] == 2000) == expected.filter(pc.field('a2') == 2000)
370
402
  assert select(t['a4'] == 222111122) == expected.filter(pc.field('a4') == 222111122)
@@ -401,6 +433,58 @@ def test_types(session, clean_bucket_name):
401
433
  assert select(t['ts9'] == ts_literal) == expected.filter(pc.field('ts9') == ts_literal)
402
434
 
403
435
 
436
+ @pytest.mark.parametrize("arrow_type,internal_support", [
437
+ # Types not supported by Vast.
438
+ (pa.null(), False),
439
+ (pa.dictionary(pa.int64(), pa.int64()), False),
440
+ (pa.dense_union([pa.field('1', pa.int32()), pa.field('2', pa.int64())]), False),
441
+ # Arrow.FixedSizeBinaryType is not supported by Ibis, but Vast supports it internally.
442
+ (pa.binary(1), True)
443
+ ])
444
+ def test_unsupported_types(session, clean_bucket_name, arrow_type, internal_support):
445
+ """ Test that unsupported types cannot be used in table creation or modification."""
446
+ unsupported_field = pa.field('u', arrow_type)
447
+ schema_name = 's'
448
+ table_name = 't'
449
+
450
+ # Create the schema
451
+ with session.transaction() as tx:
452
+ tx.bucket(clean_bucket_name).create_schema(schema_name)
453
+
454
+ # Creation of a table with unsupported types should fail
455
+ with session.transaction() as tx:
456
+ s = tx.bucket(clean_bucket_name).schema(schema_name)
457
+ with pytest.raises(errors.NotSupportedSchema):
458
+ s.create_table(table_name, pa.schema([unsupported_field]))
459
+
460
+ with session.transaction() as tx:
461
+ tx.bucket(clean_bucket_name).schema(schema_name).create_table(table_name,
462
+ pa.schema([pa.field('a', pa.int32())]))
463
+
464
+ # Adding unsupported types to an existing table should fail
465
+ with session.transaction() as tx:
466
+ t = tx.bucket(clean_bucket_name).schema(schema_name).table(table_name)
467
+ with pytest.raises(errors.NotSupportedSchema):
468
+ t.add_column(pa.schema([unsupported_field]))
469
+
470
+ if internal_support:
471
+ # Using internal API to add unsupported types
472
+ with session.transaction() as tx:
473
+ tx._rpc.api.add_columns(clean_bucket_name, schema_name, table_name, pa.schema([unsupported_field]),
474
+ txid=tx.txid)
475
+
476
+ # Attempt to open a table with unsupported types should fail
477
+ with session.transaction() as tx:
478
+ s = tx.bucket(clean_bucket_name).schema(schema_name)
479
+ with pytest.raises(errors.NotSupportedSchema):
480
+ s.table(table_name)
481
+
482
+ # Even though the table is with unsupported types, it should still be listed
483
+ with session.transaction() as tx:
484
+ s = tx.bucket(clean_bucket_name).schema(schema_name)
485
+ assert [table_name] == s.tablenames()
486
+
487
+
404
488
  def test_unsigned_filters(session, clean_bucket_name):
405
489
  columns = pa.schema([
406
490
  ('a', pa.uint8()),
vastdb/tests/util.py CHANGED
@@ -1,6 +1,8 @@
1
1
  import logging
2
2
  from contextlib import contextmanager
3
3
 
4
+ import pyarrow as pa
5
+
4
6
  log = logging.getLogger(__name__)
5
7
 
6
8
 
@@ -15,3 +17,22 @@ def prepare_data(session, clean_bucket_name, schema_name, table_name, arrow_tabl
15
17
  yield t
16
18
  t.drop()
17
19
  s.drop()
20
+
21
+
22
+ def compare_pyarrow_tables(t1, t2):
23
+
24
+ def sort_table(table):
25
+ return table.sort_by([(col, 'ascending') for col in table.schema.names])
26
+
27
+ def compare_tables(table1, table2):
28
+ if table1.schema != table2.schema:
29
+ raise RuntimeError(f"Schema mismatch. {table1.schema} vs {table2.schema}")
30
+
31
+ for t1_col, t2_col in zip(table1.columns, table2.columns):
32
+ if not pa.compute.equal(t1_col, t2_col).to_pandas().all():
33
+ raise RuntimeError(f"Data mismatch in column {t1_col} vs {t2_col}.")
34
+ return True
35
+
36
+ sorted_table1 = sort_table(t1)
37
+ sorted_table2 = sort_table(t2)
38
+ return compare_tables(sorted_table1, sorted_table2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vastdb
3
- Version: 1.3.9
3
+ Version: 1.3.11
4
4
  Summary: VAST Data SDK
5
5
  Home-page: https://github.com/vast-data/vastdb_sdk
6
6
  Author: VAST DATA
@@ -1,17 +1,17 @@
1
1
  vastdb/__init__.py,sha256=uf-AXdzsD4nPxFP7WxkcAXGG0whv8BHLrrXCJtsPGaQ,436
2
- vastdb/_internal.py,sha256=tGNU-9wOtRoK7OXFmX1-uEgQRjpKQXPA0H4rZy86-JM,107257
2
+ vastdb/_internal.py,sha256=YoZGgliQfNYNKuKG8M9ziZpu4R1pmp3PLdLcyOgo9Hc,108129
3
3
  vastdb/bucket.py,sha256=aomUbrfK5Oa6FdGPVsoBXgRW39IzYnmsorF8642r990,2549
4
4
  vastdb/config.py,sha256=OehnsWrjzv0-SUouEXmkrKBugiWyhXOn4XiSLV3s9yk,2342
5
- vastdb/conftest.py,sha256=X2kVveySPQYZlVBXUMoo7Oea5IsvmJzjdqq3fpH2kVw,3469
6
- vastdb/errors.py,sha256=B_FNFONDE8apoTRL8wkMNjUJWAjXu36mO0HI4cGSBgY,4328
7
- vastdb/features.py,sha256=6OAyTGxpOlMYqkcX2IfuG_ihJC8qrmraKdnef_B3xuo,1727
8
- vastdb/schema.py,sha256=UR1WzQvfAdnpDaNsEaGZLYGC65Blri5MYOWinCcl8Hc,6552
5
+ vastdb/conftest.py,sha256=Cl98Hg4kkLmx83F5dFMbVb-sTnn0zHxruE5B1hYXbMk,3866
6
+ vastdb/errors.py,sha256=NiKdwbfVsWJIixP2Tf3JgiBoEt8rRaZ0VeCyD9mXnoM,5645
7
+ vastdb/features.py,sha256=ivYbvhiGA858B00vhs_CNzlVV9QDUe53yW6V3J5EoxM,1874
8
+ vastdb/schema.py,sha256=5BZ0f3b_c-fGRKAaBBL6B3avHel5EDwwxte7t17WeTw,6718
9
9
  vastdb/session.py,sha256=toMR0BXwTaECdWDKnIZky1F3MA1SmelRBiqCrqQ3GCM,2067
10
- vastdb/table.py,sha256=V7LymaLfirOiAbBj68M_29ijOeSZKD0_gYU44OGkkac,35278
10
+ vastdb/table.py,sha256=fUAmOaVdMSzas1XHldRgT0UbHEG-hYJjuWkDIz3hchs,36936
11
11
  vastdb/transaction.py,sha256=NlVkEowJ_pmtffjWBBDaKExYDKPekjSZyj_fK_bZPJE,3026
12
12
  vastdb/util.py,sha256=8CUnVRsJukC3uNHNoB5D0qPf0FxS8OSdVB84nNoLJKc,6290
13
13
  vastdb/bench/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- vastdb/bench/test_perf.py,sha256=nyK-BM1HJhPHrcNa2pLNmxqcC_CG2UsJogE92EvN-UM,1082
14
+ vastdb/bench/test_perf.py,sha256=0kbCxK8U9vYO0zCMUYcZHzEICaaII3I0-6FeR5-CNtM,4040
15
15
  vastdb/bench/test_sample.py,sha256=LgF4syzij09sH3Noiv1EyCAJ9pvrUE5bxR4RJTVEYag,7881
16
16
  vastdb/bench/perf_bench/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  vastdb/bench/perf_bench/cli.py,sha256=NtaPEBTDI6PWgEtwI1wVbwmUeA5bwGqAj_Z_2lDJ28I,5931
@@ -41,14 +41,15 @@ vastdb/bench/perf_bench/query/query_vastdb.py,sha256=SZYem_EmsaynEftAa_VFobjSJZD
41
41
  vastdb/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  vastdb/tests/metrics.py,sha256=ZCSeBYFSPMG3yI0JrAHs2CrY6wFjx_5GwRTYHVAwLKA,1026
43
43
  vastdb/tests/test_duckdb.py,sha256=STw_1PwTQR8Naz6s0p6lQTV1ZTKKhe3LPBUbhqzTCu0,1880
44
- vastdb/tests/test_imports.py,sha256=ICI9EWFgKf9TbphFRhFifqZoESKWIM3_zb53U7-jOSo,8058
45
- vastdb/tests/test_nested.py,sha256=LPU6uV3Ri23dBzAEMFQqRPbqapV5LfmiHSHkhILPIY0,6332
44
+ vastdb/tests/test_fixed_list.py,sha256=qwtFNvw5fdMkOsYAcFfqPN3JOnJn31XGYtFWVe0vuOQ,11187
45
+ vastdb/tests/test_imports.py,sha256=1Xi5s0qWxuoVunW5iMQGzofTNOXxXP8eOARs9HWOiGE,21734
46
+ vastdb/tests/test_nested.py,sha256=c7q9a3MsyDymqAtShPC4cMHlzjCr18kbu_Db3u_c4IQ,6893
46
47
  vastdb/tests/test_projections.py,sha256=3y1kubwVrzO-xoR0hyps7zrjOJI8niCYspaFTN16Q9w,4540
47
48
  vastdb/tests/test_sanity.py,sha256=bv1ypGDzvOgmMvGbucDYiLQu8krQLlE6NB3M__q87x8,3303
48
49
  vastdb/tests/test_schemas.py,sha256=l70YQMlx2UL1KRQhApriiG2ZM7GJF-IzWU31H3Yqn1U,3312
49
- vastdb/tests/test_tables.py,sha256=D6eHSDjC4SJGFA91qJO56SoVPE040rN37uOrDWRDthk,47634
50
+ vastdb/tests/test_tables.py,sha256=Bl0ldJApPCFEL94jRNycsCi8M_2jTHWDXiA-7JHVlzk,51260
50
51
  vastdb/tests/test_util.py,sha256=n7gvT5Wg6b6bxgqkFXkYqvFd_W1GlUdVfmPv66XYXyA,1956
51
- vastdb/tests/util.py,sha256=O2bgB5403meX69vVY1gWACOtWLOoXE5yQA00ppk4WN8,596
52
+ vastdb/tests/util.py,sha256=YsCBCcx7n1QOH-IPDpCsl6KEaUQQJRZwGPeayijHNb4,1307
52
53
  vastdb/vast_flatbuf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
54
  vastdb/vast_flatbuf/org/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
55
  vastdb/vast_flatbuf/org/apache/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -209,8 +210,8 @@ vastdb/vast_flatbuf/tabular/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
209
210
  vastdb/vast_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
210
211
  vastdb/vast_tests/test_ha.py,sha256=744P4G6VJ09RIkHhMQL4wlipCBJWQVMhyvUrSc4k1HQ,975
211
212
  vastdb/vast_tests/test_scale.py,sha256=5jGwOdZH6Tv5tPdZYPWoqcxOceI2jA5i2D1zNKZHER4,3958
212
- vastdb-1.3.9.dist-info/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
213
- vastdb-1.3.9.dist-info/METADATA,sha256=szfHdpcb7zy4H49PgDYqVnn2J5UCAu0azRHkfXJkEpY,1340
214
- vastdb-1.3.9.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
215
- vastdb-1.3.9.dist-info/top_level.txt,sha256=nnKAaZaQa8GFbYpWAexr_B9HrhonZbUlX6hL6AC--yA,7
216
- vastdb-1.3.9.dist-info/RECORD,,
213
+ vastdb-1.3.11.dist-info/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
214
+ vastdb-1.3.11.dist-info/METADATA,sha256=KwME3q5diBEN8GTagURPqGDDBv41TS7xFN348qr26lw,1341
215
+ vastdb-1.3.11.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
216
+ vastdb-1.3.11.dist-info/top_level.txt,sha256=nnKAaZaQa8GFbYpWAexr_B9HrhonZbUlX6hL6AC--yA,7
217
+ vastdb-1.3.11.dist-info/RECORD,,