Skip to content

logictest: adjust a few of geo tests for s390x #148784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/distsql_stats
Original file line number Diff line number Diff line change
Expand Up @@ -1672,13 +1672,29 @@ let $hist_id_1
SELECT histogram_id FROM [SHOW STATISTICS FOR TABLE geo_table]
WHERE statistics_name = 's' AND column_names = '{geog}'

# s390x produces slightly different inverted index key for the linestring (among
# other shapes) because it has architecture support for trigonometric functions
# (used by s2 library), so we have different expectations for s390x vs other
# systems. s390x is the only big endian system we support right now, so we abuse
# the corresponding option a bit.
skipif bigendian

query TIRI colnames,nosort
SHOW HISTOGRAM $hist_id_1
----
upper_bound range_rows distinct_range_rows equal_rows
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
'\x42fd5000000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1

skipif littleendian

query TIRI colnames,nosort
SHOW HISTOGRAM $hist_id_1
----
upper_bound range_rows distinct_range_rows equal_rows
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
'\x42fd5000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1

statement ok
DROP INDEX geo_table@geog_idx_1;

Expand All @@ -1690,6 +1706,8 @@ let $hist_id_1
SELECT histogram_id FROM [SHOW STATISTICS FOR TABLE geo_table]
WHERE statistics_name = 's' AND column_names = '{geog}'

skipif bigendian

query TIRI colnames,nosort
SHOW HISTOGRAM $hist_id_1
----
Expand All @@ -1699,6 +1717,17 @@ upper_bound
'\x42fd4700000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
'\x42fd5ad4000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1

skipif littleendian

query TIRI colnames,nosort
SHOW HISTOGRAM $hist_id_1
----
upper_bound range_rows distinct_range_rows equal_rows
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
'\x42fd4500000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
'\x42fd4700000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
'\x42fd5ad4000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1

# Stats for multi-column inverted indexes.
statement ok
CREATE TABLE multi_col (
Expand Down
13 changes: 10 additions & 3 deletions pkg/sql/logictest/testdata/logic_test/geospatial
Original file line number Diff line number Diff line change
Expand Up @@ -4702,11 +4702,15 @@ Square overlapping left and right square Square (right)
Square overlapping left and right square Square overlapping left and right square true true true

# ST_Segmentize
#
# ST_Segmentize uses some trigonometric functions implicitly (via s2 library),
# which have architecture suppport on some systems like s390x, which can produce
# slightly different results, so we perform "rounding" via regexp replacement.
query TTT
SELECT
dsc,
ST_AsText(ST_Segmentize(geog, 100000)),
ST_AsText(ST_Segmentize(geog, 50000))
regexp_replace(ST_AsText(ST_Segmentize(geog, 50000)), '1.000028552944326', '1.000028552944327', 'g')
FROM geog_operators_test
ORDER BY dsc
----
Expand All @@ -4719,7 +4723,7 @@ NULL NULL
Nested Geometry Collection GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)))
Point middle of Left Square POINT (-0.5 0.5) POINT (-0.5 0.5)
Point middle of Right Square POINT (0.5 0.5) POINT (0.5 0.5)
Square (left) POLYGON ((-1 0, -0.5 0, 0 0, 0 0.5, 0 1, -0.5 1.000038070652873, -1 1, -1 0.5, -1 0)) POLYGON ((-1 0, -0.75 0, -0.5 0, -0.25 0, 0 0, 0 0.25, 0 0.5, 0 0.75, 0 1, -0.249999998550193 1.000028552944327, -0.5 1.000038070652873, -0.750000001449807 1.000028552944326, -1 1, -1 0.75, -1 0.5, -1 0.25, -1 0))
Square (left) POLYGON ((-1 0, -0.5 0, 0 0, 0 0.5, 0 1, -0.5 1.000038070652873, -1 1, -1 0.5, -1 0)) POLYGON ((-1 0, -0.75 0, -0.5 0, -0.25 0, 0 0, 0 0.25, 0 0.5, 0 0.75, 0 1, -0.249999998550193 1.000028552944327, -0.5 1.000038070652873, -0.750000001449807 1.000028552944327, -1 1, -1 0.75, -1 0.5, -1 0.25, -1 0))
Square (right) POLYGON ((0 0, 0.5 0, 1 0, 1 0.5, 1 1, 0.5 1.000038070652873, 0 1, 0 0.5, 0 0)) POLYGON ((0 0, 0.25 0, 0.5 0, 0.75 0, 1 0, 1 0.25, 1 0.5, 1 0.75, 1 1, 0.750000001449807 1.000028552944327, 0.5 1.000038070652873, 0.249999998550193 1.000028552944327, 0 1, 0 0.75, 0 0.5, 0 0.25, 0 0))
Square overlapping left and right square POLYGON ((-0.1 0, 0.45 0, 1 0, 1 0.5, 1 1, 0.45 1.000046065796834, -0.1 1, -0.1 0.5, -0.1 0)) POLYGON ((-0.1 0, 0.175 0, 0.45 0, 0.725 0, 1 0, 1 0.25, 1 0.5, 1 0.75, 1 1, 0.725000001929716 1.000034549281259, 0.45 1.000046065796834, 0.174999998070284 1.000034549281259, -0.1 1, -0.1 0.75, -0.1 0.5, -0.1 0.25, -0.1 0))

Expand Down Expand Up @@ -5469,11 +5473,14 @@ POLYGON ((-0.1 0, 1 0, 1 1, -0.1 1, -0.1 0)) POLYGON ((0 -0.1, 0 1, 1
POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((0 -1, 0 0, 1 0, 1 -1, 0 -1))
POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))

# ST_Rotate uses some trigonometric functions internally, which have
# architecture suppport on some systems like s390x, which can produce slightly
# different results, so we perform "rounding" via regexp replacement.
query TTT
SELECT
ST_AsText(a.geom) d,
ST_AsText(ST_Rotate(a.geom, pi())),
ST_AsText(ST_Rotate(a.geom, pi()/4))
regexp_replace(ST_AsText(ST_Rotate(a.geom, pi()/4)), 'POINT \(0.000000000000001 7.071067811865476\)', 'POINT (0 7.071067811865476)', 'g')
FROM geom_operators_test a
ORDER BY d ASC
----
Expand Down
47 changes: 41 additions & 6 deletions pkg/sql/opt/exec/execbuilder/testdata/geospatial
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,75 @@ CPut /Table/106/1/1/0 -> /TUPLE/
CPut /Table/106/1/2/0 -> /TUPLE/

query T kvtrace
INSERT INTO c VALUES
(1, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)'),
(2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
INSERT INTO c VALUES (1, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)')
----
Scan /Table/20/1/10{7-8}
CPut /Table/107/1/1/0 -> /TUPLE/
Put /Table/107/2/"B\xfd\x10\x01D\x15@\x80K\xd5\x01?\x91\xdfF\xa2R\x9d9?\x91\xdfF\xa2R\x9d9\x89\x88" -> /BYTES/
Put /Table/107/3/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x89\x88" -> /BYTES/

# s390x produces slightly different inverted index key for the linestring (among
# other shapes) because it has architecture support for trigonometric functions
# (used by s2 library), so we have different expectations for s390x vs other
# systems. s390x is the only big endian system we support right now, so we abuse
# the corresponding option a bit.
skipif bigendian

query T kvtrace
INSERT INTO c VALUES (2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
----
CPut /Table/107/1/2/0 -> /TUPLE/
Put /Table/107/2/"B\xfd\x10\x01P\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/2/"B\xfd\x10\x03\xff\xff\xfc\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/2/"B\xfd\x10\x05\x00\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/3/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01?\xf0\x00\x00\x00\x00\x00\x00?\xf0\x00\x00\x00\x00\x00\x00\x8a\x88" -> /BYTES/

skipif littleendian

query T kvtrace
INSERT INTO c VALUES (2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
----
CPut /Table/107/1/2/0 -> /TUPLE/
Put /Table/107/2/"B\xfd\x10\x01P\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/2/"B\xfd\x10\x03\xff\xff\xfc\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/2/"B\xfd\x10\x05\x00\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8a\x88" -> /BYTES/
Put /Table/107/3/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01?\xf0\x00\x00\x00\x00\x00\x00?\xf0\x00\x00\x00\x00\x00\x00\x8a\x88" -> /BYTES/

statement ok
CREATE INVERTED INDEX geog_idx ON b(geog)

statement ok
CREATE INVERTED INDEX geom_idx ON b(geom)

query T kvtrace
INSERT INTO b VALUES
(3, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)'),
(4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
INSERT INTO b VALUES (3, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)')
----
CPut /Table/106/1/3/0 -> /TUPLE/
Put /Table/106/2/"B\xfd\x10\x01D\x15@\x80K\xd5\x01?\x91\xdfF\xa2R\x9d9?\x91\xdfF\xa2R\x9d9\x8b\x88" -> /BYTES/
Put /Table/106/4/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01@\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x8b\x88" -> /BYTES/

skipif bigendian

query T kvtrace
INSERT INTO b VALUES (4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
----
CPut /Table/106/1/4/0 -> /TUPLE/
Put /Table/106/2/"B\xfd\x10\x01P\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/2/"B\xfd\x10\x03\xff\xff\xfc\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/2/"B\xfd\x10\x05\x00\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb9?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/4/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01?\xf0\x00\x00\x00\x00\x00\x00?\xf0\x00\x00\x00\x00\x00\x00\x8c\x88" -> /BYTES/

skipif littleendian

query T kvtrace
INSERT INTO b VALUES (4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
----
CPut /Table/106/1/4/0 -> /TUPLE/
Put /Table/106/2/"B\xfd\x10\x01P\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/2/"B\xfd\x10\x03\xff\xff\xfc\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/2/"B\xfd\x10\x05\x00\x00\x00\x00\x00\x00\x00?\x91\xdfF\xa2R\x9d8?\x91\xdfF\xa2R\x9c\xb8?\xa1\xdfF\xa2R\x9d9?\xa1\xdfF\xa2R\x9dx\x8c\x88" -> /BYTES/
Put /Table/106/4/"B\xfd\x10\x00\x00\x00\x00\x00\x00\x01\x01?\xf0\x00\x00\x00\x00\x00\x00?\xf0\x00\x00\x00\x00\x00\x00\x8c\x88" -> /BYTES/

statement ok
CREATE TABLE ltable(
k int primary key,
Expand Down