diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_stats b/pkg/sql/logictest/testdata/logic_test/distsql_stats index e1b0fc1cc001..295cfd4a4bad 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_stats +++ b/pkg/sql/logictest/testdata/logic_test/distsql_stats @@ -1672,6 +1672,13 @@ 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 ---- @@ -1679,6 +1686,15 @@ upper_bound '\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; @@ -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 ---- @@ -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 ( diff --git a/pkg/sql/logictest/testdata/logic_test/geospatial b/pkg/sql/logictest/testdata/logic_test/geospatial index 32d1c460c6de..1b8ffc69ef1d 100644 --- a/pkg/sql/logictest/testdata/logic_test/geospatial +++ b/pkg/sql/logictest/testdata/logic_test/geospatial @@ -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 ---- @@ -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)) @@ -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 ---- diff --git a/pkg/sql/opt/exec/execbuilder/testdata/geospatial b/pkg/sql/opt/exec/execbuilder/testdata/geospatial index 51e37aee4727..89f88eacae49 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/geospatial +++ b/pkg/sql/opt/exec/execbuilder/testdata/geospatial @@ -31,20 +31,40 @@ 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) @@ -52,19 +72,34 @@ 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,