sanjibansg commented on a change in pull request #12530:
URL: https://github.com/apache/arrow/pull/12530#discussion_r833791048
##########
File path: python/pyarrow/dataset.py
##########
@@ -210,6 +211,26 @@ def partitioning(schema=None, field_names=None,
flavor=None,
raise ValueError(
"For the default directory flavor, need to specify "
"a Schema or a list of field names")
+ if flavor == "filename":
Review comment:
Made the change.
##########
File path: python/pyarrow/dataset.py
##########
@@ -210,6 +211,26 @@ def partitioning(schema=None, field_names=None,
flavor=None,
raise ValueError(
"For the default directory flavor, need to specify "
"a Schema or a list of field names")
+ if flavor == "filename":
+ # default flavor
+ if schema is not None:
+ if field_names is not None:
+ raise ValueError(
+ "Cannot specify both 'schema' and 'field_names'")
+ if dictionaries == 'infer':
+ return FilenamePartitioning.discover(schema=schema)
+ return FilenamePartitioning(schema, dictionaries)
+ elif field_names is not None:
+ if isinstance(field_names, list):
+ return FilenamePartitioning.discover(field_names)
+ else:
+ raise ValueError(
+ "Expected list of field names, got {}".format(
+ type(field_names)))
+ else:
+ raise ValueError(
+ "For the default filename flavor, need to specify "
Review comment:
Corrected that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]