Skip to content

[SPARK-48843] Prevent infinite loop with BindParameters #47271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions python/pyspark/sql/tests/connect/test_connect_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,13 @@ def test_sql_with_named_args(self):
df2 = self.spark.sql(sqlText, args={"minId": 7, "m": SF.create_map(SF.lit("a"), SF.lit(1))})
self.assert_eq(df.toPandas(), df2.toPandas())

def test_namedargs_with_global_limit(self):
sqlText = """SELECT * FROM VALUES (TIMESTAMP('2022-12-25 10:30:00'), 1) as tab(date, val)
where val = :val"""
df = self.connect.sql(sqlText, args={"val": 1})
df2 = self.spark.sql(sqlText, args={"val": 1})
self.assert_eq(df.toPandas(), df2.toPandas())

def test_sql_with_pos_args(self):
sqlText = "SELECT *, element_at(?, 1) FROM range(10) WHERE id > ?"
df = self.connect.sql(sqlText, args=[CF.array(CF.lit(1)), 7])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ object BindParameters extends ParameterizedQueryProcessor with QueryErrorsBase {
args(posToIndex(pos))
}

case _ => plan
case other => other
}
}
}