Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add SparkExpr.cast for basic types #1812

Merged
merged 12 commits into from
Jan 17, 2025

Conversation

EdAbati
Copy link
Collaborator

@EdAbati EdAbati commented Jan 15, 2025

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Comment on lines +40 to +41
if isinstance(dtype, pyspark_types.ByteType):
return dtypes.Int8()
Copy link
Collaborator Author

@EdAbati EdAbati Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember this came up already @MarcoGorelli . I found the source: https://spark.apache.org/docs/latest/sql-ref-datatypes.html "ByteType is a 1-byte signed integer (within the range of -128 to 127)." 😅also in the spark.pandas code

Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EdAbati ! I left a few comments, but really looking forward to merge this 🚀

narwhals/_spark_like/utils.py Show resolved Hide resolved
narwhals/_spark_like/utils.py Outdated Show resolved Hide resolved
narwhals/_spark_like/utils.py Outdated Show resolved Hide resolved
tests/expr_and_series/cast_test.py Show resolved Hide resolved
@FBruzzesi FBruzzesi added the enhancement New feature or request label Jan 15, 2025
Copy link
Member

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EdAbati

NarwhalDolphinGIF

@FBruzzesi FBruzzesi merged commit 70bc5c6 into narwhals-dev:main Jan 17, 2025
23 of 24 checks passed
@EdAbati EdAbati deleted the spark-cast branch January 17, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants