rdblue commented on code in PR #5011:
URL: https://github.com/apache/iceberg/pull/5011#discussion_r901911172
##########
python/tests/conftest.py:
##########
@@ -301,3 +319,81 @@ def all_avro_types() -> Dict[str, Any]:
@pytest.fixture
def catalog() -> InMemoryCatalog:
return InMemoryCatalog("test.in.memory.catalog", {"test.key":
"test.value"})
+
+
[email protected](scope="session")
+def simple_struct():
+ return StructType(
+ NestedField(1, "required_field", StringType(), True, "this is a doc"),
NestedField(2, "optional_field", IntegerType())
+ )
+
+
[email protected](scope="session")
+def simple_list():
+ return ListType(element_id=22, element=StringType(), element_required=True)
+
+
[email protected](scope="session")
+def simple_map():
+ return MapType(key_id=19, key_type=StringType(), value_id=25,
value_type=DoubleType(), value_required=False)
+
+
+class LocalOutputFile(OutputFile):
+ """An OutputFile implementation for local files (for test use only)"""
+
+ def __init__(self, location: str):
+
+ parsed_location = urlparse(location) # Create a ParseResult from the
uri
+ if parsed_location.scheme and parsed_location.scheme != "file": #
Validate that a uri is provided with a scheme of `file`
+ raise ValueError("LocalOutputFile location must have a scheme of
`file`")
+ elif parsed_location.netloc:
+ raise ValueError(f"Network location is not allowed for
LocalOutputFile: {parsed_location.netloc}")
+
+ super().__init__(location=location)
+ self._parsed_location = parsed_location
+
+ @property
+ def parsed_location(self) -> ParseResult:
Review Comment:
Does this need to be exposed? It doesn't look like it is used anywhere
outside of this class.
Also, only `path` is called on it. Can we store just `path` instead?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]