Skip to content

Commit

Permalink
Fix issue when loading geoparquet file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Imbruced committed Nov 15, 2024
1 parent 8cf6935 commit 95bd4bb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class geoparquetIOTests extends TestBaseScala with BeforeAndAfterAll {
val legacyparquetdatalocation: String =
resourceFolder + "parquet/legacy-parquet-nested-columns.snappy.parquet"
val geoparquetoutputlocation: String = resourceFolder + "geoparquet/geoparquet_output/"
val overtureBBOX: String = resourceFolder + "geoparquet/overture/bbox.geoparquet"

override def afterAll(): Unit = FileUtils.deleteDirectory(new File(geoparquetoutputlocation))

Expand Down Expand Up @@ -732,6 +733,18 @@ class geoparquetIOTests extends TestBaseScala with BeforeAndAfterAll {
}
}

describe("loading one file geoparquet and filtering") {
it("should not fail when bbox is not available in geoparquet metadata") {
val numberOfRecords = sparkSession.read
.format("geoparquet")
.load(overtureBBOX)
.where("ST_Intersects(geometry, ST_PolygonFromEnvelope(0, 0, 1, 1))")
.count()

assert(numberOfRecords == 9)
}
}

def validateGeoParquetMetadata(path: String)(body: org.json4s.JValue => Unit): Unit = {
val parquetFiles = new File(path).listFiles().filter(_.getName.endsWith(".parquet"))
parquetFiles.foreach { filePath =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class geoparquetIOTests extends TestBaseScala with BeforeAndAfterAll {
val legacyparquetdatalocation: String =
resourceFolder + "parquet/legacy-parquet-nested-columns.snappy.parquet"
val geoparquetoutputlocation: String = resourceFolder + "geoparquet/geoparquet_output/"
val overtureBBOX: String = resourceFolder + "geoparquet/overture/bbox.geoparquet"

override def afterAll(): Unit = FileUtils.deleteDirectory(new File(geoparquetoutputlocation))

Expand Down Expand Up @@ -758,6 +759,18 @@ class geoparquetIOTests extends TestBaseScala with BeforeAndAfterAll {
}
}

describe("loading one file geoparquet and filtering") {
it("should not fail when bbox is not available in geoparquet metadata") {
val numberOfRecords = sparkSession.read
.format("geoparquet")
.load(overtureBBOX)
.where("ST_Intersects(geometry, ST_PolygonFromEnvelope(0, 0, 1, 1))")
.count()

assert(numberOfRecords == 9)
}
}

def validateGeoParquetMetadata(path: String)(body: org.json4s.JValue => Unit): Unit = {
val parquetFiles = new File(path).listFiles().filter(_.getName.endsWith(".parquet"))
parquetFiles.foreach { filePath =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ class geoparquetIOTests extends TestBaseScala with BeforeAndAfterAll {
}

describe("loading one file geoparquet and filtering") {
it("filtering one file geoparquet") {
it("should not fail when bbox is not available in geoparquet metadata") {
val numberOfRecords = sparkSession.read
.format("geoparquet")
.load(overtureBBOX)
Expand Down

0 comments on commit 95bd4bb

Please sign in to comment.