Skip to content

ST_ACCUM doesn't work with large geometry [blocking issue] #1179

@ebocher

Description

@ebocher

H2GIS is now aligned with the H2 database master branch.
It seems that H2 now limits the size of the geometry so we are not able to use the ST_ACCUM function to collect a large geometry. This is a major limitation because we very often use this feature. e.g to collect geometry and them make a geometric union.

Bellow a test case :

 stat.execute("SELECT ST_ACCUM(st_makepoint(-60 + x*random()/500.00, 30 + x*random()/500.00)) FROM GENERATE_SERIES(1, 200000)");

return

org.h2.jdbc.JdbcSQLDataException: Erreur lors de la conversion de données "MULTIPOINT ((-59.99846264808233 30.001373469410424), (-59.998659904043855 30.00359875619911), (-59.99818405486635 30.001342960154478), (-59.99248083976687 30.005548028189605), (-59.99710750384512 30.0087595666811), (-59.98935000486914 30.010567250923458), (-59.98872776982998 30.00579991917569), (-59.988859365166306 30.01176541752058), (-59.99220299425209 30.001769057507865), (-59.98862727872355 30.006441081017915), (-59.98928486422148 30.006348921480512), (-59.994522750946544 30.007875703827047), (-59.97935668737607 30.01781393392941), (-59.98989449302335 30.005819545057765), (-59.98641590666691 30.013803475962447), (-59.987499738595524 30.00062805058836), (-59.98314718509915 30.016236189977178), (-59.97404162990321 30.028050674080767), (-59.96503783749777 30.037856302041757), (-59.979808960849084 30.014753142982308), (-59.994539165341976 30.030967600597155), (-59.97961810085148 30.00201844780868), (-59.98032507357043 30.04438628497847), (-59.98683408372183 30.017971252512094), (-59.95849332786016 30.01377963470651), (-59.97044608652996 30.050354982802546), (-59.99184481787917 30.006603372206577), (-59.964741862213046 30.04361057983041), (-59.94291234924693 30.041056606467333), (-59.970816098580656 30.047010800403996), (-59.94094269388272 30.048089508492755), (-59.987709240779566 30.05414397017014), (-59.977313968788366 30.065775174309945), (-59.94915588578873 30.013366281990844), (-59.99664480818081 30.00754372090674), (-59.978475598893084 30.03320212790707), (-59.96087231516878 30.051123283972444), (-59.9278138025861 30.031317399886206), (-59.967592369127246 30.038789453366253), (-59.93748626233544 30.051871409055195), (-59.98471858057032 30.04294167190616), (-59.96334773856473 30.019018860216008), (-59.97177494937724 30.053352257623427), (-59.917643383283675 30.075334320671292), (-59.972642172079894 30.0249210308793), (-59.97846073231109 30.060217728329278), (-59.94007854317902 30.0346659639323<...>4565243058), (-52.32362853791666 363.1939062824903), (159.9899402822379 76.54531128078362), (136.95081323040685 101.21926728105079), (180.87900149957798 76.73493486734354), (68.22166274109352 401.63127260907396), (122.99862242626241 257.087893951634), (39.70283962052695 208.96933395265035), (-20.393121281262093 420.5926257880591), (251.2480791796528 53.34519837398293), (-21.474999005608748 327.83929816824696), (139.46454500143372 306.55236764857386), (-36.091246059114056 281.32225076989545), (88.80775118282992 179.51371986466145), (249.33275015746844 285.26827463055884), (218.68151186729955 390.6579684867638), (-26.632892867228385 212.27676749869693), (60.836186168454844 218.46191707145277), (259.19569592690107 396.56457198818515), (70.56715690099253 341.9996223261944), (167.68624065161075 174.19954346598928), (257.0138125313422 83.74154486817864), (326.3993449061467 302.38947403044915), (-30.008836779676813 184.48696392637544), (231.15789551955575 317.3945372781764), (47.422303556308485 75.17155450220594), (135.45130841443077 125.98296319279234), (106.85216596998275 151.5030859806653), (-19.75018073465288 77.8382746178932), (153.56769228704718 416.48662209462964), (-37.50598105851135 228.23990873783322), (83.26918200161302 223.34763944545276), (101.1653881906037 275.73206877195804), (272.1139683313572 133.62241526882352), (331.64708940290586 347.5838043115693), (76.07528214145057 99.78119824672875), (244.09368608861706 206.3777222801219), (301.9047301907266 287.3822533490313), (178.6191078615721 163.5328429803786), (166.53139844204242 271.77095201512185), (200.17050817163513 211.42348977142905), (126.46599767502609 275.4393475446536), (97.81094168198256 223.24145874654263), (38.533428822613146 156.71476250532672), (-11.813637905814803 320.4041666692813), (203.3393026916165 416.70079742390914), (150.18460240728456 270.1305541089319))"; SQL statement:
SELECT ST_ACCUM(st_makepoint(-60 + x*random()/500.00, 30 + x*random()/500.00)) FROM GENERATE_SERIES(1, 200000) [22018-201]

	at org.h2.message.DbException.getJdbcSQLException(DbException.java:506)
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:477)
	at org.h2.message.DbException.get(DbException.java:223)
	at org.h2.message.DbException.get(DbException.java:199)
	at org.h2.value.ValueGeometry.getFromGeometry(ValueGeometry.java:89)
	at org.h2.value.ValueToObjectConverter.objectToValue(ValueToObjectConverter.java:144)
	at org.h2.expression.aggregate.JavaAggregate.getAggregatedValue(JavaAggregate.java:147)
	at org.h2.expression.analysis.DataAnalysisOperation.getValue(DataAnalysisOperation.java:391)
	at org.h2.command.query.Select.constructGroupResultRow(Select.java:580)
	at org.h2.command.query.Select.processGroupResult(Select.java:547)

@katzyn is it possible to remove this lock ?

A geometry size must be able to exceed, Constants.MAX_STRING_LENGTH
checked in ValueBytesBase
if (length > Constants.MAX_STRING_LENGTH)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions