mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 14:02:21 +00:00
15 lines
705 B
SQL
15 lines
705 B
SQL
SET allow_experimental_analyzer = 1;
|
|
|
|
SELECT
|
|
arraySum(x -> ((x.1) / ((x.2) * (x.2))), arrayZip(mag, magerr)) / arraySum(x -> (1. / (x * x)), magerr) AS weightedmeanmag,
|
|
arraySum(x -> ((((x.1) - weightedmeanmag) * ((x.1) - weightedmeanmag)) / ((x.2) * (x.2))), arrayZip(mag, magerr)) AS chi2,
|
|
[1, 2, 3, 4] AS mag,
|
|
[0.1, 0.2, 0.1, 0.2] AS magerr;
|
|
|
|
SELECT
|
|
arraySum(x -> ((x.1) / ((x.2) * (x.2))), arrayZip(mag, magerr)) / arraySum(x -> (1. / (x * x)), magerr) AS weightedmeanmag,
|
|
arraySum(x -> ((((x.1) - weightedmeanmag) * ((x.1) - weightedmeanmag)) / ((x.2) * (x.2))), arrayZip(mag, magerr)) AS chi2,
|
|
[1, 2, 3, 4] AS mag,
|
|
[0.1, 0.2, 0.1, 0.2] AS magerr
|
|
WHERE isFinite(chi2)
|