enh: add expr.dt.to_string for SparkLikeExpr
#2529
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Related issues
Checklist
If you have comments or can explain your changes, please do so below
Implementation for
expr_dt.to_string- disclaimer: probably glossing over some dt/tz details, feel free to call me outMakes use of the convention mapping from
strptime_to_pyspark_format- can move this to_spark_like.utilsforexpr_dtandexpr_strto import from:narwhals/narwhals/_spark_like/expr_str.py
Lines 119 to 122 in dd41833
couple notes:
2020-01-09we get2020-1-9). wondering if we should update the pyspark mappings to their zero-padded equivalents?narwhals/narwhals/_spark_like/expr_str.py
Lines 125 to 141 in dd41833
W):IllegalArgumentException: All week-based patterns are unsupported since Spark 3.0, detected: W, Please use the SQL function EXTRACT instead%fshortchanges the milliseconds by only returning one decimal place. could default to higher number of placesstrptime_to_pyspark_formatremoves all instances of "T" for timezoneslet me know if there's anything else i'm missing that I can implement