Skip to content

Commit 124726a

Browse files
committed
fix test
1 parent b94cf78 commit 124726a

File tree

6 files changed

+24
-21
lines changed

6 files changed

+24
-21
lines changed

dev/build_counter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class VersionStatus(Enum):
3535
# 1) we don't load dependencies by storing it in __init__.py
3636
# 2) we can import it in setup.py for the same reason
3737
# 3) we can import it in the CLI for the same reason
38-
"""
38+
"""
3939

4040
# Save the build number to the build.py file
4141
with open("opteryx/__version__.py", "w") as f:

opteryx/__version__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# THIS FILE IS AUTOMATICALLY UPDATED DURING THE BUILD PROCESS
22
# DO NOT EDIT THIS FILE DIRECTLY
33

4-
__build__ = 1650
4+
__build__ = 1651
55
__author__ = "@joocer"
6-
__version__ = "0.26.0-beta.1650"
6+
__version__ = "0.26.0-beta.1651"
77

88
# Store the version here so:
99
# 1) we don't load dependencies by storing it in __init__.py
1010
# 2) we can import it in setup.py for the same reason
1111
# 3) we can import it in the CLI for the same reason
12-

opteryx/connectors/sql_connector.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,21 +259,26 @@ def collect_relation_stats(self) -> RelationStatistics:
259259
if row_est is not None:
260260
stats.record_count_estimate = int(row_est)
261261

262-
pg_stats = conn.execute(
263-
text("""
262+
pg_stats = (
263+
conn.execute(
264+
text("""
264265
SELECT attname, n_distinct, null_frac, histogram_bounds
265266
FROM pg_stats
266267
WHERE tablename = :t
267268
"""),
268-
{"t": table_name_only},
269-
).fetchall()
269+
{"t": table_name_only},
270+
)
271+
.mappings()
272+
.all()
273+
)
270274

271275
for row in pg_stats:
272276
col = row["attname"]
273277
stats.cardinality_estimate[col] = (
274278
int(row["n_distinct"]) if row["n_distinct"] > 0 else 0
275279
)
276-
stats.null_count[col] = int(row["null_frac"] * row_est)
280+
if row_est is not None:
281+
stats.null_count[col] = int(row["null_frac"] * row_est)
277282
bounds = row["histogram_bounds"]
278283
if bounds and isinstance(bounds, list) and len(bounds) >= 2:
279284
stats.lower_bounds[col] = bounds[0]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "opteryx"
3-
version = "0.26.0-beta.1650"
3+
version = "0.26.0-beta.1651"
44
description = "Query your data, where it lives"
55
requires-python = '>=3.11'
66
readme = {file = "README.md", content-type = "text/markdown"}

tests/unit/connectors/test_wildcard_paths.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ def test_wildcard_detection():
2525
stats = MockStatistics()
2626

2727
# These should be detected as wildcards
28-
connector = FileConnector(dataset="path/*.parquet", statistics=stats)
28+
connector = FileConnector(dataset="testdata/wildcard_test/*.parquet", statistics=stats)
2929
assert connector.has_wildcards is True
30-
31-
connector = FileConnector(dataset="path/file?.parquet", statistics=stats)
30+
31+
connector = FileConnector(dataset="testdata/wildcard_test/file?.parquet", statistics=stats)
3232
assert connector.has_wildcards is True
33-
34-
connector = FileConnector(dataset="path/file[0-9].parquet", statistics=stats)
33+
34+
connector = FileConnector(dataset="testdata/wildcard_test/file[0-9].parquet", statistics=stats)
3535
assert connector.has_wildcards is True
3636

3737

@@ -151,7 +151,6 @@ def test_wildcard_question_mark():
151151

152152

153153
if __name__ == "__main__": # pragma: no cover
154-
import sys
155-
156-
# Run tests
157-
pytest.main([__file__, "-v"])
154+
from tests import run_tests
155+
156+
run_tests()

tests/unit/planner/test_predicate_pushdown_postgres.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import sys
77

8-
sys.path.insert(1, os.path.join(sys.path[0], "../.."))
8+
sys.path.insert(1, os.path.join(sys.path[0], "../../.."))
99

1010
import time
1111

@@ -24,7 +24,7 @@
2424
"pg",
2525
SqlConnector,
2626
remove_prefix=True,
27-
connection=f"postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@trumpet.db.elephantsql.com/{POSTGRES_USER}",
27+
connection=f"postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@pg-3b7d04d1-joocer-9765.h.aivencloud.com:10067/defaultdb?sslmode=require"
2828
)
2929

3030
test_cases = [

0 commit comments

Comments
 (0)