From 4ffa7289fbd0407378a2dab90191d17e87433d6c Mon Sep 17 00:00:00 2001 From: Clifford Yapp <238416+starseeker@users.noreply.github.com> Date: Tue, 19 Dec 2023 12:34:00 -0500 Subject: [PATCH] Make RELEASE state match v3.8.1 --- autotest/gcore/tiff_read.py | 15 --- autotest/generate_parquet_test_file.py | 4 - autotest/ogr/ogr_gml_read.py | 45 --------- autotest/ogr/ogr_gpkg.py | 91 ------------------- autotest/ogr/ogr_parquet.py | 28 ------ autotest/ogr/ogr_sql_rfc28.py | 34 ------- autotest/ogr/ogr_wfs.py | 25 ----- frmts/tiledb/tiledbsparse.cpp | 1 - .../arrow_common/ograrrowlayer.hpp | 2 +- .../gpkg/ogrgeopackagetablelayer.cpp | 1 - swig/python/modify_cpp_files.cmake | 15 --- 11 files changed, 1 insertion(+), 260 deletions(-) diff --git a/autotest/gcore/tiff_read.py b/autotest/gcore/tiff_read.py index 4dbafd96379e..2b806763a4e2 100755 --- a/autotest/gcore/tiff_read.py +++ b/autotest/gcore/tiff_read.py @@ -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, [ diff --git a/autotest/generate_parquet_test_file.py b/autotest/generate_parquet_test_file.py index e730a23a1cd9..b0c89261ad65 100644 --- a/autotest/generate_parquet_test_file.py +++ b/autotest/generate_parquet_test_file.py @@ -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 diff --git a/autotest/ogr/ogr_gml_read.py b/autotest/ogr/ogr_gml_read.py index 9bfccd6bfca6..01e6d6525799 100755 --- a/autotest/ogr/ogr_gml_read.py +++ b/autotest/ogr/ogr_gml_read.py @@ -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" @@ -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 diff --git a/autotest/ogr/ogr_gpkg.py b/autotest/ogr/ogr_gpkg.py index 8d4241eeb087..92cf234cb315 100755 --- a/autotest/ogr/ogr_gpkg.py +++ b/autotest/ogr/ogr_gpkg.py @@ -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 @@ -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") diff --git a/autotest/ogr/ogr_parquet.py b/autotest/ogr/ogr_parquet.py index c739bc33a85a..576cecf01d9c 100755 --- a/autotest/ogr/ogr_parquet.py +++ b/autotest/ogr/ogr_parquet.py @@ -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()): diff --git a/autotest/ogr/ogr_sql_rfc28.py b/autotest/ogr/ogr_sql_rfc28.py index 2b59abb699a4..d5aa09bdac81 100755 --- a/autotest/ogr/ogr_sql_rfc28.py +++ b/autotest/ogr/ogr_sql_rfc28.py @@ -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) diff --git a/autotest/ogr/ogr_wfs.py b/autotest/ogr/ogr_wfs.py index 53c54ab40dd8..3b27bd7e71a2 100755 --- a/autotest/ogr/ogr_wfs.py +++ b/autotest/ogr/ogr_wfs.py @@ -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", - """ - - - bar - - - -""", - ), ds.ExecuteSQL("SELECT boolean, str FROM my_layer") as sql_lyr: - f = sql_lyr.GetNextFeature() - assert f["str"] == "bar" - ############################################################################### diff --git a/frmts/tiledb/tiledbsparse.cpp b/frmts/tiledb/tiledbsparse.cpp index 2668b5ecd116..d8c5bb4aabee 100644 --- a/frmts/tiledb/tiledbsparse.cpp +++ b/frmts/tiledb/tiledbsparse.cpp @@ -33,7 +33,6 @@ #include "ogr_p.h" #include "ogr_recordbatch.h" #include "ogr_swq.h" -#include "ogr_wkb.h" #include #include diff --git a/ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp b/ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp index 41e81ab8681e..32c2e86d9624 100644 --- a/ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp +++ b/ogr/ogrsf_frmts/arrow_common/ograrrowlayer.hpp @@ -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); }; diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp index 68cde9b849ff..2bb904868eff 100644 --- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp +++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagetablelayer.cpp @@ -7735,7 +7735,6 @@ void OGR_GPKG_FillArrowArray_Step(sqlite3_context *pContext, int /*argc*/, { psHelper->SetEmptyStringOrBinary(psArray, iFeat); } - CPLFree(pabyWkbToFree); } if (nWKBSize == 0) diff --git a/swig/python/modify_cpp_files.cmake b/swig/python/modify_cpp_files.cmake index d1f789a95f72..d5850c04abc9 100644 --- a/swig/python/modify_cpp_files.cmake +++ b/swig/python/modify_cpp_files.cmake @@ -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}")