Skip to content
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

roachtest: sqlsmith/setup=seed/setting=no-mutations failed #50596

Closed
cockroach-teamcity opened this issue Jun 24, 2020 · 11 comments · Fixed by #50670
Closed

roachtest: sqlsmith/setup=seed/setting=no-mutations failed #50596

cockroach-teamcity opened this issue Jun 24, 2020 · 11 comments · Fixed by #50670
Assignees
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.
Milestone

Comments

@cockroach-teamcity
Copy link
Member

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@e85ac5f2d70542523a61f430f1fc354023b6c7e4:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:753: error: pq: internal error: unsupported comparison: bytes to jsonb
		stmt:
		SELECT
			(-1.9208989143371582):::FLOAT8 AS col_15025, tab_6146._jsonb AS col_15026
		FROM
			defaultdb.public.seed@seed__int8__float8__date_idx AS tab_6146
		WHERE
			(('1':::JSONB IS NOT DISTINCT FROM tab_6146._jsonb) AND true)
		LIMIT
			78:::INT8;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity cockroach-teamcity added branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked. labels Jun 24, 2020
@cockroach-teamcity cockroach-teamcity added this to the 20.2 milestone Jun 24, 2020
@rohany
Copy link
Contributor

rohany commented Jun 24, 2020

cc @RaduBerinde is this some fallout from the cast volatility change?

@RaduBerinde
Copy link
Member

It's possible, I'll take a look.

@RaduBerinde
Copy link
Member

I can't really reproduce (even at the same sha). Used the schema from the artifacts:

SET experimental_enable_enums = true;
CREATE TYPE greeting AS ENUM ('hello', 'howdy', 'hi', 'good day', 'morning');
CREATE TABLE IF NOT EXISTS seed AS
	SELECT
		g::INT2 AS _int2,
		g::INT4 AS _int4,
		g::INT8 AS _int8,
		g::FLOAT4 AS _float4,
		g::FLOAT8 AS _float8,
		'2001-01-01'::DATE + g AS _date,
		'2001-01-01'::TIMESTAMP + g * '1 day'::INTERVAL AS _timestamp,
		'2001-01-01'::TIMESTAMPTZ + g * '1 day'::INTERVAL AS _timestamptz,
		g * '1 day'::INTERVAL AS _interval,
		g % 2 = 1 AS _bool,
		g::DECIMAL AS _decimal,
		g::STRING AS _string,
		g::STRING::BYTES AS _bytes,
		substring('00000000-0000-0000-0000-' || g::STRING || '00000000000', 1, 36)::UUID AS _uuid,
		'0.0.0.0'::INET + g AS _inet,
		g::STRING::JSONB AS _jsonb,
		enum_range('hello'::greeting)[g] as _enum
	FROM
		generate_series(1, 5) AS g;

INSERT INTO seed DEFAULT VALUES;
CREATE INDEX on seed (_int8, _float8, _date);
CREATE INVERTED INDEX on seed (_jsonb);

@RaduBerinde
Copy link
Member

Ah, I can repro if I add a CREATE STATISTICS call for the table.

@RaduBerinde
Copy link
Member

This is the stack trace - it's coming from the statistics code:

                testdata/logic_test/foo:44: EXPLAIN (OPT, TYPES) SELECT
                	(-1.9208989143371582):::FLOAT8 AS col_15025, tab_6146._jsonb AS col_15026
                FROM
                	seed@seed__int8__float8__date_idx AS tab_6146
                WHERE
                	(('1':::JSONB IS NOT DISTINCT FROM tab_6146._jsonb) AND true)
                LIMIT
                	78:::INT8;
                expected success, but found
                (XX000) internal error: unsupported comparison: bytes to jsonb
                datum.go:1367: in Compare()
                DETAIL: stack trace:
                github.com/cockroachdb/cockroach/pkg/sql/sem/tree/datum.go:1367: Compare()
                github.com/cockroachdb/cockroach/pkg/sql/opt/constraint/key.go:295: Compare()
                github.com/cockroachdb/cockroach/pkg/sql/opt/constraint/key.go:112: Compare()
                github.com/cockroachdb/cockroach/pkg/sql/opt/constraint/span.go:192: StartsAfter()
                github.com/cockroachdb/cockroach/pkg/sql/opt/props/histogram.go:221: Filter()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/statistics_builder.go:2877: applyConstraintSet()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/statistics_builder.go:2734: func1()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/statistics_builder.go:2747: applyFilter()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/statistics_builder.go:740: buildSelect()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/logical_props_builder.go:221: buildSelectProps()
                github.com/cockroachdb/cockroach/pkg/sql/opt/memo/expr.og.go:16484: MemoizeSelect()
                github.com/cockroachdb/cockroach/pkg/sql/opt/norm/factory.og.go:1020: ConstructSelect()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1164: buildWhere()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:1037: buildSelectClause()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:982: buildSelectStmtWithoutParens()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:955: func1()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/with.go:29: processWiths()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/select.go:954: buildSelect()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:248: buildStmt()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:212: buildStmtAtRoot()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/explain.go:28: buildExplain()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:275: buildStmt()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:212: buildStmtAtRoot()
                github.com/cockroachdb/cockroach/pkg/sql/opt/optbuilder/builder.go:183: Build()
                github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:475: buildExecMemo()
                github.com/cockroachdb/cockroach/pkg/sql/plan_opt.go:172: makeOptimizerPlan()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:826: makeExecPlan()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:715: dispatchToExecutionEngine()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:488: execStmtInOpenState()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:99: execStmt()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1356: execCmd()
                github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1285: run()

I pasted my logictest here: https://gist.github.com/RaduBerinde/b00facac056878c6b9c556a458761fe3

I'm guessing this has to do with the recent change to allow stats on jsonb columns; @mjibson could you take a look?

@cockroach-teamcity
Copy link
Member Author

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@4acd262796288cc84cb2b104bd77c1fc8cac73db:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:753: error: pq: internal error: unsupported comparison: bytes to jsonb
		stmt:
		SELECT
			count(*) AS col_16303
		FROM
			defaultdb.public.seed@[0] AS tab_6636
		WHERE
			(e'[{"$=?^wDW?pd": [{"foo": []}], "T] i\'": 0.09139586892357388, "~xx>\'3t<3P": {}}, {"==I\\"zh,": {}, "Ay,o^": null, "b": [[true], true]}, []]':::JSONB IS NOT DISTINCT FROM tab_6636._jsonb)
		GROUP BY
			tab_6636._int8, tab_6636._float8
		LIMIT
			60:::INT8;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

@maddyblue
Copy link
Contributor

maddyblue commented Jun 25, 2020

reduced repro:

CREATE TABLE seed (_jsonb JSONB, INVERTED INDEX (_jsonb));
INSERT INTO seed VALUES ('{}');
CREATE STATISTICS foo FROM seed;

SELECT
	NULL
FROM
	seed
WHERE
	'1' != _jsonb
;

@cockroach-teamcity
Copy link
Member Author

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@d3791a81c0716478de08d44459d3fcf5b4f3ea1e:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:753: error: pq: internal error: column 18 not in input
		stmt:
		WITH
			with_30 (col_157)
				AS (
					SELECT
						*
					FROM
						(
							VALUES
								(((-9223372036854775807):::INT8::INT8 // 221.1264789855284273:::DECIMAL::DECIMAL)::DECIMAL),
								((-40995347891619.63925):::DECIMAL),
								(80016567882537.21702:::DECIMAL),
								((-47094.21070927867655):::DECIMAL)
						)
							AS tab_72 (col_157)
				)
		SELECT
			tab_73._enum AS col_158,
			tab_73._inet AS col_159,
			'\xf3':::BYTES AS col_160,
			NULL AS col_161,
			'00:00:00':::INTERVAL AS col_162,
			tab_73._date AS col_163,
			tab_73._uuid AS col_164,
			tab_73._timestamptz AS col_165,
			(-309479799747869998):::INT8 AS col_166,
			tab_73._jsonb AS col_167
		FROM
			defaultdb.public.seed@seed__int8__float8__date_idx AS tab_73
		ORDER BY
			tab_73._enum DESC, tab_73._date DESC, tab_73._uuid DESC
		LIMIT
			75:::INT8;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity
Copy link
Member Author

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@8f768ad14cfb3f514db6d40465b2dd60ee1f2890:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:757: error: pq: internal error: runtime error: index out of range [0] with length 0
		stmt:
		WITH
			with_585 (col_3268)
				AS (
					SELECT
						*
					FROM
						(
							VALUES
								('0101000020E6100000000000000000F03F000000000000F03F':::GEOGRAPHY),
								('0101000020E6100000000000000000F03F000000000000F03F':::GEOGRAPHY),
								(NULL),
								('0101000020E6100000000000000000F03F000000000000F03F':::GEOGRAPHY),
								('0101000020E6100000000000000000F03F000000000000F03F':::GEOGRAPHY),
								(
									st_project('0101000020E6100000000000000000F87F000000000000F87F':::GEOGRAPHY::GEOGRAPHY, 1.0:::FLOAT8::FLOAT8, 0.260111032661812:::FLOAT8::FLOAT8)::GEOGRAPHY
								)
						)
							AS tab_1398 (col_3268)
				)
		SELECT
			'0101000020E6100000000000000000F03F000000000000F03F':::GEOGRAPHY AS col_3269
		FROM
			with_585 AS cte_ref_180
		WHERE
			false
		ORDER BY
			cte_ref_180.col_3268 DESC, cte_ref_180.col_3268, cte_ref_180.col_3268 ASC;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity
Copy link
Member Author

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@c627e3490d30e8ba88f6c7136717a392a054da4e:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:757: error: pq: internal error: unsupported comparison: bytes to jsonb
		stmt:
		SELECT
			tab_12868._timestamp AS col_31329
		FROM
			defaultdb.public.seed@seed__int8__float8__date_idx AS tab_12867
			INNER JOIN defaultdb.public.seed@[0] AS tab_12868 ON true
		WHERE
			('null':::JSONB IS NOT DISTINCT FROM tab_12867._jsonb)
		ORDER BY
			tab_12867._bytes DESC, tab_12868._uuid ASC;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

@cockroach-teamcity
Copy link
Member Author

(roachtest).sqlsmith/setup=seed/setting=no-mutations failed on master@17c8048e80935f8a01477416980d18bf39cba1bb:

The test failed on branch=master, cloud=gce:
test artifacts and logs in: /home/agent/work/.go/src/github.com/cockroachdb/cockroach/artifacts/sqlsmith/setup=seed/setting=no-mutations/run_1
	sqlsmith.go:169,sqlsmith.go:199,test_runner.go:757: error: pq: internal error: unsupported comparison: bytes to jsonb
		stmt:
		WITH
			with_6793 (col_39735) AS (SELECT * FROM (VALUES (166478304:::OID), (NULL)) AS tab_16273 (col_39735))
		SELECT
			tab_16274._enum AS col_39736, tab_16274._float4 AS col_39737
		FROM
			defaultdb.public.seed@seed__int8__float8__date_idx AS tab_16274
		WHERE
			(tab_16274._jsonb = e'{"=%(MH": 0.11662292965374893, "R+O": [{"baz": [], "foo": {"a": []}}, false], "baz": {}, "}0!!%SHF\'E&J": {}}':::JSONB)
		GROUP BY
			tab_16274._enum, tab_16274._float4
		HAVING
			min(tab_16274._bool::BOOL)::BOOL
		ORDER BY
			tab_16274._float4 ASC
		LIMIT
			81:::INT8;

More

Artifacts: /sqlsmith/setup=seed/setting=no-mutations
Related:

See this test on roachdash
powered by pkg/cmd/internal/issues

craig bot pushed a commit that referenced this issue Jun 29, 2020
50670: opt: don't use inverted histograms in applyFilter r=mjibson a=mjibson

Fixes #50596

Release note: None

Co-authored-by: Matt Jibson <matt.jibson@gmail.com>
@craig craig bot closed this as completed in ec7e16c Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch-master Failures and bugs on the master branch. C-test-failure Broken test (automatically or manually discovered). O-roachtest O-robot Originated from a bot. release-blocker Indicates a release-blocker. Use with branch-release-2x.x label to denote which branch is blocked.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants