Copilot commented on code in PR #2350:
URL: https://github.com/apache/sedona/pull/2350#discussion_r2350344434
##########
spark/common/src/test/scala/org/apache/spark/sql/sedona_sql/io/stac/StacPartitionReaderTest.scala:
##########
@@ -27,14 +27,23 @@ import scala.jdk.CollectionConverters._
class StacPartitionReaderTest extends TestBaseScala {
+ def getAbsolutePathOfResource(resourceFilePath: String): String = {
+ val resourceUrl = getClass.getClassLoader.getResource(resourceFilePath)
+ if (resourceUrl != null) {
+ resourceUrl.getPath
+ } else {
+ throw new IllegalArgumentException(s"Resource not found:
$resourceFilePath")
+ }
+ }
+
Review Comment:
[nitpick] The `getAbsolutePathOfResource` method is duplicated across
multiple test classes. Consider extracting this utility method to a shared test
base class or utility object to avoid code duplication.
```suggestion
```
##########
spark/common/src/test/scala/org/apache/spark/sql/sedona_sql/io/stac/StacBatchTest.scala:
##########
@@ -44,7 +44,7 @@ class StacBatchTest extends TestBaseScala {
it("collectItemLinks should collect correct item links") {
val collectionUrl =
-
"https://earth-search.aws.element84.com/v1/collections/sentinel-2-pre-c1-l2a"
+ "file://" +
getAbsolutePathOfResource("stac/collections/sentinel-2-pre-c1-l2a.json")
Review Comment:
The `getAbsolutePathOfResource` method is called but not defined in this
class. This will cause a compilation error unless the method is added to this
test class or imported from elsewhere.
--
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]