Skip to content

Commit

Permalink
Make RELEASE state match v3.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 19, 2023
1 parent ad3c9e0 commit 4ffa728
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 260 deletions.
15 changes: 0 additions & 15 deletions autotest/gcore/tiff_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -4656,21 +4656,6 @@ def test_tiff_jxl_read_for_files_created_before_6393():
False,
100,
100,
3,
gdal.GDT_Byte,
[
"COMPRESS=LZW",
"TILED=YES",
"BLOCKXSIZE=16",
"BLOCKYSIZE=32",
"INTERLEAVE=BAND",
"PHOTOMETRIC=MINISBLACK",
],
),
(
True,
100,
100,
1,
gdal.GDT_Byte,
[
Expand Down
4 changes: 0 additions & 4 deletions autotest/generate_parquet_test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,6 @@ def generate_test_parquet():

feather.write_feather(table, HERE / "ogr/data/arrow/test.feather")

import pyarrow.feather as feather

feather.write_feather(table, HERE / "ogr/data/arrow/test.feather")


def generate_all_geoms_parquet():
import json
Expand Down
45 changes: 0 additions & 45 deletions autotest/ogr/ogr_gml_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -4040,15 +4040,6 @@ def check_no_options():
def check():
ds = gdal.OpenEx(tmp_path / "only_boundedby.gml", open_options=["USE_BBOX=YES"])
lyr = ds.GetLayer(0)
assert lyr.GetGeomType() == ogr.wkbNone
ds = None

gdal.Unlink("data/gml/only_boundedby.gfs")
check_no_options()

def check():
ds = gdal.OpenEx("data/gml/only_boundedby.gml", open_options=["USE_BBOX=YES"])
lyr = ds.GetLayer(0)
assert lyr.GetLayerDefn().GetGeomFieldCount() == 1
assert lyr.GetGeomType() == ogr.wkbPolygon
assert lyr.GetGeometryColumn() == "boundedBy"
Expand Down Expand Up @@ -4130,42 +4121,6 @@ def check():
check()


###############################################################################
# Test bug fix for https://github.com/OSGeo/gdal/pull/4397
# where there are several layers with features with gml:boundedBy elements
# and geometries in elements with different names


def test_ogr_gml_read_bbox_and_several_geom_elements():

if not gdaltest.have_gml_reader:
pytest.skip()

def check():
ds = gdal.OpenEx(
"data/gml/bbox_and_several_geom_elements.gml", open_options=["USE_BBOX=YES"]
)
lyr = ds.GetLayer(0)
assert lyr.GetGeometryColumn() == "geom1"
assert lyr.GetGeomType() == ogr.wkbMultiPolygon
f = lyr.GetNextFeature()
assert f.GetGeometryRef().GetGeometryType() == ogr.wkbMultiPolygon
lyr = ds.GetLayer(1)
assert lyr.GetGeometryColumn() == "geom2"
assert lyr.GetGeomType() == ogr.wkbPoint
f = lyr.GetNextFeature()
assert f.GetGeometryRef().GetGeometryType() == ogr.wkbPoint
ds = None

gdal.Unlink("data/gml/bbox_and_several_geom_elements.gfs")
check()

# This time with .gfs
assert os.path.exists("data/gml/bbox_and_several_geom_elements.gfs")
check()
gdal.Unlink("data/gml/bbox_and_several_geom_elements.gfs")


###############################################################################
# Test reading a file with only a boundedBy property in features that is
# invalid
Expand Down
91 changes: 0 additions & 91 deletions autotest/ogr/ogr_gpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -6669,70 +6669,6 @@ def test_ogr_gpkg_spatial_view_computed_geom_column(tmp_vsimem, tmp_path):
ds = None


###############################################################################
# Test a spatial view where the geometry column is computed with a
# Spatialite function


def test_ogr_gpkg_spatial_view_computed_geom_column():

filename = "/vsimem/test_ogr_gpkg_spatial_view_computed_geom_column.gpkg"
ds = gdaltest.gpkg_dr.CreateDataSource(filename)

if not _has_spatialite_4_3_or_later(ds):
ds = None
gdal.Unlink(filename)
pytest.skip("spatialite missing")

lyr = ds.CreateLayer("foo", geom_type=ogr.wkbPoint)
f = ogr.Feature(lyr.GetLayerDefn())
f.SetGeometry(ogr.CreateGeometryFromWkt("POINT(1 2)"))
lyr.CreateFeature(f)

ds.ExecuteSQL(
"CREATE VIEW geom_view AS SELECT fid AS my_fid, AsGPB(ST_Multi(geom)) AS my_geom FROM foo"
)
ds.ExecuteSQL(
"INSERT INTO gpkg_contents (table_name, identifier, data_type, srs_id) VALUES ( 'geom_view', 'geom_view', 'features', 4326 )"
)
ds.ExecuteSQL(
"INSERT INTO gpkg_geometry_columns (table_name, column_name, geometry_type_name, srs_id, z, m) values ('geom_view', 'my_geom', 'MULTIPOINT', 4326, 0, 0)"
)
ds.ExecuteSQL(
"INSERT INTO gpkg_extensions VALUES('geom_view', 'my_geom', 'gdal_spatialite_computed_geom_column', 'https://gdal.org/drivers/vector/gpkg_spatialite_computed_column.html', 'read-write')"
)

ds = None

import sqlite3

conn = sqlite3.connect(":memory:")
can_use_validate = False
try:
conn.enable_load_extension(True)
conn.execute('SELECT load_extension("mod_spatialite")')
can_use_validate = True
except Exception:
pass
conn.close()
if can_use_validate:
assert validate(filename), "validation failed"
else:
print("Cannot validate() due to mod_spatialite not being loadable")

ds = ogr.Open(filename)

lyr = ds.GetLayerByName("geom_view")
assert lyr.GetGeomType() == ogr.wkbMultiPoint
assert lyr.GetSpatialRef().GetAuthorityCode(None) == "4326"
f = lyr.GetNextFeature()
assert f.GetGeometryRef().ExportToWkt() == "MULTIPOINT (1 2)"

ds = None

gdal.Unlink(filename)


###############################################################################
# Test read support for legacy gdal_aspatial extension

Expand Down Expand Up @@ -8290,33 +8226,6 @@ def test_ogr_gpkg_arrow_stream_numpy_detailed_spatial_filter(tmp_vsimem, layer_t
# Test reading an empty file with GetArrowStream()


def test_ogr_gpkg_arrow_stream_empty_file():

ds = ogr.GetDriverByName("GPKG").CreateDataSource("/vsimem/test.gpkg")
lyr = ds.CreateLayer("test", geom_type=ogr.wkbPoint)
assert lyr.TestCapability(ogr.OLCFastGetArrowStream) == 1
stream = lyr.GetArrowStream()
assert stream.GetNextRecordBatch() is None
del stream

with gdaltest.config_option("OGR_GPKG_STREAM_BASE_IMPL", "YES"):
stream = lyr.GetArrowStream()
assert stream.GetNextRecordBatch() is None
del stream

with ds.ExecuteSQL("SELECT * FROM test") as lyr:
stream = lyr.GetArrowStream()
assert stream.GetNextRecordBatch() is None
del stream
ds = None

ogr.GetDriverByName("GPKG").DeleteDataSource("/vsimem/test.gpkg")


###############################################################################
# Test reading an empty file with GetArrowStream()


def test_ogr_gpkg_arrow_stream_empty_file():

ds = ogr.GetDriverByName("GPKG").CreateDataSource("/vsimem/test.gpkg")
Expand Down
28 changes: 0 additions & 28 deletions autotest/ogr/ogr_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1804,34 +1804,6 @@ def test_ogr_parquet_arrow_stream_numpy():
assert batches[0]["struct_field.a"][1] == 2
assert batches[0]["struct_field.b"][0] == 2.5

assert numpy.array_equal(batches[0]["list_uint8"][0], numpy.array([]))
assert numpy.array_equal(batches[0]["list_uint8"][1], numpy.array([0]))
assert numpy.array_equal(batches[0]["list_uint8"][2], numpy.array([]))
assert numpy.array_equal(batches[1]["list_uint8"][0], numpy.array([0, 4, 5]))
assert numpy.array_equal(batches[1]["list_uint8"][1], numpy.array([0, 7, 8, 9]))

assert batches[0]["fixed_size_binary"][0] == b"\x00\x01"
assert batches[0]["fixed_size_binary"][1] == b"\x00\x00"
assert batches[0]["fixed_size_binary"][2] == b"\x01\x01"
assert batches[1]["fixed_size_binary"][0] == b"\x01\x00"
assert batches[1]["fixed_size_binary"][1] == b"\x00\x01"

assert numpy.array_equal(
batches[0]["fixed_size_list_uint8"][0], numpy.array([0, 1])
)
assert numpy.array_equal(
batches[0]["fixed_size_list_uint8"][1], numpy.array([2, 3])
)
assert numpy.array_equal(
batches[0]["fixed_size_list_uint8"][2], numpy.array([4, 5])
)
assert numpy.array_equal(
batches[1]["fixed_size_list_uint8"][0], numpy.array([6, 7])
)
assert numpy.array_equal(
batches[1]["fixed_size_list_uint8"][1], numpy.array([8, 9])
)

ignored_fields = ["geometry"]
lyr_defn = lyr.GetLayerDefn()
for i in range(lyr_defn.GetFieldCount()):
Expand Down
34 changes: 0 additions & 34 deletions autotest/ogr/ogr_sql_rfc28.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,40 +1314,6 @@ def test_ogr_rfc28_47(data_ds):
assert lyr.SetNextByIndex((1 << 63) - 1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None

data_ds = gdaltest.ds
with data_ds.ExecuteSQL("SELECT * FROM POLY LIMIT 1") as lyr:
assert lyr.SetNextByIndex(1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY LIMIT 1 OFFSET 1") as lyr:
assert lyr.SetNextByIndex(1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY LIMIT 2 OFFSET 1") as lyr:
assert lyr.SetNextByIndex(1) == ogr.OGRERR_NONE
f = lyr.GetNextFeature()
assert f["EAS_ID"] == 171
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY LIMIT 2 OFFSET 1") as lyr:
assert lyr.SetNextByIndex(1) == ogr.OGRERR_NONE
assert lyr.SetNextByIndex(1) == ogr.OGRERR_NONE
f = lyr.GetNextFeature()
assert f["EAS_ID"] == 171
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY LIMIT 1 OFFSET 1") as lyr:
assert lyr.SetNextByIndex((1 << 63) - 1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY OFFSET 1") as lyr:
assert lyr.SetNextByIndex((1 << 63) - 1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None

with data_ds.ExecuteSQL("SELECT * FROM POLY") as lyr:
assert lyr.SetNextByIndex((1 << 63) - 1) == ogr.OGRERR_FAILURE
assert lyr.GetNextFeature() is None


###############################################################################
# Test date/datetime comparisons (#6810)
Expand Down
25 changes: 0 additions & 25 deletions autotest/ogr/ogr_wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,31 +1883,6 @@ def test_ogr_wfs_vsimem_wfs110_one_layer_getfeature(
f = sql_lyr.GetNextFeature()
assert f["str"] == "bar"

with gdaltest.tempfile(
"/vsimem/wfs_endpoint?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=my_layer&PROPERTYNAME=str,boolean,shape",
"""<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:foo="http://foo"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ows="http://www.opengis.net/ows"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
numberOfFeatures="1"
timeStamp="2015-04-17T14:14:24.859Z"
xsi:schemaLocation="http://foo /vsimem/wfs_endpoint?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=my_layer
http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<gml:featureMembers>
<foo:my_layer gml:id="my_layer.100">
<foo:str>bar</foo:str>
</foo:my_layer>
</gml:featureMembers>
</wfs:FeatureCollection>
""",
), ds.ExecuteSQL("SELECT boolean, str FROM my_layer") as sql_lyr:
f = sql_lyr.GetNextFeature()
assert f["str"] == "bar"


###############################################################################

Expand Down
1 change: 0 additions & 1 deletion frmts/tiledb/tiledbsparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "ogr_p.h"
#include "ogr_recordbatch.h"
#include "ogr_swq.h"
#include "ogr_wkb.h"

#include <algorithm>
#include <limits>
Expand Down
2 changes: 1 addition & 1 deletion ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ inline void OGRArrowLayer::ComputeConstraintsArrayIdx()
/* ExploreExprNode() */
/***********************************************************************/

inline void OGRArrowLayer::ComputeConstraintsArrayIdx()
inline void OGRArrowLayer::ExploreExprNode(const swq_expr_node *poNode)
{
const auto AddConstraint = [this](Constraint &constraint)
{ m_asAttributeFilterConstraints.emplace_back(constraint); };
Expand Down
1 change: 0 additions & 1 deletion ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7735,7 +7735,6 @@ void OGR_GPKG_FillArrowArray_Step(sqlite3_context *pContext, int /*argc*/,
{
psHelper->SetEmptyStringOrBinary(psArray, iFeat);
}
CPLFree(pabyWkbToFree);
}

if (nWKBSize == 0)
Expand Down
15 changes: 0 additions & 15 deletions swig/python/modify_cpp_files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,4 @@ string(REPLACE "if (--interpreter_counter != 0) // another sub-interpreter may s
"/* Even Rouault / GDAL hack for SWIG >= 4.1 related to objects not being freed. See swig/python/modify_cpp_files.cmake for more details */\nif( 1 )"
_CONTENTS "${_CONTENTS}")

# Below works around https://github.com/swig/swig/issues/2638 and https://github.com/swig/swig/issues/2037#issuecomment-874372082
# to avoid the ""swig/python detected a memory leak of type 'OSRSpatialReferenceShadow *', no destructor found."
# error message of https://github.com/OSGeo/gdal/issues/4907
# The issue is that starting with SWIG 4.1, the SWIG_Python_DestroyModule(), which
# is run in the gdal module (since __init__.py loads gdal in first),
# removes the destructor on the OGRSpatialReferenceShadow type (among others),
# which prevents full free of object of those type.
# The following hack just makes SWIG_Python_DestroyModule() a no-op, which
# will leak a bit of memory, but anyway SWIG currently can only free one single
# SWIG module, so we had already memleaks
# To be revisted if above mentioned SWIG issues are resolved
string(REPLACE "if (--interpreter_counter != 0) // another sub-interpreter may still be using the swig_module's types"
"/* Even Rouault / GDAL hack for SWIG >= 4.1 related to objects not being freed. See swig/python/modify_cpp_files.cmake for more details */\nif( 1 )"
_CONTENTS "${_CONTENTS}")

file(WRITE ${FILE} "${_CONTENTS}")

0 comments on commit 4ffa728

Please sign in to comment.