HyukjinKwon commented on a change in pull request #35191:
URL: https://github.com/apache/spark/pull/35191#discussion_r820354270
##########
File path: python/pyspark/pandas/series.py
##########
@@ -5228,9 +5229,20 @@ def asof(self, where: Union[Any, List]) -> Union[Scalar,
"Series"]:
where = [where]
index_scol = self._internal.index_spark_columns[0]
index_type = self._internal.spark_type_for(index_scol)
+
+ if np.nan in where:
+ # When `where` is np.nan, pandas returns the last index value.
+ last_index =
self._internal.spark_frame.select(F.last(index_scol)).take(1)[0][0]
Review comment:
Sorry for my late review. `last` expression is indeterministic so it
doesn't guarantee the order. We should do this after sorting it actually but it
would be too expensive. Since it's less likely that `where` is `na.nan`, can we
explicitly throw an exception for now?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]