Skip to content

Commit 9308fd0

Browse files
committed
logictest: adjust a few of geo tests for s390x
Similar to other patches, we need to do some rounding for a couple of geo logic tests. This is the case since s390x has architecture support for trigonometric functions which are used when computing `ST_Segmentize` and `ST_Rotate` builtins. Note that the "rounding" is performed via regexp replacement on top of the textual result. Relatedly, we have a couple of tests that print inverted index keys, and for some shapes / geographies we use s2 library which also uses trigonometric functions. Thus, this commit adjusts those tests to account for the minor differences. This behavior suggests another limitation for heterogeneous clusters - we cannot guarantee to correctly read inverted geo indexes when the SQL pod and the KV / storage node run on different architectures. I don't think there is any concern for "pure" s390x clusters since they will behave consistently within the cluster. Release note: None
1 parent 1ac71a9 commit 9308fd0

File tree

3 files changed

+80
-9
lines changed

3 files changed

+80
-9
lines changed

pkg/sql/logictest/testdata/logic_test/distsql_stats

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,13 +1672,29 @@ let $hist_id_1
16721672
SELECT histogram_id FROM [SHOW STATISTICS FOR TABLE geo_table]
16731673
WHERE statistics_name = 's' AND column_names = '{geog}'
16741674

1675+
# s390x produces slightly different inverted index key for the linestring (among
1676+
# other shapes) because it has architecture support for trigonometric functions
1677+
# (used by s2 library), so we have different expectations for s390x vs other
1678+
# systems. s390x is the only big endian system we support right now, so we abuse
1679+
# the corresponding option a bit.
1680+
skipif bigendian
1681+
16751682
query TIRI colnames,nosort
16761683
SHOW HISTOGRAM $hist_id_1
16771684
----
16781685
upper_bound range_rows distinct_range_rows equal_rows
16791686
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
16801687
'\x42fd5000000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
16811688

1689+
skipif littleendian
1690+
1691+
query TIRI colnames,nosort
1692+
SHOW HISTOGRAM $hist_id_1
1693+
----
1694+
upper_bound range_rows distinct_range_rows equal_rows
1695+
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1696+
'\x42fd5000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1697+
16821698
statement ok
16831699
DROP INDEX geo_table@geog_idx_1;
16841700

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

1709+
skipif bigendian
1710+
16931711
query TIRI colnames,nosort
16941712
SHOW HISTOGRAM $hist_id_1
16951713
----
@@ -1699,6 +1717,17 @@ upper_bound
16991717
'\x42fd4700000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
17001718
'\x42fd5ad4000000000000000000000000000000bcc00000000000003ffbecde5da115a83ff661bdc396bcdc' 0 0 1
17011719

1720+
skipif littleendian
1721+
1722+
query TIRI colnames,nosort
1723+
SHOW HISTOGRAM $hist_id_1
1724+
----
1725+
upper_bound range_rows distinct_range_rows equal_rows
1726+
'\x42fd1000000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1727+
'\x42fd4500000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1728+
'\x42fd4700000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1729+
'\x42fd5ad4000000000000000000000000000000bcc00000000000003ffbecde5da115a93ff661bdc396bcdc' 0 0 1
1730+
17021731
# Stats for multi-column inverted indexes.
17031732
statement ok
17041733
CREATE TABLE multi_col (

pkg/sql/logictest/testdata/logic_test/geospatial

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4702,11 +4702,15 @@ Square overlapping left and right square Square (right)
47024702
Square overlapping left and right square Square overlapping left and right square true true true
47034703

47044704
# ST_Segmentize
4705+
#
4706+
# ST_Segmentize uses some trigonometric functions implicitly (via s2 library),
4707+
# which have architecture suppport on some systems like s390x, which can produce
4708+
# slightly different results, so we perform "rounding" via regexp replacement.
47054709
query TTT
47064710
SELECT
47074711
dsc,
47084712
ST_AsText(ST_Segmentize(geog, 100000)),
4709-
ST_AsText(ST_Segmentize(geog, 50000))
4713+
regexp_replace(ST_AsText(ST_Segmentize(geog, 50000)), '1.000028552944326', '1.000028552944327', 'g')
47104714
FROM geog_operators_test
47114715
ORDER BY dsc
47124716
----
@@ -4719,7 +4723,7 @@ NULL NULL
47194723
Nested Geometry Collection GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0))) GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (0 0)))
47204724
Point middle of Left Square POINT (-0.5 0.5) POINT (-0.5 0.5)
47214725
Point middle of Right Square POINT (0.5 0.5) POINT (0.5 0.5)
4722-
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))
4726+
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))
47234727
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))
47244728
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))
47254729

@@ -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
54695473
POLYGON ((-1 0, 0 0, 0 1, -1 1, -1 0)) POLYGON ((0 -1, 0 0, 1 0, 1 -1, 0 -1))
54705474
POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))
54715475

5476+
# ST_Rotate uses some trigonometric functions internally, which have
5477+
# architecture suppport on some systems like s390x, which can produce slightly
5478+
# different results, so we perform "rounding" via regexp replacement.
54725479
query TTT
54735480
SELECT
54745481
ST_AsText(a.geom) d,
54755482
ST_AsText(ST_Rotate(a.geom, pi())),
5476-
ST_AsText(ST_Rotate(a.geom, pi()/4))
5483+
regexp_replace(ST_AsText(ST_Rotate(a.geom, pi()/4)), 'POINT \(0.000000000000001 7.071067811865476\)', 'POINT (0 7.071067811865476)', 'g')
54775484
FROM geom_operators_test a
54785485
ORDER BY d ASC
54795486
----

pkg/sql/opt/exec/execbuilder/testdata/geospatial

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,40 +31,75 @@ CPut /Table/106/1/1/0 -> /TUPLE/
3131
CPut /Table/106/1/2/0 -> /TUPLE/
3232

3333
query T kvtrace
34-
INSERT INTO c VALUES
35-
(1, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)'),
36-
(2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
34+
INSERT INTO c VALUES (1, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)')
3735
----
3836
Scan /Table/20/1/10{7-8}
3937
CPut /Table/107/1/1/0 -> /TUPLE/
4038
Put /Table/107/2/"B\xfd\x10\x01D\x15@\x80K\xd5\x01?\x91\xdfF\xa2R\x9d9?\x91\xdfF\xa2R\x9d9\x89\x88" -> /BYTES/
4139
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/
40+
41+
# s390x produces slightly different inverted index key for the linestring (among
42+
# other shapes) because it has architecture support for trigonometric functions
43+
# (used by s2 library), so we have different expectations for s390x vs other
44+
# systems. s390x is the only big endian system we support right now, so we abuse
45+
# the corresponding option a bit.
46+
skipif bigendian
47+
48+
query T kvtrace
49+
INSERT INTO c VALUES (2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
50+
----
4251
CPut /Table/107/1/2/0 -> /TUPLE/
4352
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/
4453
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/
4554
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/
4655
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/
4756

57+
skipif littleendian
58+
59+
query T kvtrace
60+
INSERT INTO c VALUES (2, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
61+
----
62+
CPut /Table/107/1/2/0 -> /TUPLE/
63+
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/
64+
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/
65+
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/
66+
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/
67+
4868
statement ok
4969
CREATE INVERTED INDEX geog_idx ON b(geog)
5070

5171
statement ok
5272
CREATE INVERTED INDEX geom_idx ON b(geom)
5373

5474
query T kvtrace
55-
INSERT INTO b VALUES
56-
(3, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)'),
57-
(4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
75+
INSERT INTO b VALUES (3, 'POINT(1.0 1.0)', 'POINT(2.0 2.0)')
5876
----
5977
CPut /Table/106/1/3/0 -> /TUPLE/
6078
Put /Table/106/2/"B\xfd\x10\x01D\x15@\x80K\xd5\x01?\x91\xdfF\xa2R\x9d9?\x91\xdfF\xa2R\x9d9\x8b\x88" -> /BYTES/
6179
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/
80+
81+
skipif bigendian
82+
83+
query T kvtrace
84+
INSERT INTO b VALUES (4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
85+
----
6286
CPut /Table/106/1/4/0 -> /TUPLE/
6387
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/
6488
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/
6589
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/
6690
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/
6791

92+
skipif littleendian
93+
94+
query T kvtrace
95+
INSERT INTO b VALUES (4, 'LINESTRING(1.0 1.0, 2.0 2.0)', 'POINT(1.0 1.0)')
96+
----
97+
CPut /Table/106/1/4/0 -> /TUPLE/
98+
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/
99+
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/
100+
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/
101+
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/
102+
68103
statement ok
69104
CREATE TABLE ltable(
70105
k int primary key,

0 commit comments

Comments
 (0)