feat: Add Spark to_pretty_string function#12780
feat: Add Spark to_pretty_string function#12780ArnavBalyan wants to merge 2 commits intofacebookincubator:mainfrom
Conversation
ArnavBalyan
commented
Mar 24, 2025
- Add support for to_pretty_string used by Spark.
- Builds upon @jinchengchenghh's contribution here Add SparkSql function to_pretty_string #10359
|
cc @rui-mo @jinchengchenghh can you PTAL thanks! |
✅ Deploy Preview for meta-velox canceled.
|
There was a problem hiding this comment.
It appears the date-to-string cast throws for runtime error, but here we return "NULL" for both user error and runtime error. Which is aligned with Spark?
velox/velox/expression/CastExpr.cpp
Lines 183 to 185 in ccd765d
There was a problem hiding this comment.
CastExpr::applyToSelectedNoThrowLocal adopts the below logic for NULL.
velox/velox/expression/CastExpr-inl.h
Lines 206 to 214 in ccd765d
There was a problem hiding this comment.
Do you mean match the VeloxException, then catch std::exception? @rui-mo This is not addressed. @ArnavBalyan
There was a problem hiding this comment.
The current implementation throws a user error when invalid timestamp is encountered, is this not what was intended? thanks!
There was a problem hiding this comment.
Current implementation catches all the std::exception and converts them as user error, while in the cast, exception is thrown if not a user error, and set null result if it is. If the only differences with cast are the listed ones, we might align with cast here.
|
cc @rui-mo if you could please take a look |
|
Would you run the Spark expression fuzzer test for 2 minutes to make sure it works? You could specify The command for reference: https://github.com/facebookincubator/velox/blob/main/.github/workflows/scheduled.yml#L587-L596 |
0429c3e to
bd0f369
Compare
Done thanks: |
|
@jinchengchenghh Do you have further comment? Thanks. |
|
LGTM @rui-mo |
assignUser
left a comment
There was a problem hiding this comment.
Please make sure CI passes, currently a test is failing. I'd recommend rebasing/merging main too.
bd0f369 to
07c3af1
Compare
Updated thanks! |
07c3af1 to
6f5963a
Compare
6f5963a to
5568329
Compare
|
cc @assignUser can you pls rerun the tests |
|
@ArnavBalyan You could apply the below diff to fix the format issue. https://github.com/facebookincubator/velox/actions/runs/14532602668/attempts/2#summary-40925598950 |
Thanks, updated |
|
cc @assignUser could you pls take a look thanks! |
|
@ArnavBalyan It seems your updates are not pushed in, including #12780 (comment), could you confirm? |
|
This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the PR, make sure you've addressed reviewer comments, and rebase on the latest main. Thank you for your contributions! |
Summary: - Add support for to_pretty_string used by Spark, this operator is used for `df.show()` to show the result to terminal. - Builds upon jinchengchenghh's contribution here #10359 and ArnavBalyan's contribution here #12780 Pull Request resolved: #16245 Reviewed By: tanjialiang Differential Revision: D92490039 Pulled By: xiaoxmeng fbshipit-source-id: fb70a1c8a8c9f7f7402f8626a29c810ad6a01048
