Skip to content

Commit e9de9df

Browse files
authored
Merge branch 'apache:master' into SPARK-48582
2 parents e875278 + 53d65fd commit e9de9df

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

core/src/main/scala/org/apache/spark/status/api/v1/api.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ case class StackTrace(elems: Seq[String]) {
510510
override def toString: String = elems.mkString
511511

512512
def html: NodeSeq = {
513-
val withNewLine = elems.foldLeft(NodeSeq.Empty) { (acc, elem) =>
513+
val withNewLine = elems.map(_.stripLineEnd).foldLeft(NodeSeq.Empty) { (acc, elem) =>
514514
if (acc.isEmpty) {
515515
acc :+ Text(elem)
516516
} else {

python/pyspark/sql/connect/dataframe.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ def select(self, __cols: Union[List[Column], List[str]]) -> ParentDataFrame:
223223
def select(self, *cols: "ColumnOrName") -> ParentDataFrame: # type: ignore[misc]
224224
if len(cols) == 1 and isinstance(cols[0], list):
225225
cols = cols[0]
226+
if any(not isinstance(c, (str, Column)) for c in cols):
227+
raise PySparkTypeError(
228+
error_class="NOT_LIST_OF_COLUMN_OR_STR",
229+
message_parameters={"arg_name": "columns"},
230+
)
226231
return DataFrame(
227232
plan.Project(self._plan, [F._to_col(c) for c in cols]),
228233
session=self._session,

python/pyspark/sql/tests/connect/test_connect_error.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from pyspark.errors.exceptions.base import SessionNotSameException
2222
from pyspark.sql.types import Row
2323
from pyspark.testing.connectutils import should_test_connect
24+
from pyspark.errors import PySparkTypeError
2425
from pyspark.errors.exceptions.connect import AnalysisException
2526
from pyspark.sql.tests.connect.test_connect_basic import SparkConnectSQLTestCase
2627

@@ -214,6 +215,16 @@ def test_column_cannot_be_constructed_from_string(self):
214215
with self.assertRaises(TypeError):
215216
Column("col")
216217

218+
def test_select_none(self):
219+
with self.assertRaises(PySparkTypeError) as e1:
220+
self.connect.range(1).select(None)
221+
222+
self.check_error(
223+
exception=e1.exception,
224+
error_class="NOT_LIST_OF_COLUMN_OR_STR",
225+
message_parameters={"arg_name": "columns"},
226+
)
227+
217228

218229
if __name__ == "__main__":
219230
from pyspark.sql.tests.connect.test_connect_error import * # noqa: F401

0 commit comments

Comments
 (0)