📄 algebraextensions.mx
字号:
@' 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://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html@'@' 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-2007 CWI.@' All Rights Reserved.@f algebraExtensions@v 2.0@a M.L.Kersten, P. Boncz@+ Algebra ExtensionsThe algebra extensions relyon the MAL runtime setting, but logically belong to the kernel/algebramodule.@malpattern algebra.project( b:bat[:any_1,:any_3], val:any_2) :bat[:any_1,:any_2] address CMDBBPprojectcomment "Fill the tail column with a newly typed constant.";pattern algebra.project(b:bat[:any_1,:any_3], val:bat[:any_1,:any_2]) :bat[:any_1,:any_2]address CMDBBPprojectcomment "Fill the tail column with a constant."; @{@include prelude.mx@+ Implementation sectionIn most cases we pass a BAT identifier, which should be unifiedwith a BAT descriptor. Upon failure we can simply abort the function.@c#include "mal_config.h"#include "mal_box.h"#include "mal_client.h"#include "mal_interpreter.h"#include "bat5.h"#include "algebra.h"#ifdef WIN32#ifndef LIBALGEBRAEXTENSIONS#define ae_export extern __declspec(dllimport)#else#define ae_export extern __declspec(dllexport)#endif#else#define ae_export extern#endifae_export str CMDBBPproject(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);ae_export str CMDBBPprojectNil(int *ret, int *bid);strCMDBBPproject(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci){ int *result, *bid, tt; ptr *p; BAT *b, *bn; result = (int *) getArgReference(stk, pci, 0); bid = (int *) getArgReference(stk, pci, 1); p = (ptr *) getArgReference(stk, pci, 2); tt = getArgType(mb, pci, 2); if ((b = BATdescriptor(*bid)) == NULL) { throw(MAL, "bbp.project", "Cannot access descriptor"); } if (ATOMvarsized(tt)) { if (p == 0 || *(str *) p == 0) p = (ptr *) str_nil; else p = *(ptr **) p; } bn = BATconst(b, tt, p); BBPunfix(b->batCacheid); if (bn) { *result = bn->batCacheid; BBPkeepref(bn->batCacheid); return MAL_SUCCEED; } throw(MAL, "bbp.project", "Cannot create the constant BAT");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -