Skip to content

Equivalent view extraction rounds VAR_SAMP results #291

Description

@123lpygithub

Under semantic-equivalent rewriting, the source and mutated queries are logically equivalent, but produce different results on PolarDB-X.

Version: 5.4.19-SNAPSHOT

How to repeat:

DROP DATABASE IF EXISTS vect_submit_c2;
CREATE DATABASE vect_submit_c2;
USE vect_submit_c2;

CREATE TABLE t3 (
  c3 INT
);

INSERT INTO t3 VALUES
  (0),
  (0),
  (1);

-- Source Original SQL
SELECT VAR_SAMP(c3) AS var_samp_c3
FROM t3;

-- View SQL
CREATE VIEW v_t3 AS
SELECT VAR_SAMP(c3) AS var_samp_c3
FROM t3;

-- Mutated SQL
SELECT var_samp_c3
FROM v_t3;

Observed result - Query A (original):

var_samp_c3
0.33333333333333337

Observed result - Query B (mutated):

var_samp_c3
0.3334

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions