This is an automated email from the ASF dual-hosted git repository. alsay pushed a commit to branch tuple_sketch_int64 in repository https://gitbox.apache.org/repos/asf/datasketches-bigquery.git
commit 10c340d459b73fe3ffecf586284ef19459a1b36d Author: AlexanderSaydakov <[email protected]> AuthorDate: Thu Sep 12 15:26:25 2024 -0700 short version of intersection with defaults --- tuple/sqlx/tuple_sketch_int64_intersection.sqlx | 26 +++++++++++++++++++++++++ tuple/test/tuple_sketch_int_test.sql | 19 +++++++++++++----- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/tuple/sqlx/tuple_sketch_int64_intersection.sqlx b/tuple/sqlx/tuple_sketch_int64_intersection.sqlx new file mode 100644 index 0000000..fdebc8a --- /dev/null +++ b/tuple/sqlx/tuple_sketch_int64_intersection.sqlx @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +config { hasOutput: true } + +CREATE OR REPLACE FUNCTION ${self()}(sketchA BYTES, sketchB BYTES) +RETURNS BYTES +AS ( + $BQ_DATASET.tuple_sketch_int64_intersection_seed_mode(sketchA, sketchB, NULL, NULL) +); diff --git a/tuple/test/tuple_sketch_int_test.sql b/tuple/test/tuple_sketch_int_test.sql index 17a61d8..293de0d 100644 --- a/tuple/test/tuple_sketch_int_test.sql +++ b/tuple/test/tuple_sketch_int_test.sql @@ -58,15 +58,24 @@ select $BQ_DATASET.tuple_sketch_int64_get_estimate_seed( null ); +# expected 1 +select $BQ_DATASET.tuple_sketch_int64_get_estimate( + $BQ_DATASET.tuple_sketch_int64_intersection( + (select $BQ_DATASET.tuple_sketch_int64_agg_string(str, 1) from unnest(["a", "b", "c"]) as str), + (select $BQ_DATASET.tuple_sketch_int64_agg_string(str, 1) from unnest(["c", "d", "e"]) as str) + ) +); + +# full signatures # expected 1 select $BQ_DATASET.tuple_sketch_int64_get_estimate_seed( $BQ_DATASET.tuple_sketch_int64_intersection_seed_mode( - (select $BQ_DATASET.tuple_sketch_int64_agg_string(str, 1) from unnest(["a", "b", "c"]) as str), - (select $BQ_DATASET.tuple_sketch_int64_agg_string(str, 1) from unnest(["c", "d", "e"]) as str), - null, - null + (select $BQ_DATASET.tuple_sketch_int64_agg_string_lgk_seed_p_mode(str, 1, STRUCT<BYTEINT, INT64, FLOAT64, STRING>(10, 111, 0.999, "MIN")) from unnest(["a", "b", "c"]) as str), + (select $BQ_DATASET.tuple_sketch_int64_agg_string_lgk_seed_p_mode(str, 1, STRUCT<BYTEINT, INT64, FLOAT64, STRING>(10, 111, 0.999, "MIN")) from unnest(["c", "d", "e"]) as str), + 111, + "MIN" ), - null + 111 ); # expected 2 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
