Skip to content

Commit

Permalink
remove native snowpark cortex func tests
Browse files Browse the repository at this point in the history
Signed-off-by: Labanya Mukhopadhyay <[email protected]>
  • Loading branch information
sfc-gh-lmukhopadhyay committed Jan 27, 2025
1 parent 80fa2a5 commit 582623d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 72 deletions.
2 changes: 0 additions & 2 deletions docs/source/snowpark/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,6 @@ Functions
sinh
size
skew
snowflake_cortex_sentiment
snowflake_cortex_summarize
sort_array
soundex
split
Expand Down
70 changes: 0 additions & 70 deletions tests/integ/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@
reverse,
sequence,
size,
snowflake_cortex_sentiment,
snowflake_cortex_summarize,
split,
sqrt,
startswith,
Expand Down Expand Up @@ -179,7 +177,6 @@
from tests.utils import (
TestData,
Utils,
running_on_jenkins,
structured_types_enabled_session,
)

Expand Down Expand Up @@ -2329,70 +2326,3 @@ def test_ln(session):
df = session.create_dataframe([[e]], schema=["ln_value"])
res = df.select(ln(col("ln_value")).alias("result")).collect()
assert res[0][0] == 1.0


@pytest.mark.skipif(
"config.getoption('local_testing_mode', default=False)",
reason="FEAT: snowflake_cortex functions not supported",
)
@pytest.mark.skipif(
running_on_jenkins(),
reason="TODO: SNOW-1859087 snowflake.cortex.summarize SSL error",
)
def test_snowflake_cortex_summarize(session):
# TODO: SNOW-1758914 snowflake.cortex.summarize error on GCP
if session.connection.host == "sfctest0.us-central1.gcp.snowflakecomputing.com":
return

content = """In Snowpark, the main way in which you query and process data is through a DataFrame. This topic explains how to work with DataFrames.
To retrieve and manipulate data, you use the DataFrame class. A DataFrame represents a relational dataset that is evaluated lazily: it only executes when a specific action is triggered. In a sense, a DataFrame is like a query that needs to be evaluated in order to retrieve data.
To retrieve data into a DataFrame:
Construct a DataFrame, specifying the source of the data for the dataset.
For example, you can create a DataFrame to hold data from a table, an external CSV file, from local data, or the execution of a SQL statement.
Specify how the dataset in the DataFrame should be transformed.
For example, you can specify which columns should be selected, how the rows should be filtered, how the results should be sorted and grouped, etc.
Execute the statement to retrieve the data into the DataFrame.
In order to retrieve the data into the DataFrame, you must invoke a method that performs an action (for example, the collect() method).
The next sections explain these steps in more detail.
"""
df = session.create_dataframe([[content]], schema=["content"])
summary_from_col = df.select(snowflake_cortex_summarize(col("content"))).collect()[
0
][0]
summary_from_str = df.select(snowflake_cortex_summarize(content)).collect()[0][0]
# this length check is to get around the fact that this function may not be deterministic
assert 0 < len(summary_from_col) < len(content)
assert 0 < len(summary_from_str) < len(content)


@pytest.mark.skipif(
"config.getoption('local_testing_mode', default=False)",
reason="FEAT: snowflake_cortex functions not supported",
)
@pytest.mark.skipif(
running_on_jenkins(),
reason="TODO: SNOW-1859087 snowflake.cortex.sentiment SSL error",
)
def test_snowflake_cortex_sentiment(session):
# TODO: SNOW-1758914 snowflake.cortex.sentiment error on GCP
if session.connection.host == "sfctest0.us-central1.gcp.snowflakecomputing.com":
return
content = "A very very bad review!"
df = session.create_dataframe([[content]], schema=["content"])

sentiment_from_col = df.select(
snowflake_cortex_sentiment(col("content"))
).collect()[0][0]
sentiment_from_str = df.select(snowflake_cortex_sentiment(content)).collect()[0][0]

assert -1 <= sentiment_from_col <= 0
assert -1 <= sentiment_from_str <= 0

0 comments on commit 582623d

Please sign in to comment.