vastdb 2.0.0__py3-none-any.whl → 2.0.1__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.
- vastdb/_internal.py +35 -9
- {vastdb-2.0.0.dist-info → vastdb-2.0.1.dist-info}/METADATA +1 -1
- {vastdb-2.0.0.dist-info → vastdb-2.0.1.dist-info}/RECORD +6 -6
- {vastdb-2.0.0.dist-info → vastdb-2.0.1.dist-info}/WHEEL +0 -0
- {vastdb-2.0.0.dist-info → vastdb-2.0.1.dist-info}/licenses/LICENSE +0 -0
- {vastdb-2.0.0.dist-info → vastdb-2.0.1.dist-info}/top_level.txt +0 -0
vastdb/_internal.py
CHANGED
|
@@ -17,6 +17,7 @@ import requests
|
|
|
17
17
|
import urllib3
|
|
18
18
|
import xmltodict
|
|
19
19
|
from aws_requests_auth.aws_auth import AWSRequestsAuth
|
|
20
|
+
from ibis.expr.operations import Field, Node
|
|
20
21
|
from ibis.expr.operations.generic import (
|
|
21
22
|
IsNull,
|
|
22
23
|
Literal,
|
|
@@ -34,7 +35,6 @@ from ibis.expr.operations.logical import (
|
|
|
34
35
|
NotEquals,
|
|
35
36
|
Or,
|
|
36
37
|
)
|
|
37
|
-
from ibis.expr.operations.relations import Field
|
|
38
38
|
from ibis.expr.operations.strings import StartsWith, StringContains
|
|
39
39
|
from ibis.expr.operations.structs import StructField
|
|
40
40
|
|
|
@@ -2350,9 +2350,36 @@ def get_response_schema(schema: 'pa.Schema' = pa.schema([]), field_names: Option
|
|
|
2350
2350
|
return pa.schema([schema.field(name) for name in field_names])
|
|
2351
2351
|
|
|
2352
2352
|
|
|
2353
|
-
def
|
|
2353
|
+
def _column_names_in_node_tree(expr: ibis.expr.types.Expr) -> set[str]:
|
|
2354
|
+
def walk_op(op: Node):
|
|
2355
|
+
if isinstance(op, Field):
|
|
2356
|
+
names.add(op.name)
|
|
2357
|
+
elif isinstance(op, (list, tuple)):
|
|
2358
|
+
for item in op:
|
|
2359
|
+
walk_op(item)
|
|
2360
|
+
else:
|
|
2361
|
+
for arg in getattr(op, "args", ()):
|
|
2362
|
+
walk_op(arg)
|
|
2363
|
+
|
|
2364
|
+
names: set[str] = set()
|
|
2365
|
+
walk_op(expr.op())
|
|
2366
|
+
return names
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
def build_query_data_request(schema: pa.Schema,
|
|
2354
2370
|
predicate: ibis.expr.types.BooleanColumn = None,
|
|
2355
|
-
field_names: Optional[
|
|
2371
|
+
field_names: Optional[list[str]] = None) -> QueryDataRequest:
|
|
2372
|
+
if field_names is None:
|
|
2373
|
+
queried_columns = [f.name for f in schema]
|
|
2374
|
+
else:
|
|
2375
|
+
# apparently there are some tests that send a tuple despite the signature asking for a list
|
|
2376
|
+
queried_columns = list(field_names)
|
|
2377
|
+
|
|
2378
|
+
column_names_in_predicate = set() if predicate is None else _column_names_in_node_tree(predicate)
|
|
2379
|
+
column_names_required_by_predicate = column_names_in_predicate - set(queried_columns)
|
|
2380
|
+
queried_columns.extend(column_names_required_by_predicate)
|
|
2381
|
+
schema = pa.schema((schema.field(name) for name in queried_columns))
|
|
2382
|
+
|
|
2356
2383
|
builder = flatbuffers.Builder(1024)
|
|
2357
2384
|
|
|
2358
2385
|
source_name = builder.CreateString('') # required
|
|
@@ -2374,18 +2401,17 @@ def build_query_data_request(schema: 'pa.Schema' = pa.schema([]),
|
|
|
2374
2401
|
parser = QueryDataParser(schema)
|
|
2375
2402
|
leaves_map = {node.field.name: [leaf.index for leaf in node._iter_leaves()] for node in parser.nodes}
|
|
2376
2403
|
|
|
2377
|
-
response_schema = get_response_schema(schema, field_names)
|
|
2378
|
-
field_names = [field.name for field in response_schema]
|
|
2379
|
-
|
|
2380
2404
|
projection_fields = []
|
|
2381
|
-
for
|
|
2405
|
+
for field in schema:
|
|
2382
2406
|
# TODO: only root-level projection pushdown is supported (i.e. no support for SELECT s.x FROM t)
|
|
2383
|
-
positions = leaves_map[
|
|
2407
|
+
positions = leaves_map[field.name]
|
|
2408
|
+
|
|
2384
2409
|
for leaf_position in positions:
|
|
2385
2410
|
fb_field_index.Start(builder)
|
|
2386
2411
|
fb_field_index.AddPosition(builder, leaf_position)
|
|
2387
2412
|
offset = fb_field_index.End(builder)
|
|
2388
2413
|
projection_fields.append(offset)
|
|
2414
|
+
|
|
2389
2415
|
fb_source.StartProjectionVector(builder, len(projection_fields))
|
|
2390
2416
|
for offset in reversed(projection_fields):
|
|
2391
2417
|
builder.PrependUOffsetTRelative(offset)
|
|
@@ -2405,4 +2431,4 @@ def build_query_data_request(schema: 'pa.Schema' = pa.schema([]),
|
|
|
2405
2431
|
|
|
2406
2432
|
builder.Finish(relation)
|
|
2407
2433
|
|
|
2408
|
-
return QueryDataRequest(serialized=builder.Output(), response_schema=
|
|
2434
|
+
return QueryDataRequest(serialized=builder.Output(), response_schema=schema, response_parser=QueryDataParser(schema))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
vastdb/__init__.py,sha256=uf-AXdzsD4nPxFP7WxkcAXGG0whv8BHLrrXCJtsPGaQ,436
|
|
2
2
|
vastdb/_ibis_support.py,sha256=sJieOMvDWpsciPKh1mJzS56jxLtCRVlvK41hW84vexM,866
|
|
3
|
-
vastdb/_internal.py,sha256=
|
|
3
|
+
vastdb/_internal.py,sha256=fkMCzhPPFFC6-EmeJz9R8Krjbi_u9UXgv_HLvhaigHo,109583
|
|
4
4
|
vastdb/_table_interface.py,sha256=EdS50_x9ZVzRWDyV6b5hB9qIUdA7S4hNBgNq3t8deHo,3611
|
|
5
5
|
vastdb/bucket.py,sha256=ulkTI_7xw5FYVzcrTFC7G2ijmTTVSmvJZUdgzycGHR0,2588
|
|
6
6
|
vastdb/config.py,sha256=OehnsWrjzv0-SUouEXmkrKBugiWyhXOn4XiSLV3s9yk,2342
|
|
@@ -214,8 +214,8 @@ vastdb/vast_flatbuf/tabular/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
214
214
|
vastdb/vast_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
215
215
|
vastdb/vast_tests/test_ha.py,sha256=744P4G6VJ09RIkHhMQL4wlipCBJWQVMhyvUrSc4k1HQ,975
|
|
216
216
|
vastdb/vast_tests/test_scale.py,sha256=5jGwOdZH6Tv5tPdZYPWoqcxOceI2jA5i2D1zNKZHER4,3958
|
|
217
|
-
vastdb-2.0.
|
|
218
|
-
vastdb-2.0.
|
|
219
|
-
vastdb-2.0.
|
|
220
|
-
vastdb-2.0.
|
|
221
|
-
vastdb-2.0.
|
|
217
|
+
vastdb-2.0.1.dist-info/licenses/LICENSE,sha256=obffan7LYrq7hLHNrY7vHcn2pKUTBUYXMKu-VOAvDxU,11333
|
|
218
|
+
vastdb-2.0.1.dist-info/METADATA,sha256=3AyWHxel0lNv7ORfAoUhZXnol-vuGM12aprOBLAVVKo,1686
|
|
219
|
+
vastdb-2.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
220
|
+
vastdb-2.0.1.dist-info/top_level.txt,sha256=nnKAaZaQa8GFbYpWAexr_B9HrhonZbUlX6hL6AC--yA,7
|
|
221
|
+
vastdb-2.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|