Changeset: 86957041a9ff for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/86957041a9ff Removed Files: monetdb5/modules/mal/json_util.c monetdb5/optimizer/opt_json.c monetdb5/optimizer/opt_json.h Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test monetdb5/modules/mal/CMakeLists.txt monetdb5/optimizer/CMakeLists.txt monetdb5/optimizer/opt_fastpath.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.c Branch: default Log Message:
Removed unused json optimizer, including useless json.resultSet operator. diffs (truncated from 318 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -46769,11 +46769,6 @@ pattern json.renderobject(X_0:any...):js JSONrenderobject; (empty) json -resultSet -command json.resultSet(X_0:bat[:uuid], X_1:bat[:lng], X_2:bat[:json]):json -JSONresultSet; -Converts the json store into a single json string: -json str command json.str(X_0:json):str JSONjson2str; @@ -48274,16 +48269,6 @@ pattern optimizer.inline(X_0:str, X_1:st OPTwrapper; Expand inline functions optimizer -json -pattern optimizer.json():str -OPTwrapper; -(empty) -optimizer -json -pattern optimizer.json(X_0:str, X_1:str):str -OPTwrapper; -Unroll the mat.pack operation -optimizer macro pattern optimizer.macro(X_0:str, X_1:str):void OPTmacro; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -35204,11 +35204,6 @@ pattern json.renderobject(X_0:any...):js JSONrenderobject; (empty) json -resultSet -command json.resultSet(X_0:bat[:uuid], X_1:bat[:lng], X_2:bat[:json]):json -JSONresultSet; -Converts the json store into a single json string: -json str command json.str(X_0:json):str JSONjson2str; @@ -36704,16 +36699,6 @@ pattern optimizer.inline(X_0:str, X_1:st OPTwrapper; Expand inline functions optimizer -json -pattern optimizer.json():str -OPTwrapper; -(empty) -optimizer -json -pattern optimizer.json(X_0:str, X_1:str):str -OPTwrapper; -Unroll the mat.pack operation -optimizer macro pattern optimizer.macro(X_0:str, X_1:str):void OPTmacro; diff --git a/monetdb5/modules/mal/CMakeLists.txt b/monetdb5/modules/mal/CMakeLists.txt --- a/monetdb5/modules/mal/CMakeLists.txt +++ b/monetdb5/modules/mal/CMakeLists.txt @@ -35,7 +35,6 @@ target_sources(malmodules txtsim.c tokenizer.c sample.c - json_util.c querylog.c querylog.h sysmon.c tracer.c diff --git a/monetdb5/modules/mal/json_util.c b/monetdb5/modules/mal/json_util.c deleted file mode 100644 --- a/monetdb5/modules/mal/json_util.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SPDX-License-Identifier: MPL-2.0 - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. - */ - -/* - * (c) Martin Kersten - */ - -#include "monetdb_config.h" -#include "gdk.h" -#include "mal_exception.h" - -typedef str json; - -static str -JSONresultSet(json *res, bat *uuid, bat *rev, bat *js) -{ - BAT *bu, *br, *bj; - char *result; - size_t sz, len=0; - - if ((bu = BBPquickdesc(*uuid)) == NULL) - throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS); - if ((br = BBPquickdesc(*rev)) == NULL) - throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS); - if ((bj = BBPquickdesc(*js)) == NULL) - throw(MAL, "json.resultset", INTERNAL_BAT_ACCESS); - if ( !(BATcount(bu) == BATcount(br) && BATcount(br) == BATcount(bj)) ) - throw(MAL, "json.resultset", "Input not aligned"); - sz= (22 + 12 + 20) * BATcount(bu); - result = (char*) GDKmalloc(sz); - if (result == NULL) - throw(MAL, "json.resultset", SQLSTATE(HY013) MAL_MALLOC_FAIL); - len += snprintf(result,sz,"["); - /* here the dirty work follows */ - /* loop over the triple store */ - snprintf(result+len,sz-len,"]"); - *res = result; - return MAL_SUCCEED; -} - -#include "mel.h" -mel_func json_util_init_funcs[] = { - command("json", "resultSet", JSONresultSet, false, "Converts the json store into a single json string:", args(1,4, arg("",json),batarg("u",uuid),batarg("rev",lng),batarg("js",json))), - { .imp=NULL } -}; -#include "mal_import.h" -#ifdef _MSC_VER -#undef read -#pragma section(".CRT$XCU",read) -#endif -LIB_STARTUP_FUNC(init_json_util_mal) -{ mal_module("json_util", NULL, json_util_init_funcs); } diff --git a/monetdb5/optimizer/CMakeLists.txt b/monetdb5/optimizer/CMakeLists.txt --- a/monetdb5/optimizer/CMakeLists.txt +++ b/monetdb5/optimizer/CMakeLists.txt @@ -32,7 +32,6 @@ target_sources(optimizer opt_projectionpath.c opt_projectionpath.h opt_macro.c opt_macro.h opt_matpack.c opt_matpack.h - opt_json.c opt_json.h opt_mergetable.c opt_mergetable.h opt_mitosis.c opt_mitosis.h opt_multiplex.c opt_multiplex.h diff --git a/monetdb5/optimizer/opt_fastpath.c b/monetdb5/optimizer/opt_fastpath.c --- a/monetdb5/optimizer/opt_fastpath.c +++ b/monetdb5/optimizer/opt_fastpath.c @@ -27,7 +27,6 @@ #include "opt_inline.h" #include "opt_projectionpath.h" #include "opt_matpack.h" -#include "opt_json.h" #include "opt_postfix.h" #include "opt_mergetable.h" #include "opt_mitosis.h" diff --git a/monetdb5/optimizer/opt_json.c b/monetdb5/optimizer/opt_json.c deleted file mode 100644 --- a/monetdb5/optimizer/opt_json.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SPDX-License-Identifier: MPL-2.0 - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. - */ - -/* - * This simple module replaces the SQL rendering with a JSON rendering - * Can be called after dataflow optimizer. The result appears as a string - * in the calling environment. - */ -#include "monetdb_config.h" -#include "mal_builder.h" -#include "opt_json.h" - -str -OPTjsonImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) -{ - int i, j, limit, slimit; - int bu = 0, br = 0, bj = 0; - str nme; - InstrPtr p,q; - int actions = 0; - InstrPtr *old; - str msg = MAL_SUCCEED; - - (void) cntxt; - (void) stk; /* to fool compilers */ - old= mb->stmt; - limit= mb->stop; - slimit = mb->ssize; - if ( newMalBlkStmt(mb,mb->stop) < 0) - throw(MAL,"optimizer.json", SQLSTATE(HY013) MAL_MALLOC_FAIL); - - for (i = 0; i < limit; i++) { - p = old[i]; - if( getModuleId(p) == sqlRef && getFunctionId(p) == affectedRowsRef) { - q = newInstruction(0, jsonRef, resultSetRef); - if (q == NULL) { - msg = createException(MAL, "optimizer.json", SQLSTATE(HY013) MAL_MALLOC_FAIL); - break; - } - q = pushArgument(mb, q, bu); - q = pushArgument(mb, q, br); - q = pushArgument(mb, q, bj); - pushInstruction(mb,q); - j = getArg(q,0); - p= getInstrPtr(mb,0); - setDestVar(q, newTmpVariable(mb, TYPE_str)); - pushInstruction(mb,p); - q = newInstruction(0, NULL, NULL); - if (q == NULL) { - msg = createException(MAL, "optimizer.json", SQLSTATE(HY013) MAL_MALLOC_FAIL); - break; - } - q->barrier = RETURNsymbol; - getArg(q,0)= getArg(p,0); - q = pushArgument(mb,q,j); - pushInstruction(mb,q); - actions++; - continue; - } - if( getModuleId(p) == sqlRef && getFunctionId(p) == rsColumnRef) { - nme = getVarConstant(mb,getArg(p,4)).val.sval; - if (strcmp(nme,"uuid")==0) - bu = getArg(p,7); - if (strcmp(nme,"lng")==0) - br = getArg(p,7); - if (strcmp(nme,"json")==0) - bj = getArg(p,7); - freeInstruction(p); - actions++; - continue; - } - pushInstruction(mb,p); - } - for(; i<slimit; i++) - if (old[i]) - pushInstruction(mb, old[i]); - GDKfree(old); - /* Defense line against incorrect plans */ - if( msg == MAL_SUCCEED && actions > 0){ - msg = chkTypes(cntxt->usermodule, mb, FALSE); - if (!msg) - msg = chkFlow(mb); - if (!msg) - msg = chkDeclarations(mb); - } - /* keep actions taken as a fake argument*/ - (void) pushInt(mb, pci, actions); - return msg; -} diff --git a/monetdb5/optimizer/opt_json.h b/monetdb5/optimizer/opt_json.h deleted file mode 100644 --- a/monetdb5/optimizer/opt_json.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * SPDX-License-Identifier: MPL-2.0 - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V. - */ - -#ifndef _OPT_JSON_ -#define _OPT_JSON_ -#include "opt_prelude.h" -#include "opt_support.h" -#include "mal_interpreter.h" -#include "mal_instruction.h" -#include "mal_function.h" - -extern str OPTjsonImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); - -#endif diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c --- a/monetdb5/optimizer/opt_wrapper.c +++ b/monetdb5/optimizer/opt_wrapper.c @@ -37,7 +37,6 @@ #include "opt_inline.h" #include "opt_projectionpath.h" #include "opt_matpack.h" -#include "opt_json.h" #include "opt_postfix.h" #include "opt_for.h" #include "opt_dict.h" @@ -79,7 +78,6 @@ static struct { _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org