-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-38797][python] Fixed PyFlink issue CsvSchemaBuilder.set_null_value missing return self #27331
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
Conversation
dianfu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wchan87 Good catch! LGTM.
|
Prior commit ran into flake8 check so renamed the test method Seeing if I can trigger a re-run of CI |
| schema = CsvSchema.builder() \ | ||
| .add_string_column('string') \ | ||
| .add_number_column('number') \ | ||
| .set_null_value('') \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some testing suggestions:
I would test a test with .set_null_value(), set the default? If so we should test that
I also suggest a test specifying that a non default literal for null works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A null_value must be specified if .set_null_value is called. There is no default value.
What is the purpose of the change
Currently,
CsvSchemaBuilder.set_null_valuedoesn'treturn selfwhich breaks the builder design pattern which in turn makes the method unusable without workaround to retrieve the private_j_schema_builderobject to callsetNullValuedirectly. If left as-is, the current usage of the method with respect to the builder design pattern returns something like:Brief change log
return selfto the end of theCsvSchemaBuilder.set_null_valuemethodVerifying this change
This change added tests and can be verified as follows:
test_csv_default_null_valueand helper methods which test empty string,''is treated as null (i.e.,Nonein Python)Does this pull request potentially affect one of the following parts:
@Public(Evolving): noCsvSchemaBuilderwon't work properly as-is so this PR fixes itDocumentation