HyukjinKwon commented on code in PR #38994:
URL: https://github.com/apache/spark/pull/38994#discussion_r1044928308
##########
python/pyspark/sql/connect/column.py:
##########
@@ -706,28 +705,30 @@ def substr(self, startPos: Union[int, "Column"], length:
Union[int, "Column"]) -
length_t=type(length),
)
)
- from pyspark.sql.connect.function_builder import functions as F
if isinstance(length, int):
- length_exp = self._lit(length)
+ length_exp = lit(length)
elif isinstance(length, Column):
length_exp = length
else:
raise TypeError("Unsupported type for substr().")
if isinstance(startPos, int):
- start_exp = self._lit(startPos)
+ start_exp = lit(startPos)
else:
start_exp = startPos
- return F.substr(self, start_exp, length_exp)
+ return F.substr(self, start_exp, length_exp) # type:
ignore[attr-defined]
Review Comment:
```suggestion
return F.substr(self, start_exp, length_exp)
```
--
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]