Merge pull request #234987 from mmusnjak/apache-datasketches

apache_datasketches: init at 1.6.0
This commit is contained in:
Pol Dellaiera 2023-06-02 21:55:22 +02:00 committed by GitHub
commit 161182c362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 109 additions and 0 deletions

View File

@ -10686,6 +10686,12 @@
githubId = 708570;
name = "Manuel Mendez";
};
mmusnjak = {
email = "marko.musnjak@gmail.com";
github = "mmusnjak";
githubId = 668956;
name = "Marko Mušnjak";
};
mnacamura = {
email = "m.nacamura@gmail.com";
github = "mnacamura";

View File

@ -614,6 +614,7 @@ in {
postfix-raise-smtpd-tls-security-level = handleTest ./postfix-raise-smtpd-tls-security-level.nix {};
postfixadmin = handleTest ./postfixadmin.nix {};
postgis = handleTest ./postgis.nix {};
apache_datasketches = handleTest ./apache_datasketches.nix {};
postgresql = handleTest ./postgresql.nix {};
postgresql-jit = handleTest ./postgresql-jit.nix {};
postgresql-wal-receiver = handleTest ./postgresql-wal-receiver.nix {};

View File

@ -0,0 +1,29 @@
import ./make-test-python.nix ({ pkgs, ...} : {
name = "postgis";
meta = with pkgs.lib.maintainers; {
maintainers = [ lsix ]; # TODO: Who's the maintener now?
};
nodes = {
master =
{ pkgs, ... }:
{
services.postgresql = let mypg = pkgs.postgresql_15; in {
enable = true;
package = mypg;
extraPlugins = with mypg.pkgs; [
apache_datasketches
];
};
};
};
testScript = ''
start_all()
master.wait_for_unit("postgresql")
master.sleep(10) # Hopefully this is long enough!!
master.succeed("sudo -u postgres psql -c 'CREATE EXTENSION datasketches;'")
master.succeed("sudo -u postgres psql -c 'SELECT hll_sketch_to_string(hll_sketch_build(1));'")
'';
})

View File

@ -0,0 +1,71 @@
{ stdenv, lib, fetchFromGitHub, postgresql, boost182, nixosTests }:
stdenv.mkDerivation (finalAttrs: {
pname = "apache_datasketches";
version = "1.6.0";
srcs = [
( fetchFromGitHub {
name = "datasketches-postgresql";
owner = "apache";
repo = "datasketches-postgresql";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-sz94fIe7nyWhjiw8FAm6ZzVpB0sAK5YxUrtbaZt/guA=";
})
( fetchFromGitHub {
name = "datasketches-cpp";
owner = "apache";
repo = "datasketches-cpp";
rev = "refs/tags/4.1.0";
hash = "sha256-vPoFzRxOXlEAiiHH9M5S6255ahzaKsGNYS0cdHwrRYw=";
})
];
sourceRoot = "datasketches-postgresql";
buildInputs = [ postgresql boost182 ];
patchPhase = ''
runHook prePatch
cp -r ../datasketches-cpp .
runHook postPatch
'';
installPhase = ''
runHook preInstall
install -D -m 644 ./datasketches.so -t $out/lib/
cat \
sql/datasketches_cpc_sketch.sql \
sql/datasketches_kll_float_sketch.sql \
sql/datasketches_kll_double_sketch.sql \
sql/datasketches_theta_sketch.sql \
sql/datasketches_frequent_strings_sketch.sql \
sql/datasketches_hll_sketch.sql \
sql/datasketches_aod_sketch.sql \
sql/datasketches_req_float_sketch.sql \
sql/datasketches_quantiles_double_sketch.sql \
> sql/datasketches--${finalAttrs.version}.sql
install -D -m 644 ./datasketches.control -t $out/share/postgresql/extension
install -D -m 644 \
./sql/datasketches--${finalAttrs.version}.sql \
./sql/datasketches--1.3.0--1.4.0.sql \
./sql/datasketches--1.4.0--1.5.0.sql \
./sql/datasketches--1.5.0--1.6.0.sql \
-t $out/share/postgresql/extension
runHook postInstall
'';
passthru.tests.apache_datasketches = nixosTests.apache_datasketches;
meta = {
description = "PostgreSQL extension providing approximate algorithms for distinct item counts, quantile estimation and frequent items detection";
longDescription = ''
apache_datasketches is an extension to support approximate algorithms on PostgreSQL. The implementation
is based on the Apache Datasketches CPP library, and provides support for HyperLogLog,
Compressed Probabilistic Counting, KLL, Frequent strings, and Theta sketches.
'';
homepage = "https://datasketches.apache.org/";
platforms = postgresql.meta.platforms;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ mmusnjak ];
};
})

View File

@ -2,6 +2,8 @@ self: super: {
age = super.callPackage ./ext/age.nix { };
apache_datasketches = super.callPackage ./ext/apache_datasketches.nix { };
jsonb_deep_sum = super.callPackage ./ext/jsonb_deep_sum.nix { };
periods = super.callPackage ./ext/periods.nix { };