Changeset: 332adf4d19af for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=332adf4d19af Modified Files: clients/Tests/MAL-signatures_gsl.stable.out clients/Tests/SQL-dump_gsl.stable.out sql/backends/monet5/UDF/Makefile.ag sql/backends/monet5/UDF/udf.c sql/backends/monet5/UDF/udf.h sql/test/Tests/systemfunctions_gsl.stable.out sql/test/leaks/Tests/check1_gsl.stable.out sql/test/leaks/Tests/check2_gsl.stable.out sql/test/leaks/Tests/check3_gsl.stable.out sql/test/leaks/Tests/check4_gsl.stable.out sql/test/leaks/Tests/check5_gsl.stable.out Branch: int128 Log Message:
added 128-bit integer (hge / HUGEINT) support for sample module UDF diffs (truncated from 553 to 300 lines): diff --git a/clients/Tests/MAL-signatures_gsl.stable.out b/clients/Tests/MAL-signatures_gsl.stable.out --- a/clients/Tests/MAL-signatures_gsl.stable.out +++ b/clients/Tests/MAL-signatures_gsl.stable.out @@ -3297,6 +3297,10 @@ command array.product(b:bat[:any_3,:any_ address ARRAYproduct; comment Produce an array product +command batudf.fuse(one:bat[:oid,:lng],two:bat[:oid,:lng]):bat[:oid,:hge] +address UDFBATfuse; +comment fuse two (8-byte) lng values into one (16-byte) hge value + command batudf.fuse(one:bat[:oid,:int],two:bat[:oid,:int]):bat[:oid,:lng] address UDFBATfuse; comment fuse two (4-byte) int values into one (8-byte) lng value @@ -53795,6 +53799,10 @@ command txtsim.similarity(string1:str,st address fstrcmp_impl; comment Normalized edit distance between two strings +command udf.fuse(one:lng,two:lng):hge +address UDFfuse_lng_hge; +comment fuse two (8-byte) lng values into one (16-byte) hge value + command udf.fuse(one:int,two:int):lng address UDFfuse_int_lng; comment fuse two (4-byte) int values into one (8-byte) lng value diff --git a/clients/Tests/SQL-dump_gsl.stable.out b/clients/Tests/SQL-dump_gsl.stable.out --- a/clients/Tests/SQL-dump_gsl.stable.out +++ b/clients/Tests/SQL-dump_gsl.stable.out @@ -685,6 +685,29 @@ returns integer external name udf.fuse; -- fuse two (4-byte) integer values into one (8-byte) bigint value create function fuse(one integer, two integer) returns bigint external name udf.fuse; +-- The contents of this file are subject to the MonetDB Public License +-- Version 1.1 (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.monetdb.org/Legal/MonetDBLicense +-- +-- Software distributed under the License is distributed on an "AS IS" +-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +-- License for the specific language governing rights and limitations +-- under the License. +-- +-- The Original Code is the MonetDB Database System. +-- +-- The Initial Developer of the Original Code is CWI. +-- Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +-- Copyright August 2008-2014 MonetDB B.V. +-- All Rights Reserved. + +-- add function signatures to SQL catalog + + +-- fuse two (8-byte) integer values into one (16-byte) bigint value +create function fuse(one bigint, two bigint) +returns hugeint external name udf.fuse; create function geomcollectionfromtext(wkt string, srid smallint) returns multipolygon external name geom."GeomCollectionFromText"; create function geometrytypeid(g geometry) returns integer external name geom."GeometryTypeId"; -- The srid in the *FromText Functions is currently not used @@ -1924,7 +1947,7 @@ 6800 "nils" "bigint" 64 0 6804 NULL true 6801 "minval" "clob" 0 0 6804 NULL true 10 NULL 6802 "maxval" "clob" 0 0 6804 NULL true 11 NULL 6803 "sorted" "boolean" 1 0 6804 NULL true 12 NULL -6857 "function_id" "int" 32 0 6858 NULL true 0 NULL +6862 "function_id" "int" 32 0 6863 NULL true 0 NULL COMMIT; START TRANSACTION; CREATE TABLE "sys"."_tables" ( @@ -2009,7 +2032,7 @@ 6757 "#storagemodel" 2000 NULL 2 true 0 6780 "storagemodel" 2000 "create view sys.storagemodel as select * from sys.storagemodel();" 1 true 0 false 6789 "tablestoragemodel" 2000 "-- A summary of the table storage requirement is is available as a table view.\n-- The auxillary column denotes the maximum space if all non-sorted columns\n-- would be augmented with a hash (rare situation)\ncreate view sys.tablestoragemodel\nas select \"schema\",\"table\",max(count) as \"count\",\n\tsum(columnsize) as columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(indices) as indices,\n\tsum(case when sorted = false then 8 * count else 0 end) as auxillary\nfrom sys.storagemodel() group by \"schema\",\"table\";" 1 true 0 false 6804 "statistics" 2000 NULL 0 true 0 false -6858 "systemfunctions" 2000 NULL 0 true 0 false +6863 "systemfunctions" 2000 NULL 0 true 0 false COMMIT; START TRANSACTION; CREATE TABLE "sys"."args" ( @@ -2021,7 +2044,7 @@ CREATE TABLE "sys"."args" ( "type_scale" INTEGER, "number" INTEGER ); -COPY 3870 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"'; +COPY 3873 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"'; 2151 30 "result" "oid" 63 0 0 2152 30 "arg_1" "wrd" 64 0 1 2153 31 "result" "oid" 63 0 0 @@ -5892,6 +5915,9 @@ 6850 6847 "two" "smallint" 16 0 2 6853 6852 "result" "bigint" 64 0 0 6854 6852 "one" "int" 32 0 1 6855 6852 "two" "int" 32 0 2 +6858 6857 "result" "hugeint" 128 0 0 +6859 6857 "one" "bigint" 64 0 1 +6860 6857 "two" "bigint" 64 0 2 COMMIT; START TRANSACTION; CREATE TABLE "sys"."auths" ( @@ -6145,7 +6171,7 @@ CREATE TABLE "sys"."functions" ( "side_effect" BOOLEAN, "schema_id" INTEGER ); -COPY 1418 RECORDS INTO "sys"."functions" FROM stdin USING DELIMITERS '\t','\n','"'; +COPY 1419 RECORDS INTO "sys"."functions" FROM stdin USING DELIMITERS '\t','\n','"'; 30 "not_uniques" "not_uniques" "sql" false 1 false 0 31 "not_uniques" "not_uniques" "sql" false 1 false 0 32 "hash" "hash" "calc" false 1 false 0 @@ -7564,6 +7590,7 @@ 6838 "reverse" "-- The contents of this 6842 "fuse" "-- fuse two (1-byte) tinyint values into one (2-byte) smallint value\ncreate function fuse(one tinyint, two tinyint)\nreturns smallint external name udf.fuse;" "udf" true 1 false 2000 6847 "fuse" "-- fuse two (2-byte) smallint values into one (4-byte) integer value\ncreate function fuse(one smallint, two smallint)\nreturns integer external name udf.fuse;" "udf" true 1 false 2000 6852 "fuse" "-- fuse two (4-byte) integer values into one (8-byte) bigint value\ncreate function fuse(one integer, two integer)\nreturns bigint external name udf.fuse;" "udf" true 1 false 2000 +6857 "fuse" "-- The contents of this file are subject to the MonetDB Public License\n-- Version 1.1 (the \"License\"); you may not use this file except in\n-- compliance with the License. You may obtain a copy of the License at\n-- http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the\n-- License for the specific language governing rights and limitations\n-- under the License.\n--\n-- The Original Code is the MonetDB Database System.\n--\n-- The Initial Developer of the Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 2008 CWI.\n-- Copyright August 2008-2014 MonetDB B.V.\n-- All Rights Reserved.\n\n-- add function signatures to SQL catalog\n\n\n-- fuse two (8-byte) integer values into one (16-byte) bigint value\ncreate function fuse(one bigint, two bigint)\nreturns hugeint external name udf.fuse;" "udf" true 1 fa lse 2000 COMMIT; START TRANSACTION; CREATE TABLE "sys"."idxs" ( @@ -7617,7 +7644,7 @@ 5540 1 1 0 0 5572 1 1 0 0 5575 1 1 0 0 5579 1 1 0 0 -6858 1 1 3 0 +6863 1 1 3 0 COMMIT; START TRANSACTION; CREATE TABLE "sys"."schemas" ( @@ -7678,7 +7705,7 @@ START TRANSACTION; CREATE TABLE "sys"."systemfunctions" ( "function_id" INTEGER ); -COPY 1418 RECORDS INTO "sys"."systemfunctions" FROM stdin USING DELIMITERS '\t','\n','"'; +COPY 1419 RECORDS INTO "sys"."systemfunctions" FROM stdin USING DELIMITERS '\t','\n','"'; 30 31 32 @@ -9097,6 +9124,7 @@ 6838 6842 6847 6852 +6857 COMMIT; START TRANSACTION; CREATE TABLE "sys"."triggers" ( diff --git a/sql/backends/monet5/UDF/Makefile.ag b/sql/backends/monet5/UDF/Makefile.ag --- a/sql/backends/monet5/UDF/Makefile.ag +++ b/sql/backends/monet5/UDF/Makefile.ag @@ -44,16 +44,37 @@ headers_mal = { SOURCES = udf.mal } +headers_mal_hge = { + COND = HAVE_HGE + HEADERS = mal + DIR = libdir/monetdb5 + SOURCES = udf_hge.mal +} + headers_sql = { HEADERS = sql DIR = libdir/monetdb5/createdb SOURCES = 80_udf.sql } +headers_sql_hge = { + COND = HAVE_HGE + HEADERS = sql + DIR = libdir/monetdb5/createdb + SOURCES = 80_udf_hge.sql +} + headers_autoload = { HEADERS = mal DIR = libdir/monetdb5/autoload SOURCES = 80_udf.mal } +headers_autoload_hge = { + COND = HAVE_HGE + HEADERS = mal + DIR = libdir/monetdb5/autoload + SOURCES = 80_udf_hge.mal +} + EXTRA_DIST_DIR = Tests diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c --- a/sql/backends/monet5/UDF/udf.c +++ b/sql/backends/monet5/UDF/udf.c @@ -197,6 +197,22 @@ UDFBATreverse(bat *ret, const bat *arg) #undef UU #undef UO +#ifdef HAVE_HGE +#define UI lng +#ifdef HAVE_LONG_LONG +#define UU unsigned long long +#else +#ifdef HAVE___INT64 +#define UU unsigned __int64 +#endif +#endif +#define UO hge +#include "udf_impl.h" +#undef UI +#undef UU +#undef UO +#endif + /* BAT fuse */ /* actual implementation */ @@ -243,9 +259,18 @@ UDFBATfuse_(BAT **ret, const BAT *bone, case TYPE_int: bres = BATnew(TYPE_void, TYPE_lng, n); break; +#ifdef HAVE_HGE + case TYPE_lng: + bres = BATnew(TYPE_void, TYPE_hge, n); + break; +#endif default: throw(MAL, "batudf.fuse", - "tails of input BATs must be one of {bte, sht, int}"); + "tails of input BATs must be one of {bte, sht, int" +#ifdef HAVE_HGE + ", lng" +#endif + "}"); } if (bres == NULL) throw(MAL, "batudf.fuse", MAL_MALLOC_FAIL); @@ -264,10 +289,20 @@ UDFBATfuse_(BAT **ret, const BAT *bone, msg = UDFBATfuse_int_lng ( bres, bone, btwo, n, &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); break; +#ifdef HAVE_HGE + case TYPE_lng: + msg = UDFBATfuse_lng_hge ( bres, bone, btwo, n, + &two_tail_sorted_unsigned, &two_tail_revsorted_unsigned ); + break; +#endif default: BBPreleaseref(bres->batCacheid); throw(MAL, "batudf.fuse", - "tails of input BATs must be one of {bte, sht, int}"); + "tails of input BATs must be one of {bte, sht, int" +#ifdef HAVE_HGE + ", lng" +#endif + "}"); } if (msg != MAL_SUCCEED) { diff --git a/sql/backends/monet5/UDF/udf.h b/sql/backends/monet5/UDF/udf.h --- a/sql/backends/monet5/UDF/udf.h +++ b/sql/backends/monet5/UDF/udf.h @@ -49,6 +49,9 @@ udf_export char * UDFBATreverse(bat *ret UDFfuse_scalar_decl(bte, sht); UDFfuse_scalar_decl(sht, int); UDFfuse_scalar_decl(int, lng); +#ifdef HAVE_HGE +UDFfuse_scalar_decl(lng, hge); +#endif udf_export char * UDFBATfuse(bat *ret, const bat *one, const bat *two); diff --git a/sql/test/Tests/systemfunctions_gsl.stable.out b/sql/test/Tests/systemfunctions_gsl.stable.out --- a/sql/test/Tests/systemfunctions_gsl.stable.out +++ b/sql/test/Tests/systemfunctions_gsl.stable.out @@ -193,6 +193,9 @@ Ready. [ "sys", "fuse", 0, "bigint", "-- fuse two (4-byte) integer values into one (8-byte) bigint value\ncreate function fuse(one integer, two integer)\nreturns bigint external name udf.fuse;" ] [ "sys", "fuse", 1, "int", "" ] [ "sys", "fuse", 2, "int", "" ] +[ "sys", "fuse", 0, "hugeint", "-- The contents of this file are subject to the MonetDB Public License\n-- Version 1.1 (the \"License\"); you may not use this file except in\n-- compliance with the License. You may obtain a copy of the License at\n-- http://www.monetdb.org/Legal/MonetDBLicense\n--\n-- Software distributed under the License is distributed on an \"AS IS\"\n-- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the\n-- License for the specific language governing rights and limitations\n-- under the License.\n--\n-- The Original Code is the MonetDB Database System.\n--\n-- The Initial Developer of the Original Code is CWI.\n-- Portions created by CWI are Copyright (C) 1997-July 2008 CWI.\n-- Copyright August 2008-2014 MonetDB B.V.\n-- All Rights Reserved.\n\n-- add function signatures to SQL catalog\n\n\n-- fuse two (8-byte) integer values into one (16-byte) bigint value\ncreate function fuse(one bigint, two bigint)\nreturns hugeint external name udf.fus e;" ] +[ "sys", "fuse", 1, "bigint", "" ] +[ "sys", "fuse", 2, "bigint", "" ] [ "sys", "geomcollectionfromtext", 0, "multipolygon", "create function geomcollectionfromtext(wkt string, srid smallint) returns multipolygon external name geom.\"GeomCollectionFromText\";" ] [ "sys", "geomcollectionfromtext", 1, "clob", "" ] [ "sys", "geomcollectionfromtext", 2, "smallint", "" ] diff --git a/sql/test/leaks/Tests/check1_gsl.stable.out b/sql/test/leaks/Tests/check1_gsl.stable.out --- a/sql/test/leaks/Tests/check1_gsl.stable.out +++ b/sql/test/leaks/Tests/check1_gsl.stable.out @@ -40,8 +40,8 @@ Ready. [ "oid", "bit", 72 ] [ "oid", "bit", 72 ] [ "oid", "bit", 418 ] -[ "oid", "bit", 1418 ] -[ "oid", "bit", 1418 ] +[ "oid", "bit", 1419 ] +[ "oid", "bit", 1419 ] [ "oid", "int", 0 ] [ "oid", "int", 0 ] [ "oid", "int", 0 ] @@ -95,15 +95,15 @@ Ready. [ "oid", "int", 418 ] [ "oid", "int", 418 ] [ "oid", "int", 418 ] -[ "oid", "int", 1418 ] -[ "oid", "int", 1418 ] -[ "oid", "int", 1418 ] -[ "oid", "int", 1418 ] -[ "oid", "int", 3870 ] -[ "oid", "int", 3870 ] -[ "oid", "int", 3870 ] -[ "oid", "int", 3870 ] -[ "oid", "int", 3870 ] _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
