-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
fix multimethod bug in pyspark #1260
Conversation
hey @mfkapton hope you don't mind, made a PR from your fork, I'll test your changes out further |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1260 +/- ##
==========================================
+ Coverage 93.74% 93.82% +0.08%
==========================================
Files 90 90
Lines 6711 6704 -7
==========================================
- Hits 6291 6290 -1
+ Misses 420 414 -6
☔ View full report in Codecov by Sentry. |
@cosmicBboy sorry for the late reply. Here's a way to replicate the bug: import pyspark.sql.types as T
from pyspark.sql import DataFrame, SparkSession
import pandera.extensions as extensions
from pandera.pyspark import DataFrameModel
@extensions.register_check_method(
supported_types=DataFrame,
)
def fake_check(df: DataFrame):
return True
class ExampleDFModel(DataFrameModel):
name: T.StringType()
age: T.LongType()
class Config:
fake_check = ()
example_data_cols = ("name", "age")
example_data = [("foo", 42), ("bar", 24)]
# Get the pyspark session
session = SparkSession.builder.config().getOrCreate()
df = session.createDataFrame(example_data, example_data_cols)
out = ExampleDFModel(df, lazy=False) raises an Exception:
Here's the output of |
80542c5
to
ada409e
Compare
@cosmicBboy I've added a test that could help you understand the issue. I've changed the order of the commits so now the test is the first commit. You can check out the commit with the test that fails without the fix:
|
Signed-off-by: mfkaptan <[email protected]>
Making `key` argument optional did not work because of an existing bug in multimethod: coady/multimethod#90 Added a second overloaded `preprocess` method that doesn't have `key` arg so multimethod lib can dispatch correctly. Same with apply function. Signed-off-by: mfkaptan <[email protected]>
Signed-off-by: mfkaptan <[email protected]>
looks like unit tests are failing |
@cosmicBboy the tests are passing again ✅ |
No description provided.