Skip to content

Commit

Permalink
✨ fuzzer improvements (engines) #2292
Browse files Browse the repository at this point in the history
  • Loading branch information
joocer committed Jan 24, 2025
1 parent 53816ac commit f2553be
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 20 deletions.
8 changes: 4 additions & 4 deletions tests/fuzzing/test_sql_fuzzer_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
from orso.tools import random_int, random_string
from orso.types import OrsoTypes

from pyiceberg.catalog import load_catalog
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster

import opteryx
from opteryx.utils.formatter import format_sql
from opteryx.connectors import SqlConnector
Expand Down Expand Up @@ -67,6 +63,10 @@
@lru_cache_with_expiry
def set_up_connections():

from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster
from pyiceberg.catalog import load_catalog

DATA_CATALOG_CONNECTION = os.environ.get("DATA_CATALOG_CONNECTION")
DATA_CATALOG_STORAGE = os.environ.get("DATA_CATALOG_STORAGE")
POSTGRES_PASSWORD = os.environ.get("POSTGRES_PASSWORD")
Expand Down
35 changes: 19 additions & 16 deletions tests/plan_optimization/test_limit_pushdown_datastax.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@
import opteryx
from opteryx.connectors import CqlConnector
from opteryx.utils.formatter import format_sql
from orso.tools import lru_cache_with_expiry
from tests.tools import is_arm, is_mac, is_windows, skip_if, is_version

from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster
@lru_cache_with_expiry
def set_up_connection():

# We're connecting to DataStax
cloud_config = {"secure_connect_bundle": "secure-connect.zip"}
from cassandra.auth import PlainTextAuthProvider
from cassandra.cluster import Cluster

CLIENT_ID = os.environ["DATASTAX_CLIENT_ID"]
CLIENT_SECRET = os.environ["DATASTAX_CLIENT_SECRET"]

auth_provider = PlainTextAuthProvider(CLIENT_ID, CLIENT_SECRET)
cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)

opteryx.register_store(
"datastax",
CqlConnector,
remove_prefix=True,
cluster=cluster,
)
DATASTAX_CLIENT_ID = os.environ["DATASTAX_CLIENT_ID"]
DATASTAX_CLIENT_SECRET = os.environ["DATASTAX_CLIENT_SECRET"]

# Datastax Astra Connection
cloud_config = {"secure_connect_bundle": "secure-connect.zip"}
auth_provider = PlainTextAuthProvider(DATASTAX_CLIENT_ID, DATASTAX_CLIENT_SECRET)
cluster = Cluster(cloud=cloud_config, auth_provider=auth_provider)

opteryx.register_store("datastax", CqlConnector, remove_prefix=True, cluster=cluster)

STATEMENTS = [
# baseline
("SELECT name FROM datastax.opteryx.planets;", 9),
Expand All @@ -44,8 +43,12 @@
("SELECT name FROM (SELECT * FROM datastax.opteryx.planets) AS S LIMIT 3", 3),
]

@skip_if(is_arm() or is_windows() or is_mac() or not is_version("3.10"))
@pytest.mark.parametrize("query, expected_rows", STATEMENTS)
def test_datastax_limit_pushdown(query, expected_rows):

set_up_connection()

cur = opteryx.query(query)
cur.materialize()
assert cur.stats["rows_read"] == expected_rows, cur.stats
Expand Down

0 comments on commit f2553be

Please sign in to comment.