You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2024/08/20 21:53:46 UTC
(datasketches-bigquery) 01/01: Reorganize into sketch sub dirs
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch reorganize_into_sketch_subdirs
in repository https://gitbox.apache.org/repos/asf/datasketches-bigquery.git
commit bd5da9c365fb815b877cef8cb692da2df8256b57
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Tue Aug 20 14:53:34 2024 -0700
Reorganize into sketch sub dirs
---
Makefile | 30 ---------------
Makefile => cpc/Makefile | 6 +--
cpc/README.md | 44 ++++++++++++++++++++++
cpc_sketch.cpp => cpc/cpc_sketch.cpp | 0
.../sqlx/cpc_sketch_agg_string.sqlx | 0
.../sqlx/cpc_sketch_agg_union.sqlx | 0
.../sqlx/cpc_sketch_get_estimate.sqlx | 0
.../sqlx/cpc_sketch_get_estimate_and_bounds.sqlx | 0
.../sqlx/cpc_sketch_scalar_union.sqlx | 0
.../sqlx/cpc_sketch_to_string.sqlx | 0
Makefile => kll/Makefile | 6 +--
kll/README.md | 44 ++++++++++++++++++++++
kll_sketch.cpp => kll/kll_sketch.cpp | 0
.../sqlx/kll_sketch_float_build.sqlx | 0
.../sqlx/kll_sketch_float_get_cdf.sqlx | 0
.../sqlx/kll_sketch_float_get_n.sqlx | 0
.../sqlx/kll_sketch_float_get_pmf.sqlx | 0
.../sqlx/kll_sketch_float_get_quantile.sqlx | 0
.../sqlx/kll_sketch_float_get_rank.sqlx | 0
.../sqlx/kll_sketch_float_merge.sqlx | 0
.../sqlx/kll_sketch_float_to_string.sqlx | 0
.../kll_sketch_float_kolmogorov_smirnov_test.sqlx | 0
Makefile => theta/Makefile | 4 --
theta/README.md | 44 ++++++++++++++++++++++
.../sqlx/theta_sketch_a_not_b.sqlx | 0
.../sqlx/theta_sketch_agg_string.sqlx | 0
.../sqlx/theta_sketch_agg_union.sqlx | 0
.../sqlx/theta_sketch_get_estimate.sqlx | 0
.../sqlx/theta_sketch_get_estimate_and_bounds.sqlx | 0
.../sqlx/theta_sketch_jaccard_similarity.sqlx | 0
.../sqlx/theta_sketch_scalar_intersection.sqlx | 0
.../sqlx/theta_sketch_scalar_union.sqlx | 0
.../sqlx/theta_sketch_to_string.sqlx | 0
theta_sketch.cpp => theta/theta_sketch.cpp | 0
34 files changed, 134 insertions(+), 44 deletions(-)
diff --git a/Makefile b/Makefile
index 991417c..a595c84 100644
--- a/Makefile
+++ b/Makefile
@@ -15,34 +15,4 @@
# specific language governing permissions and limitations
# under the License.
-EMCC=emcc
-EMCFLAGS=-Idatasketches-cpp/common/include \
- -Idatasketches-cpp/theta/include \
- -Idatasketches-cpp/cpc/include \
- -Idatasketches-cpp/kll/include \
- --no-entry \
- -sWASM_BIGINT=1 \
- -sEXPORTED_FUNCTIONS=[_malloc,_free] \
- -sENVIRONMENT=shell \
- -sTOTAL_MEMORY=1024MB \
- -O3 \
- --bind
-all: theta_sketch.mjs theta_sketch.js theta_sketch.wasm \
- cpc_sketch.mjs cpc_sketch.js cpc_sketch.wasm \
- kll_sketch.mjs kll_sketch.js kll_sketch.wasm
-
-%.mjs: %.cpp
- $(EMCC) $< $(EMCFLAGS) -sSINGLE_FILE=1 -o $@
-
-# this rule creates a non-es6 loadable library
-%.js: %.cpp
- $(EMCC) $< $(EMCFLAGS) -sSINGLE_FILE=1 -o $@
-
-%.wasm: %.cpp
- $(EMCC) $< $(EMCFLAGS) -sSTANDALONE_WASM=1 -o $@
-
-clean:
- $(RM) *.mjs *.js *.wasm
-
-.PHONY: clean
diff --git a/Makefile b/cpc/Makefile
similarity index 84%
copy from Makefile
copy to cpc/Makefile
index 991417c..6949fc8 100644
--- a/Makefile
+++ b/cpc/Makefile
@@ -17,9 +17,7 @@
EMCC=emcc
EMCFLAGS=-Idatasketches-cpp/common/include \
- -Idatasketches-cpp/theta/include \
-Idatasketches-cpp/cpc/include \
- -Idatasketches-cpp/kll/include \
--no-entry \
-sWASM_BIGINT=1 \
-sEXPORTED_FUNCTIONS=[_malloc,_free] \
@@ -28,9 +26,7 @@ EMCFLAGS=-Idatasketches-cpp/common/include \
-O3 \
--bind
-all: theta_sketch.mjs theta_sketch.js theta_sketch.wasm \
- cpc_sketch.mjs cpc_sketch.js cpc_sketch.wasm \
- kll_sketch.mjs kll_sketch.js kll_sketch.wasm
+all: cpc_sketch.mjs cpc_sketch.js cpc_sketch.wasm
%.mjs: %.cpp
$(EMCC) $< $(EMCFLAGS) -sSINGLE_FILE=1 -o $@
diff --git a/cpc/README.md b/cpc/README.md
new file mode 100644
index 0000000..866a930
--- /dev/null
+++ b/cpc/README.md
@@ -0,0 +1,44 @@
+<!--
+ 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.
+-->
+
+# Apache DataSketches functions for Google Cloud BigQuery
+
+[User-Defined Aggregate Functions (UDAFs)](https://cloud.google.com/bigquery/docs/user-defined-aggregates) and
+[non-aggregate (scalar) functions (UDFs)](https://cloud.google.com/bigquery/docs/user-defined-functions) for BigQuery SQL engine.
+
+Please visit the main [Apache DataSketches website](https://datasketches.apache.org) for more information about DataSketches library.
+
+If you are interested in making contributions to this project please see our [Community](https://datasketches.apache.org/docs/Community/) page for how to contact us.
+
+## Building
+
+- Requires [Emscripten (emcc compiler)](https://emscripten.org/)
+- Requires a link to [datasketches-cpp](https://github.com/apache/datasketches-cpp) in this directory
+
+## Example
+
+ select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_get_estimate(
+ `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_scalar_union(
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["1", "2", "3"]) as value),
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["3", "4", "5"]) as value),
+ null, null
+ ), null
+ );
+
+ result: 5
diff --git a/cpc_sketch.cpp b/cpc/cpc_sketch.cpp
similarity index 100%
rename from cpc_sketch.cpp
rename to cpc/cpc_sketch.cpp
diff --git a/cpc_sketch_agg_string.sqlx b/cpc/sqlx/cpc_sketch_agg_string.sqlx
similarity index 100%
rename from cpc_sketch_agg_string.sqlx
rename to cpc/sqlx/cpc_sketch_agg_string.sqlx
diff --git a/cpc_sketch_agg_union.sqlx b/cpc/sqlx/cpc_sketch_agg_union.sqlx
similarity index 100%
rename from cpc_sketch_agg_union.sqlx
rename to cpc/sqlx/cpc_sketch_agg_union.sqlx
diff --git a/cpc_sketch_get_estimate.sqlx b/cpc/sqlx/cpc_sketch_get_estimate.sqlx
similarity index 100%
rename from cpc_sketch_get_estimate.sqlx
rename to cpc/sqlx/cpc_sketch_get_estimate.sqlx
diff --git a/cpc_sketch_get_estimate_and_bounds.sqlx b/cpc/sqlx/cpc_sketch_get_estimate_and_bounds.sqlx
similarity index 100%
rename from cpc_sketch_get_estimate_and_bounds.sqlx
rename to cpc/sqlx/cpc_sketch_get_estimate_and_bounds.sqlx
diff --git a/cpc_sketch_scalar_union.sqlx b/cpc/sqlx/cpc_sketch_scalar_union.sqlx
similarity index 100%
rename from cpc_sketch_scalar_union.sqlx
rename to cpc/sqlx/cpc_sketch_scalar_union.sqlx
diff --git a/cpc_sketch_to_string.sqlx b/cpc/sqlx/cpc_sketch_to_string.sqlx
similarity index 100%
rename from cpc_sketch_to_string.sqlx
rename to cpc/sqlx/cpc_sketch_to_string.sqlx
diff --git a/Makefile b/kll/Makefile
similarity index 84%
copy from Makefile
copy to kll/Makefile
index 991417c..e3ae3a8 100644
--- a/Makefile
+++ b/kll/Makefile
@@ -17,8 +17,6 @@
EMCC=emcc
EMCFLAGS=-Idatasketches-cpp/common/include \
- -Idatasketches-cpp/theta/include \
- -Idatasketches-cpp/cpc/include \
-Idatasketches-cpp/kll/include \
--no-entry \
-sWASM_BIGINT=1 \
@@ -28,9 +26,7 @@ EMCFLAGS=-Idatasketches-cpp/common/include \
-O3 \
--bind
-all: theta_sketch.mjs theta_sketch.js theta_sketch.wasm \
- cpc_sketch.mjs cpc_sketch.js cpc_sketch.wasm \
- kll_sketch.mjs kll_sketch.js kll_sketch.wasm
+all: kll_sketch.mjs kll_sketch.js kll_sketch.wasm
%.mjs: %.cpp
$(EMCC) $< $(EMCFLAGS) -sSINGLE_FILE=1 -o $@
diff --git a/kll/README.md b/kll/README.md
new file mode 100644
index 0000000..866a930
--- /dev/null
+++ b/kll/README.md
@@ -0,0 +1,44 @@
+<!--
+ 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.
+-->
+
+# Apache DataSketches functions for Google Cloud BigQuery
+
+[User-Defined Aggregate Functions (UDAFs)](https://cloud.google.com/bigquery/docs/user-defined-aggregates) and
+[non-aggregate (scalar) functions (UDFs)](https://cloud.google.com/bigquery/docs/user-defined-functions) for BigQuery SQL engine.
+
+Please visit the main [Apache DataSketches website](https://datasketches.apache.org) for more information about DataSketches library.
+
+If you are interested in making contributions to this project please see our [Community](https://datasketches.apache.org/docs/Community/) page for how to contact us.
+
+## Building
+
+- Requires [Emscripten (emcc compiler)](https://emscripten.org/)
+- Requires a link to [datasketches-cpp](https://github.com/apache/datasketches-cpp) in this directory
+
+## Example
+
+ select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_get_estimate(
+ `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_scalar_union(
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["1", "2", "3"]) as value),
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["3", "4", "5"]) as value),
+ null, null
+ ), null
+ );
+
+ result: 5
diff --git a/kll_sketch.cpp b/kll/kll_sketch.cpp
similarity index 100%
rename from kll_sketch.cpp
rename to kll/kll_sketch.cpp
diff --git a/kll_sketch_float_build.sqlx b/kll/sqlx/kll_sketch_float_build.sqlx
similarity index 100%
rename from kll_sketch_float_build.sqlx
rename to kll/sqlx/kll_sketch_float_build.sqlx
diff --git a/kll_sketch_float_get_cdf.sqlx b/kll/sqlx/kll_sketch_float_get_cdf.sqlx
similarity index 100%
rename from kll_sketch_float_get_cdf.sqlx
rename to kll/sqlx/kll_sketch_float_get_cdf.sqlx
diff --git a/kll_sketch_float_get_n.sqlx b/kll/sqlx/kll_sketch_float_get_n.sqlx
similarity index 100%
rename from kll_sketch_float_get_n.sqlx
rename to kll/sqlx/kll_sketch_float_get_n.sqlx
diff --git a/kll_sketch_float_get_pmf.sqlx b/kll/sqlx/kll_sketch_float_get_pmf.sqlx
similarity index 100%
rename from kll_sketch_float_get_pmf.sqlx
rename to kll/sqlx/kll_sketch_float_get_pmf.sqlx
diff --git a/kll_sketch_float_get_quantile.sqlx b/kll/sqlx/kll_sketch_float_get_quantile.sqlx
similarity index 100%
rename from kll_sketch_float_get_quantile.sqlx
rename to kll/sqlx/kll_sketch_float_get_quantile.sqlx
diff --git a/kll_sketch_float_get_rank.sqlx b/kll/sqlx/kll_sketch_float_get_rank.sqlx
similarity index 100%
rename from kll_sketch_float_get_rank.sqlx
rename to kll/sqlx/kll_sketch_float_get_rank.sqlx
diff --git a/kll_sketch_float_merge.sqlx b/kll/sqlx/kll_sketch_float_merge.sqlx
similarity index 100%
rename from kll_sketch_float_merge.sqlx
rename to kll/sqlx/kll_sketch_float_merge.sqlx
diff --git a/kll_sketch_float_to_string.sqlx b/kll/sqlx/kll_sketch_float_to_string.sqlx
similarity index 100%
rename from kll_sketch_float_to_string.sqlx
rename to kll/sqlx/kll_sketch_float_to_string.sqlx
diff --git a/kll_sketch_float_kolmogorov_smirnov_test.sqlx b/kll/test/kll_sketch_float_kolmogorov_smirnov_test.sqlx
similarity index 100%
rename from kll_sketch_float_kolmogorov_smirnov_test.sqlx
rename to kll/test/kll_sketch_float_kolmogorov_smirnov_test.sqlx
diff --git a/Makefile b/theta/Makefile
similarity index 88%
copy from Makefile
copy to theta/Makefile
index 991417c..fe37c95 100644
--- a/Makefile
+++ b/theta/Makefile
@@ -18,8 +18,6 @@
EMCC=emcc
EMCFLAGS=-Idatasketches-cpp/common/include \
-Idatasketches-cpp/theta/include \
- -Idatasketches-cpp/cpc/include \
- -Idatasketches-cpp/kll/include \
--no-entry \
-sWASM_BIGINT=1 \
-sEXPORTED_FUNCTIONS=[_malloc,_free] \
@@ -29,8 +27,6 @@ EMCFLAGS=-Idatasketches-cpp/common/include \
--bind
all: theta_sketch.mjs theta_sketch.js theta_sketch.wasm \
- cpc_sketch.mjs cpc_sketch.js cpc_sketch.wasm \
- kll_sketch.mjs kll_sketch.js kll_sketch.wasm
%.mjs: %.cpp
$(EMCC) $< $(EMCFLAGS) -sSINGLE_FILE=1 -o $@
diff --git a/theta/README.md b/theta/README.md
new file mode 100644
index 0000000..866a930
--- /dev/null
+++ b/theta/README.md
@@ -0,0 +1,44 @@
+<!--
+ 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.
+-->
+
+# Apache DataSketches functions for Google Cloud BigQuery
+
+[User-Defined Aggregate Functions (UDAFs)](https://cloud.google.com/bigquery/docs/user-defined-aggregates) and
+[non-aggregate (scalar) functions (UDFs)](https://cloud.google.com/bigquery/docs/user-defined-functions) for BigQuery SQL engine.
+
+Please visit the main [Apache DataSketches website](https://datasketches.apache.org) for more information about DataSketches library.
+
+If you are interested in making contributions to this project please see our [Community](https://datasketches.apache.org/docs/Community/) page for how to contact us.
+
+## Building
+
+- Requires [Emscripten (emcc compiler)](https://emscripten.org/)
+- Requires a link to [datasketches-cpp](https://github.com/apache/datasketches-cpp) in this directory
+
+## Example
+
+ select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_get_estimate(
+ `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_scalar_union(
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["1", "2", "3"]) as value),
+ (select `$BQ_PROJECT.$BQ_DATASET`.theta_sketch_agg_string(value, struct<int, int64>(null, null)) from unnest(["3", "4", "5"]) as value),
+ null, null
+ ), null
+ );
+
+ result: 5
diff --git a/theta_sketch_a_not_b.sqlx b/theta/sqlx/theta_sketch_a_not_b.sqlx
similarity index 100%
rename from theta_sketch_a_not_b.sqlx
rename to theta/sqlx/theta_sketch_a_not_b.sqlx
diff --git a/theta_sketch_agg_string.sqlx b/theta/sqlx/theta_sketch_agg_string.sqlx
similarity index 100%
rename from theta_sketch_agg_string.sqlx
rename to theta/sqlx/theta_sketch_agg_string.sqlx
diff --git a/theta_sketch_agg_union.sqlx b/theta/sqlx/theta_sketch_agg_union.sqlx
similarity index 100%
rename from theta_sketch_agg_union.sqlx
rename to theta/sqlx/theta_sketch_agg_union.sqlx
diff --git a/theta_sketch_get_estimate.sqlx b/theta/sqlx/theta_sketch_get_estimate.sqlx
similarity index 100%
rename from theta_sketch_get_estimate.sqlx
rename to theta/sqlx/theta_sketch_get_estimate.sqlx
diff --git a/theta_sketch_get_estimate_and_bounds.sqlx b/theta/sqlx/theta_sketch_get_estimate_and_bounds.sqlx
similarity index 100%
rename from theta_sketch_get_estimate_and_bounds.sqlx
rename to theta/sqlx/theta_sketch_get_estimate_and_bounds.sqlx
diff --git a/theta_sketch_jaccard_similarity.sqlx b/theta/sqlx/theta_sketch_jaccard_similarity.sqlx
similarity index 100%
rename from theta_sketch_jaccard_similarity.sqlx
rename to theta/sqlx/theta_sketch_jaccard_similarity.sqlx
diff --git a/theta_sketch_scalar_intersection.sqlx b/theta/sqlx/theta_sketch_scalar_intersection.sqlx
similarity index 100%
rename from theta_sketch_scalar_intersection.sqlx
rename to theta/sqlx/theta_sketch_scalar_intersection.sqlx
diff --git a/theta_sketch_scalar_union.sqlx b/theta/sqlx/theta_sketch_scalar_union.sqlx
similarity index 100%
rename from theta_sketch_scalar_union.sqlx
rename to theta/sqlx/theta_sketch_scalar_union.sqlx
diff --git a/theta_sketch_to_string.sqlx b/theta/sqlx/theta_sketch_to_string.sqlx
similarity index 100%
rename from theta_sketch_to_string.sqlx
rename to theta/sqlx/theta_sketch_to_string.sqlx
diff --git a/theta_sketch.cpp b/theta/theta_sketch.cpp
similarity index 100%
rename from theta_sketch.cpp
rename to theta/theta_sketch.cpp
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org