1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-20 01:42:27 +03:00

MCOL-523 Add UDAF and UDAnF SDK

This commit is contained in:
David Hall
2017-07-26 11:53:08 -05:00
parent bbad7882d2
commit a38b098f2a
72 changed files with 10264 additions and 4521 deletions

478
dbcon/ddlpackage/ddlpackage.vpj Normal file → Executable file
View File

@@ -1,242 +1,242 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackage.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/ddlpackage/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/ddlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackage.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/ddlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="altertable.cpp"/>
<F N="columndef.cpp"/>
<F N="createindex.cpp"/>
<F N="createtable.cpp"/>
<F N="ddl-gram.cpp"/>
<F N="ddl-scan.cpp"/>
<F N="ddlpkg.cpp"/>
<F N="dropindex.cpp"/>
<F N="droppartition.cpp"/>
<F N="droptable.cpp"/>
<F N="gramtest.cpp"/>
<F N="markpartition.cpp"/>
<F N="old-tdriver.cpp"/>
<F N="restorepartition.cpp"/>
<F N="serialize.cpp"/>
<F N="sqlparser.cpp"/>
<F N="sqlstatement.cpp"/>
<F N="sqlstatementlist.cpp"/>
<F N="tabledef.cpp"/>
<F N="tdriver.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="ddl-gram.h"/>
<F N="ddlpkg.h"/>
<F N="sqlparser.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackage.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/ddlpackage/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/ddlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackage.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/ddlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="altertable.cpp"/>
<F N="columndef.cpp"/>
<F N="createindex.cpp"/>
<F N="createtable.cpp"/>
<F N="ddl-gram.cpp"/>
<F N="ddl-scan.cpp"/>
<F N="ddlpkg.cpp"/>
<F N="dropindex.cpp"/>
<F N="droppartition.cpp"/>
<F N="droptable.cpp"/>
<F N="gramtest.cpp"/>
<F N="markpartition.cpp"/>
<F N="old-tdriver.cpp"/>
<F N="restorepartition.cpp"/>
<F N="serialize.cpp"/>
<F N="sqlparser.cpp"/>
<F N="sqlstatement.cpp"/>
<F N="sqlstatementlist.cpp"/>
<F N="tabledef.cpp"/>
<F N="tdriver.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="ddl-gram.h"/>
<F N="ddlpkg.h"/>
<F N="sqlparser.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

480
dbcon/ddlpackageproc/ddlpackageproc.vpj Normal file → Executable file
View File

@@ -1,243 +1,243 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackageproc.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/ddlproc/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackageproc.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="altertableprocessor.cpp"/>
<F N="createindexprocessor.cpp"/>
<F N="createtableprocessor.cpp"/>
<F N="ddlindexpopulator.cpp"/>
<F N="ddlpackageprocessor.cpp"/>
<F N="ddlpackageprocessorfactory.cpp"/>
<F N="dropindexprocessor.cpp"/>
<F N="droppartitionprocessor.cpp"/>
<F N="droptableprocessor.cpp"/>
<F N="markpartitionprocessor.cpp"/>
<F N="mydriver.cpp"/>
<F N="restorepartitionprocessor.cpp"/>
<F N="tdriver.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="altertableprocessor.h"/>
<F N="createindexprocessor.h"/>
<F N="createtableprocessor.h"/>
<F N="ddlindexpopulator.h"/>
<F N="ddlpackageprocessor.h"/>
<F N="ddlpackageprocessorfactory.h"/>
<F N="dropindexprocessor.h"/>
<F N="droppartitionprocessor.h"/>
<F N="droptableprocessor.h"/>
<F N="markpartitionprocessor.h"/>
<F N="restorepartitionprocessor.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackageproc.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/ddlproc/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdddlpackageproc.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="altertableprocessor.cpp"/>
<F N="createindexprocessor.cpp"/>
<F N="createtableprocessor.cpp"/>
<F N="ddlindexpopulator.cpp"/>
<F N="ddlpackageprocessor.cpp"/>
<F N="ddlpackageprocessorfactory.cpp"/>
<F N="dropindexprocessor.cpp"/>
<F N="droppartitionprocessor.cpp"/>
<F N="droptableprocessor.cpp"/>
<F N="markpartitionprocessor.cpp"/>
<F N="mydriver.cpp"/>
<F N="restorepartitionprocessor.cpp"/>
<F N="tdriver.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="altertableprocessor.h"/>
<F N="createindexprocessor.h"/>
<F N="createtableprocessor.h"/>
<F N="ddlindexpopulator.h"/>
<F N="ddlpackageprocessor.h"/>
<F N="ddlpackageprocessorfactory.h"/>
<F N="dropindexprocessor.h"/>
<F N="droppartitionprocessor.h"/>
<F N="droptableprocessor.h"/>
<F N="markpartitionprocessor.h"/>
<F N="restorepartitionprocessor.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

504
dbcon/dmlpackage/dmlpackage.vpj Normal file → Executable file
View File

@@ -1,255 +1,255 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackage.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/dmlpackage/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make -fMakefile"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackage.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make -fMakefile"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="calpontdmlfactory.cpp"/>
<F N="calpontdmlpackage.cpp"/>
<F N="commanddmlpackage.cpp"/>
<F N="deletedmlpackage.cpp"/>
<F N="dml-gram.cpp"/>
<F N="dml-scan.cpp"/>
<F N="dmlcolumn.cpp"/>
<F N="dmlobject.cpp"/>
<F N="dmlparser.cpp"/>
<F N="dmlpkg.cpp"/>
<F N="dmltable.cpp"/>
<F N="gramtest.cpp"/>
<F N="insertdmlpackage.cpp"/>
<F N="mysqldmlstatement.cpp"/>
<F N="oracledmlstatement.cpp"/>
<F N="row.cpp"/>
<F N="tdriver.cpp"/>
<F N="updatedmlpackage.cpp"/>
<F N="vendordmlstatement.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="calpontdmlfactory.h"/>
<F N="calpontdmlpackage.h"/>
<F N="commanddmlpackage.h"/>
<F N="deletedmlpackage.h"/>
<F N="dml-gram.h"/>
<F N="dmlcolumn.h"/>
<F N="dmlobject.h"/>
<F N="dmlpackage.h"/>
<F N="dmlparser.h"/>
<F N="dmlpkg.h"/>
<F N="dmltable.h"/>
<F N="insertdmlpackage.h"/>
<F N="mysqldmlstatement.h"/>
<F N="oracledmlstatement.h"/>
<F N="row.h"/>
<F N="updatedmlpackage.h"/>
<F N="vendordmlstatement.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackage.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/dmlpackage/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make -fMakefile"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackage.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackage/"
ClearProcessBuffer="1">
<Exec CmdLine="make -fMakefile"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="calpontdmlfactory.cpp"/>
<F N="calpontdmlpackage.cpp"/>
<F N="commanddmlpackage.cpp"/>
<F N="deletedmlpackage.cpp"/>
<F N="dml-gram.cpp"/>
<F N="dml-scan.cpp"/>
<F N="dmlcolumn.cpp"/>
<F N="dmlobject.cpp"/>
<F N="dmlparser.cpp"/>
<F N="dmlpkg.cpp"/>
<F N="dmltable.cpp"/>
<F N="gramtest.cpp"/>
<F N="insertdmlpackage.cpp"/>
<F N="mysqldmlstatement.cpp"/>
<F N="oracledmlstatement.cpp"/>
<F N="row.cpp"/>
<F N="tdriver.cpp"/>
<F N="updatedmlpackage.cpp"/>
<F N="vendordmlstatement.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="calpontdmlfactory.h"/>
<F N="calpontdmlpackage.h"/>
<F N="commanddmlpackage.h"/>
<F N="deletedmlpackage.h"/>
<F N="dml-gram.h"/>
<F N="dmlcolumn.h"/>
<F N="dmlobject.h"/>
<F N="dmlpackage.h"/>
<F N="dmlparser.h"/>
<F N="dmlpkg.h"/>
<F N="dmltable.h"/>
<F N="insertdmlpackage.h"/>
<F N="mysqldmlstatement.h"/>
<F N="oracledmlstatement.h"/>
<F N="row.h"/>
<F N="updatedmlpackage.h"/>
<F N="vendordmlstatement.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

5
dbcon/dmlpackageproc/deletepackageprocessor.cpp Normal file → Executable file
View File

@@ -458,16 +458,15 @@ namespace dmlpackageprocessor
}
// XXXST: take out the 'true' when all jobsteps have been made st-compatible
uint32_t amount = rgData.deserialize(msg, true);
rgData.deserialize(msg, true);
rowGroup->setData(&rgData);
//rowGroup->setData(const_cast<uint8_t*>(msg.buf()));
err = (rowGroup->getStatus() != 0);
if (err)
{
msgBk.advance(amount);
//msgBk.advance(rowGroup->getDataSize());
string errorMsg;
msgBk >> errorMsg;
msg >> errorMsg;
logging::Message::Args args;
logging::Message message(2);
args.add("Delete Failed: ");

466
dbcon/dmlpackageproc/dmlpackageproc.vpj Normal file → Executable file
View File

@@ -1,236 +1,236 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackageproc.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/dmlpackageproc/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackageproc/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackageproc.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackageproc/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="autoincrementdata.cpp"/>
<F N="commandpackageprocessor.cpp"/>
<F N="deletepackageprocessor.cpp"/>
<F N="dmlpackageprocessor.cpp"/>
<F N="dmlpackageprocessorfactory.cpp"/>
<F N="insertpackageprocessor.cpp"/>
<F N="tablelockdata.cpp"/>
<F N="tdriver.cpp"/>
<F N="updatepackageprocessor.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="autoincrementdata.h"/>
<F N="commandpackageprocessor.h"/>
<F N="deletepackageprocessor.h"/>
<F N="dmlpackageprocessor.h"/>
<F N="dmlpackageprocessorfactory.h"/>
<F N="insertpackageprocessor.h"/>
<F N="tablelockdata.h"/>
<F N="updatepackageprocessor.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackageproc.so"
CompilerConfigName="Latest Version"
ObjectDir="/home/dhall/genii/dbcon/dmlpackageproc/">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackageproc/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bddmlpackageproc.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="/home/dhall/genii/dbcon/dmlpackageproc/"
ClearProcessBuffer="1">
<Exec CmdLine="make install"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="autoincrementdata.cpp"/>
<F N="commandpackageprocessor.cpp"/>
<F N="deletepackageprocessor.cpp"/>
<F N="dmlpackageprocessor.cpp"/>
<F N="dmlpackageprocessorfactory.cpp"/>
<F N="insertpackageprocessor.cpp"/>
<F N="tablelockdata.cpp"/>
<F N="tdriver.cpp"/>
<F N="updatepackageprocessor.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="autoincrementdata.h"/>
<F N="commandpackageprocessor.h"/>
<F N="deletepackageprocessor.h"/>
<F N="dmlpackageprocessor.h"/>
<F N="dmlpackageprocessorfactory.h"/>
<F N="insertpackageprocessor.h"/>
<F N="tablelockdata.h"/>
<F N="updatepackageprocessor.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

5
dbcon/dmlpackageproc/updatepackageprocessor.cpp Normal file → Executable file
View File

@@ -512,16 +512,15 @@ uint64_t UpdatePackageProcessor::fixUpRows(dmlpackage::CalpontDMLPackage& cpacka
//timer.stop("Meta");
continue;
}
uint32_t amount = rgData.deserialize(msg, true);
rgData.deserialize(msg, true);
rowGroup->setData(&rgData);
//rowGroup->setData(const_cast<uint8_t*>(msg.buf()));
err = (rowGroup->getStatus() != 0);
if (err)
{
msgBk.advance(amount);
//msgBk.advance(rowGroup->getDataSize());
string errorMsg;
msgBk >> errorMsg;
msg >> errorMsg;
logging::Message::Args args;
logging::Message message(2);
args.add("Update Failed: ");

5
dbcon/execplan/CMakeLists.txt Normal file → Executable file
View File

@@ -1,5 +1,5 @@
include_directories( ${ENGINE_COMMON_INCLUDES} )
include_directories( ${ENGINE_COMMON_INCLUDES} ${ENGINE_UTILS_UDFSDK_INCLUDE} )
########### next target ###############
@@ -41,7 +41,8 @@ set(execplan_LIB_SRCS
treenode.cpp
treenodeimpl.cpp
vendorexecutionplan.cpp
windowfunctioncolumn.cpp)
windowfunctioncolumn.cpp
udafcolumn.cpp)
add_library(execplan SHARED ${execplan_LIB_SRCS})

3
dbcon/execplan/aggregatecolumn.h Normal file → Executable file
View File

@@ -70,7 +70,8 @@ public:
BIT_AND,
BIT_OR,
BIT_XOR,
GROUP_CONCAT
GROUP_CONCAT,
UDAF
};
/**

4
dbcon/execplan/calpontsystemcatalog.cpp Normal file → Executable file
View File

@@ -1051,7 +1051,7 @@ const CalpontSystemCatalog::ColType CalpontSystemCatalog::colType(const OID& Oid
colMap.insert(CMVT_(scale, srcp));
srcp.reset(col[8]);
colMap.insert(CMVT_(precision, srcp));
// TODO: NULL value handling & convert to boost::any
// TODO: NULL value handling & convert to static_any::any
// delete this manually at fcn exit
srcp.reset(col[9]);
colMap.insert(CMVT_(defaultvalue, srcp));
@@ -5045,7 +5045,7 @@ void CalpontSystemCatalog::getSchemaInfo(const string& in_schema)
colMap.insert(CMVT_(scale, srcp));
srcp.reset(col[8]);
colMap.insert(CMVT_(precision, srcp));
// TODO: NULL value handling & convert to boost::any
// TODO: NULL value handling & convert to static_any::any
// delete this manually at fcn exit
srcp.reset(col[9]);
colMap.insert(CMVT_(defaultvalue, srcp));

29
dbcon/execplan/calpontsystemcatalog.h Normal file → Executable file
View File

@@ -156,7 +156,8 @@ public:
TEXT, /*!< TEXT type */
NUM_OF_COL_DATA_TYPE, /* NEW TYPES ABOVE HERE */
LONGDOUBLE, /* @bug3241, dev and variance calculation only */
STRINT /* @bug3532, string as int for fast comparison */
STRINT, /* @bug3532, string as int for fast comparison */
UNDEFINED /*!< Undefined - used in UDAF API */
};
/** the set of column constraint types
@@ -914,6 +915,32 @@ inline bool isCharType(const execplan::CalpontSystemCatalog::ColDataType type)
/** convenience function to determine if column type is an
* unsigned type
*/
inline bool isNumeric(const execplan::CalpontSystemCatalog::ColDataType type)
{
switch (type)
{
case execplan::CalpontSystemCatalog::TINYINT:
case execplan::CalpontSystemCatalog::SMALLINT:
case execplan::CalpontSystemCatalog::MEDINT:
case execplan::CalpontSystemCatalog::INT:
case execplan::CalpontSystemCatalog::BIGINT:
case execplan::CalpontSystemCatalog::FLOAT:
case execplan::CalpontSystemCatalog::DOUBLE:
case execplan::CalpontSystemCatalog::DECIMAL:
case execplan::CalpontSystemCatalog::UTINYINT:
case execplan::CalpontSystemCatalog::USMALLINT:
case execplan::CalpontSystemCatalog::UMEDINT:
case execplan::CalpontSystemCatalog::UINT:
case execplan::CalpontSystemCatalog::UBIGINT:
case execplan::CalpontSystemCatalog::UFLOAT:
case execplan::CalpontSystemCatalog::UDOUBLE:
case execplan::CalpontSystemCatalog::UDECIMAL:
return true;
default:
return false;
}
}
inline bool isUnsigned(const execplan::CalpontSystemCatalog::ColDataType type)
{
switch (type)

7
dbcon/execplan/execplan.vpj Normal file → Executable file
View File

@@ -213,6 +213,7 @@
<F N="filter.cpp"/>
<F N="functioncolumn.cpp"/>
<F N="groupconcatcolumn.cpp"/>
<F N="intervalcolumn.cpp"/>
<F N="logicoperator.cpp"/>
<F N="mysqlexecutionplan.cpp"/>
<F N="objectidmanager.cpp"/>
@@ -221,6 +222,7 @@
<F N="oracleexecutionplan.cpp"/>
<F N="outerjoinonfilter.cpp"/>
<F N="predicateoperator.cpp"/>
<F N="pseudocolumn.cpp"/>
<F N="range.cpp"/>
<F N="returnedcolumn.cpp"/>
<F N="rowcolumn.cpp"/>
@@ -232,6 +234,7 @@
<F N="simplescalarfilter.cpp"/>
<F N="treenode.cpp"/>
<F N="treenodeimpl.cpp"/>
<F N="udafcolumn.cpp"/>
<F N="vendorexecutionplan.cpp"/>
<F N="windowfunctioncolumn.cpp"/>
</Folder>
@@ -258,6 +261,7 @@
<F N="filter.h"/>
<F N="functioncolumn.h"/>
<F N="groupconcatcolumn.h"/>
<F N="intervalcolumn.h"/>
<F N="logicoperator.h"/>
<F N="mysqlexecutionplan.h"/>
<F N="njlcolumnresult.h"/>
@@ -268,6 +272,7 @@
<F N="outerjoinonfilter.h"/>
<F N="parsetree.h"/>
<F N="predicateoperator.h"/>
<F N="pseudocolumn.h"/>
<F N="range.h"/>
<F N="returnedcolumn.h"/>
<F N="rowcolumn.h"/>
@@ -282,7 +287,9 @@
<F N="simplescalarfilter.h"/>
<F N="treenode.h"/>
<F N="treenodeimpl.h"/>
<F N="udafcolumn.h"/>
<F N="vendorexecutionplan.h"/>
<F N="wf_frame.h"/>
<F N="windowfunctioncolumn.h"/>
</Folder>
<Folder

6
dbcon/execplan/objectreader.cpp Normal file → Executable file
View File

@@ -32,6 +32,7 @@
#include "treenode.h"
#include "returnedcolumn.h"
#include "aggregatecolumn.h"
#include "udafcolumn.h"
#include "arithmeticcolumn.h"
#include "constantcolumn.h"
#include "functioncolumn.h"
@@ -121,6 +122,9 @@ TreeNode* ObjectReader::createTreeNode(messageqcpp::ByteStream& b) {
case GROUPCONCATCOLUMN:
ret = new GroupConcatColumn();
break;
case UDAFCOLUMN:
ret = new UDAFColumn();
break;
case ARITHMETICCOLUMN:
ret = new ArithmeticColumn();
break;
@@ -293,6 +297,8 @@ void ObjectReader::checkType(messageqcpp::ByteStream& b, const CLASSID id)
throw UnserializeException("Not a CalpontSelectExecutionPlan");
case NULL_CLASS:
throw UnserializeException("Not NULL"); // ??
case MCSV1_CONTEXT:
throw UnserializeException("Not a MCSV1_CONTEXT");
default:
throw UnserializeException("Bad id");
}

4
dbcon/execplan/objectreader.h Normal file → Executable file
View File

@@ -114,6 +114,10 @@ public:
CALPONTSELECTEXECUTIONPLAN,
CONSTANTFILTER,
OUTERJOINONFILTER,
/** UDAF SDK */
MCSV1_CONTEXT,
UDAFCOLUMN,
};
typedef uint8_t id_t; //expand as necessary

130
dbcon/execplan/udafcolumn.cpp Executable file
View File

@@ -0,0 +1,130 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include <sstream>
#include <cstring>
using namespace std;
#include "bytestream.h"
using namespace messageqcpp;
#include "rowgroup.h"
using namespace rowgroup;
#include "joblisttypes.h"
using namespace joblist;
#include "simplefilter.h"
#include "constantfilter.h"
#include "arithmeticcolumn.h"
#include "functioncolumn.h"
#include "objectreader.h"
#include "groupconcatcolumn.h"
#include "udafcolumn.h"
namespace execplan {
/**
* Constructors/Destructors
*/
UDAFColumn::UDAFColumn():
AggregateColumn()
{
}
UDAFColumn::UDAFColumn(const uint32_t sessionID):
AggregateColumn(sessionID)
{
}
UDAFColumn::UDAFColumn(const UDAFColumn& rhs, const uint32_t sessionID):
AggregateColumn(dynamic_cast<const AggregateColumn&>(rhs))
{
}
UDAFColumn::~UDAFColumn()
{
}
/**
* Methods
*/
const string UDAFColumn::toString() const
{
ostringstream output;
output << "UDAFColumn " << endl;
output << AggregateColumn::toString() << endl;
output << context.toString() << endl;
return output.str();
}
ostream& operator<<(ostream& output, const UDAFColumn& rhs)
{
output << rhs.toString();
return output;
}
void UDAFColumn::serialize(messageqcpp::ByteStream& b) const
{
b << (uint8_t) ObjectReader::UDAFCOLUMN;
AggregateColumn::serialize(b);
context.serialize(b);
}
void UDAFColumn::unserialize(messageqcpp::ByteStream& b)
{
ObjectReader::checkType(b, ObjectReader::UDAFCOLUMN);
AggregateColumn::unserialize(b);
context.unserialize(b);
}
bool UDAFColumn::operator==(const UDAFColumn& t) const
{
const AggregateColumn *rc1, *rc2;
rc1 = static_cast<const AggregateColumn*>(this);
rc2 = static_cast<const AggregateColumn*>(&t);
if (*rc1 != *rc2)
return false;
if (context != t.context)
return false;
return true;
}
bool UDAFColumn::operator==(const TreeNode* t) const
{
const UDAFColumn *ac;
ac = dynamic_cast<const UDAFColumn*>(t);
if (ac == NULL)
return false;
return *this == *ac;
}
bool UDAFColumn::operator!=(const UDAFColumn& t) const
{
return !(*this == t);
}
bool UDAFColumn::operator!=(const TreeNode* t) const
{
return !(*this == t);
}
} // namespace execplan

131
dbcon/execplan/udafcolumn.h Executable file
View File

@@ -0,0 +1,131 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/***********************************************************************
* $Id: groupconcatcolumn.h 9210 2013-01-21 14:10:42Z rdempsey $
*
*
***********************************************************************/
/** @file */
#ifndef UDAFCOLUMN_H
#define UDAFCOLUMN_H
#include <string>
#include "calpontselectexecutionplan.h"
#include "aggregatecolumn.h"
#include "mcsv1_udaf.h"
namespace messageqcpp {
class ByteStream;
}
using namespace mcsv1sdk;
/**
* Namespace
*/
namespace execplan {
/**
* @brief A class to represent an aggregate return column
*
* This class is a specialization of class ReturnedColumn that
* handles a user defined aggregate function (UDAF) call.
*/
class UDAFColumn : public AggregateColumn {
public:
/**
* Constructors
*/
UDAFColumn();
UDAFColumn(const uint32_t sessionID);
UDAFColumn(const UDAFColumn& rhs, const uint32_t sessionID=0);
/**
* Destructors
*/
virtual ~UDAFColumn();
/**
* Overloaded stream operator
*/
virtual const std::string toString() const;
/** return a copy of this pointer
*
* deep copy of this pointer and return the copy
*/
virtual UDAFColumn* clone() const { return new UDAFColumn(*this); }
/**
* Accessors and Mutators
*/
mcsv1Context& getContext() {return context;}
/**
* Serialize interface
*/
virtual void serialize(messageqcpp::ByteStream&) const;
virtual void unserialize(messageqcpp::ByteStream&);
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this;
* false otherwise
*/
virtual bool operator==(const TreeNode* t) const;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return true iff every member of t is a duplicate copy of every member of this;
* false otherwise
*/
virtual bool operator==(const UDAFColumn& t) const;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this;
* true otherwise
*/
virtual bool operator!=(const TreeNode* t) const;
/** @brief Do a deep, strict (as opposed to semantic) equivalence test
*
* Do a deep, strict (as opposed to semantic) equivalence test.
* @return false iff every member of t is a duplicate copy of every member of this;
* true otherwise
*/
virtual bool operator!=(const UDAFColumn& t) const;
private:
mcsv1Context context;
};
/**
* stream operator
*/
std::ostream& operator<<(std::ostream& os, const UDAFColumn& rhs);
}
#endif //UDAFCOLUMN_H

95
dbcon/execplan/wf_frame.h Executable file
View File

@@ -0,0 +1,95 @@
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/***********************************************************************
* $Id: wf_frame.h 9679 2017-06-11 $
*
*
***********************************************************************/
/** @file */
#ifndef WINDOW_FUNCTION_FRAME_H
#define WINDOW_FUNCTION_FRAME_H
#include <string>
#include <iosfwd>
#include <vector>
#include "returnedcolumn.h"
/**
* Namespace
*/
namespace execplan {
// This enum is made consistant with mysql Item_window_func
enum WF_FRAME
{
WF_PRECEDING = 0,
WF_FOLLOWING,
WF_UNBOUNDED_PRECEDING,
WF_UNBOUNDED_FOLLOWING,
WF_CURRENT_ROW,
WF_UNKNOWN
};
struct WF_Boundary
{
WF_Boundary() {}
WF_Boundary(WF_FRAME frame):fFrame(frame) {}
~WF_Boundary() {}
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
SRCP fVal; /// has to evaluate to unsigned value
SRCP fBound; /// order by col +, -, date_add or date_sub for RANGE window
enum WF_FRAME fFrame;
};
struct WF_Frame
{
WF_Frame(): fIsRange(true)
{
fStart.fFrame = WF_UNBOUNDED_PRECEDING;
fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
}
~WF_Frame() {}
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
WF_Boundary fStart;
WF_Boundary fEnd;
bool fIsRange; /// RANGE or ROWS
};
/**
* @brief A class to represent the order by clause of window function
*/
struct WF_OrderBy
{
WF_OrderBy() {}
WF_OrderBy(std::vector<SRCP> orders): fOrders(orders) {}
~WF_OrderBy() {};
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
std::vector<SRCP> fOrders;
WF_Frame fFrame;
};
}
#endif

2
dbcon/execplan/windowfunctioncolumn.cpp Normal file → Executable file
View File

@@ -257,6 +257,7 @@ void WindowFunctionColumn::serialize(messageqcpp::ByteStream& b) const
for (uint32_t i = 0; i < fPartitions.size(); i++)
fPartitions[i]->serialize(b);
fOrderBy.serialize(b);
udafContext.serialize(b);
}
void WindowFunctionColumn::unserialize(messageqcpp::ByteStream& b)
@@ -283,6 +284,7 @@ void WindowFunctionColumn::unserialize(messageqcpp::ByteStream& b)
fPartitions.push_back(srcp);
}
fOrderBy.unserialize(b);
udafContext.unserialize(b);
}
void WindowFunctionColumn::addToPartition(vector<SRCP>& groupByList)

62
dbcon/execplan/windowfunctioncolumn.h Normal file → Executable file
View File

@@ -31,6 +31,8 @@
#include "returnedcolumn.h"
#include "functor.h"
#include "mcsv1_udaf.h"
#include "wf_frame.h"
namespace messageqcpp {
class ByteStream;
@@ -41,61 +43,6 @@ class ByteStream;
*/
namespace execplan {
// This enum is made consistant with mysql Item_window_func
enum WF_FRAME
{
WF_PRECEDING = 0,
WF_FOLLOWING,
WF_UNBOUNDED_PRECEDING,
WF_UNBOUNDED_FOLLOWING,
WF_CURRENT_ROW,
WF_UNKNOWN
};
struct WF_Boundary
{
WF_Boundary() {}
WF_Boundary(WF_FRAME frame):fFrame(frame) {}
~WF_Boundary() {}
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
SRCP fVal; /// has to evaluate to unsigned value
SRCP fBound; /// order by col +, -, date_add or date_sub for RANGE window
enum WF_FRAME fFrame;
};
struct WF_Frame
{
WF_Frame(): fIsRange(true)
{
fStart.fFrame = WF_UNBOUNDED_PRECEDING;
fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
}
~WF_Frame() {}
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
WF_Boundary fStart;
WF_Boundary fEnd;
bool fIsRange; /// RANGE or ROWS
};
/**
* @brief A class to represent the order by clause of window function
*/
struct WF_OrderBy
{
WF_OrderBy() {}
WF_OrderBy(std::vector<SRCP> orders): fOrders(orders) {}
~WF_OrderBy() {};
const std::string toString() const;
void serialize(messageqcpp::ByteStream&) const;
void unserialize(messageqcpp::ByteStream&);
std::vector<SRCP> fOrders;
WF_Frame fFrame;
};
/**
* @brief A class to represent a functional column
*
@@ -182,6 +129,9 @@ public:
virtual bool hasWindowFunc();
void adjustResultType();
// UDAnF support
mcsv1sdk::mcsv1Context& getUDAFContext() {return udafContext;}
private:
/**
* Fields
@@ -197,6 +147,8 @@ private:
virtual bool operator!=(const TreeNode* t) const { return false; }
bool operator!=(const WindowFunctionColumn& t) const;
// UDAnF support
mcsv1sdk::mcsv1Context udafContext;
/***********************************************************
* F&E framework *
***********************************************************/

434
dbcon/ingres/ingres.vpj Normal file → Executable file
View File

@@ -1,220 +1,220 @@
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">
<Project
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdingres.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine="make"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdingres.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine="make"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="gwfcp.c"/>
<F N="gwfcpdata.c"/>
<F N="inggwif.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="inggwif.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
Version="10.0"
VendorName="SlickEdit"
TemplateName="GNU C/C++"
WorkingDir=".">
<Config
Name="Debug"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdingres.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -g -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -g -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine="make"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Config
Name="Release"
Type="gnuc"
DebugCallbackName="gdb"
Version="1"
OutputFile="%bdingres.so"
CompilerConfigName="Latest Version">
<Menu>
<Target
Name="Compile"
MenuCaption="&amp;Compile"
Dialog="_gnuc_options_form Compile"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
OutputExts="*.o"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ -c %xup %defd -o "%bd%n%oe" %i "%f"'/>
</Target>
<Target
Name="Link"
MenuCaption="&amp;Link"
ShowOnMenu="Never"
Dialog="_gnuc_options_form Link"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveCurrent"
RunFromDir="%rw">
<Exec CmdLine='g++ %xup -o "%o" %f %libs -shared -fPIC'/>
</Target>
<Target
Name="Build"
MenuCaption="&amp;Build"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine="make"/>
</Target>
<Target
Name="Rebuild"
MenuCaption="&amp;Rebuild"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Debug"
MenuCaption="&amp;Debug"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveNone"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="Execute"
MenuCaption="E&amp;xecute"
Dialog="_gnuc_options_form Run/Debug"
BuildFirst="1"
CaptureOutputWith="ProcessBuffer"
Deletable="0"
SaveOption="SaveWorkspaceFiles"
RunFromDir="%rw">
<Exec CmdLine=""/>
</Target>
<Target
Name="dash"
MenuCaption="-"
Deletable="0">
<Exec/>
</Target>
<Target
Name="GNU C Options"
MenuCaption="GNU C &amp;Options..."
ShowOnMenu="HideIfNoCmdLine"
Deletable="0"
SaveOption="SaveNone">
<Exec
CmdLine="gnucoptions"
Type="Slick-C"/>
</Target>
</Menu>
<List Name="GNUC Options">
<Item
Name="LinkerOutputType"
Value="SharedLibrary"/>
</List>
</Config>
<Files>
<Folder
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="gwfcp.c"/>
<F N="gwfcpdata.c"/>
<F N="inggwif.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="inggwif.h"/>
</Folder>
<Folder
Name="Resource Files"
Filters="*.ico;*.cur;*.dlg"/>
<Folder
Name="Bitmaps"
Filters="*.bmp"/>
<Folder
Name="Other Files"
Filters="">
<F
N="Makefile"
Type="Makefile"/>
</Folder>
</Files>
</Project>

28
dbcon/joblist/joblistfactory.cpp Normal file → Executable file
View File

@@ -58,6 +58,7 @@ using namespace boost;
#include "simplecolumn.h"
#include "rowcolumn.h"
#include "treenodeimpl.h"
#include "udafcolumn.h"
using namespace execplan;
#include "configcpp.h"
@@ -697,6 +698,22 @@ void updateAggregateColType(AggregateColumn* ac, const SRCP& srcp, int op, JobIn
ct.scale = 0;
ct.precision = 0;
}
else if (op == AggregateColumn::UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(ac);
if (udafc)
{
mcsv1Context& udafContext = udafc->getContext();
ct.colDataType = udafContext.getResultType();
ct.colWidth = udafContext.getColWidth();
ct.scale = udafContext.getScale();
ct.precision = udafContext.getPrecision();
}
else
{
ct = ac->resultType();
}
}
else
{
ct = ac->resultType();
@@ -883,7 +900,16 @@ const JobStepVector doAggProject(const CalpontSelectExecutionPlan* csep, JobInfo
if (ac->constCol().get() != NULL)
{
// replace the aggregate on constant with a count(*)
SRCP clone(new AggregateColumn(*ac, ac->sessionID()));
SRCP clone;
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(ac);
if (udafc)
{
clone.reset(new UDAFColumn(*udafc, ac->sessionID()));
}
else
{
clone.reset(new AggregateColumn(*ac, ac->sessionID()));
}
jobInfo.constAggregate.insert(make_pair(i, clone));
ac->aggOp(AggregateColumn::COUNT_ASTERISK);
ac->distinct(false);

430
dbcon/joblist/tupleaggregatestep.cpp Normal file → Executable file
View File

@@ -47,6 +47,7 @@ using namespace config;
#include "calpontsystemcatalog.h"
#include "aggregatecolumn.h"
#include "udafcolumn.h"
#include "arithmeticcolumn.h"
#include "functioncolumn.h"
#include "constantcolumn.h"
@@ -100,6 +101,7 @@ inline RowAggFunctionType functionIdMap(int planFuncId)
case AggregateColumn::BIT_XOR: return ROWAGG_BIT_XOR;
case AggregateColumn::GROUP_CONCAT: return ROWAGG_GROUP_CONCAT;
case AggregateColumn::CONSTANT: return ROWAGG_CONSTANT;
case AggregateColumn::UDAF: return ROWAGG_UDAF;
default: return ROWAGG_FUNCT_UNDEFINE;
}
}
@@ -695,8 +697,18 @@ SJSTEP TupleAggregateStep::prepAggregate(SJSTEP& step, JobInfo& jobInfo)
ConstantColumn* cc = dynamic_cast<ConstantColumn*>(ac->constCol().get());
idbassert(cc != NULL); // @bug5261
bool isNull = (ConstantColumn::NULLDATA == cc->type());
constAggDataVec.push_back(
ConstantAggData(cc->constval(), functionIdMap(ac->aggOp()), isNull));
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.deliveredCols[idx].get());
if (udafc)
{
constAggDataVec.push_back(
ConstantAggData(cc->constval(), udafc->getContext().getName(),
functionIdMap(ac->aggOp()), isNull));
}
else
{
constAggDataVec.push_back(
ConstantAggData(cc->constval(), functionIdMap(ac->aggOp()), isNull));
}
}
}
}
@@ -1097,7 +1109,24 @@ void TupleAggregateStep::prep1PhaseAggregate(
}
}
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colProj, i));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
if (udafc)
{
// Create a RowAggFunctionCol (UDAF subtype) with the context.
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, i));
}
else
{
throw logic_error("prep1PhasesAggregate: A UDAF function is called but there's no UDAFColumn");
}
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colProj, i));
}
functionVec.push_back(funct);
switch (aggOp)
@@ -1224,6 +1253,23 @@ void TupleAggregateStep::prep1PhaseAggregate(
}
break;
case ROWAGG_UDAF:
{
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(funct.get());
if (!udafFuncCol)
{
throw logic_error("prep1PhaseAggregate: A UDAF function is called but there's no RowUDAFFunctionCol");
}
// Return column
oidsAgg.push_back(oidsProj[colProj]);
keysAgg.push_back(key);
scaleAgg.push_back(udafFuncCol->fUDAFContext.getScale());
precisionAgg.push_back(udafFuncCol->fUDAFContext.getPrecision());
typeAgg.push_back(udafFuncCol->fUDAFContext.getResultType());
widthAgg.push_back(udafFuncCol->fUDAFContext.getColWidth());
break;
}
default:
{
ostringstream emsg;
@@ -1285,14 +1331,34 @@ void TupleAggregateStep::prep1PhaseAggregate(
}
}
// add auxiliary fields for statistics functions
// add auxiliary fields for UDAF and statistics functions
for (uint64_t i = 0; i < functionVec.size(); i++)
{
uint64_t j = functionVec[i]->fInputColumnIndex;
if (functionVec[i]->fAggFunction == ROWAGG_UDAF)
{
// UDAF user data
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(functionVec[i].get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
functionVec[i]->fAuxColumnIndex = lastCol++;
oidsAgg.push_back(oidsAgg[j]);
keysAgg.push_back(keysAgg[j]);
scaleAgg.push_back(0);
precisionAgg.push_back(0);
precisionAgg.push_back(0);
typeAgg.push_back(CalpontSystemCatalog::VARBINARY);
widthAgg.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2);
continue;
}
if (functionVec[i]->fAggFunction != ROWAGG_STATS)
continue;
functionVec[i]->fAuxColumnIndex = lastCol;
uint64_t j = functionVec[i]->fInputColumnIndex;
// sum(x)
oidsAgg.push_back(oidsAgg[j]);
@@ -1527,7 +1593,33 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(
continue;
uint64_t colProj = projColPosMap[aggKey];
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colProj, colAgg));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
if (udafc)
{
mcsv1sdk::UDAF_MAP::iterator funcIter = mcsv1sdk::UDAFMap::getMap().find(udafc->getContext().getName());
if (UNLIKELY(funcIter == mcsv1sdk::UDAFMap::getMap().end()))
{
std::ostringstream errmsg;
errmsg << "prep1PhaseDistinctAggregate: A UDAF function, " << udafc->getContext().getName() <<
", is called but there's no entry in UDAF_MAP";
throw std::logic_error(errmsg.str());
}
// Create a RowAggFunctionCol (UDAF subtype) with the context.
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAgg));
}
else
{
throw logic_error("prep1PhaseDistinctAggregate: A UDAF function is called but there's no UDAFColumn");
}
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colProj, colAgg));
}
functionVec1.push_back(funct);
aggFuncMap.insert(make_pair(make_pair(aggKey, aggOp), colAgg));
@@ -1671,6 +1763,32 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(
}
break;
case ROWAGG_UDAF:
{
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(funct.get());
if (!udafFuncCol)
{
throw logic_error("prep1PhaseDistinctAggregate A UDAF function is called but there's no RowUDAFFunctionCol");
}
// Return column
oidsAgg.push_back(oidsProj[colProj]);
keysAgg.push_back(aggKey);
scaleAgg.push_back(udafFuncCol->fUDAFContext.getScale());
precisionAgg.push_back(udafFuncCol->fUDAFContext.getPrecision());
typeAgg.push_back(udafFuncCol->fUDAFContext.getResultType());
widthAgg.push_back(udafFuncCol->fUDAFContext.getColWidth());
colAgg++;
// UDAF Dummy holder for UserData struct
oidsAgg.push_back(oidsProj[colProj]);
keysAgg.push_back(aggKey);
scaleAgg.push_back(0);
precisionAgg.push_back(0);
typeAgg.push_back(CalpontSystemCatalog::VARBINARY);
widthAgg.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2); // Binary column needs +2 for length bytes
funct->fAuxColumnIndex = colAgg++;
break;
}
default:
{
ostringstream emsg;
@@ -2090,14 +2208,33 @@ void TupleAggregateStep::prep1PhaseDistinctAggregate(
}
}
// add auxiliary fields for statistics functions
// add auxiliary fields for UDAF and statistics functions
for (uint64_t i = 0; i < functionVec2.size(); i++)
{
uint64_t j = functionVec2[i]->fInputColumnIndex;
if (functionVec2[i]->fAggFunction == ROWAGG_UDAF)
{
// Dummy Column for UDAF user data
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(functionVec2[i].get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
functionVec2[i]->fAuxColumnIndex = lastCol++;
oidsAggDist.push_back(oidsAggDist[j]); // Dummy?
keysAggDist.push_back(keysAggDist[j]); // Dummy?
scaleAggDist.push_back(0);
precisionAggDist.push_back(0);
typeAggDist.push_back(CalpontSystemCatalog::VARBINARY);
widthAggDist.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2);
continue;
}
if (functionVec2[i]->fAggFunction != ROWAGG_STATS)
continue;
functionVec2[i]->fAuxColumnIndex = lastCol;
uint64_t j = functionVec2[i]->fInputColumnIndex;
// sum(x)
oidsAggDist.push_back(oidsAggDist[j]);
@@ -2344,22 +2481,22 @@ void TupleAggregateStep::prep2PhasesAggregate(
{
// check if there are any aggregate columns
// a vector that has the aggregate function to be done by PM
vector<pair<uint32_t, int> > aggColVec;
// vector<pair<uint32_t, int> > aggColVec;
set<uint32_t> avgSet;
vector<std::pair<uint32_t, int> >& returnedColVec = jobInfo.returnedColVec;
for (uint64_t i = 0; i < returnedColVec.size(); i++)
{
// for (uint64_t i = 0; i < returnedColVec.size(); i++)
// {
// skip if not an aggregation column
if (returnedColVec[i].second == 0)
continue;
// if (returnedColVec[i].second == 0)
// continue;
aggColVec.push_back(returnedColVec[i]);
// aggColVec.push_back(returnedColVec[i]);
// remember if a column has an average function,
// with avg function, no need for separate sum or count_column_name
if (returnedColVec[i].second == AggregateColumn::AVG)
avgSet.insert(returnedColVec[i].first);
}
// if (returnedColVec[i].second == AggregateColumn::AVG)
// avgSet.insert(returnedColVec[i].first);
// }
// populate the aggregate rowgroup on PM and UM
// PM: projectedRG -> aggregateRGPM
@@ -2480,11 +2617,15 @@ void TupleAggregateStep::prep2PhasesAggregate(
}
// vectors for aggregate functions
for (uint64_t i = 0; i < aggColVec.size(); i++)
for (uint64_t i = 0; i < returnedColVec.size(); i++)
{
uint32_t aggKey = aggColVec[i].first;
RowAggFunctionType aggOp = functionIdMap(aggColVec[i].second);
RowAggFunctionType stats = statsFuncIdMap(aggColVec[i].second);
// skip if not an aggregation column
if (returnedColVec[i].second == 0)
continue;
uint32_t aggKey = returnedColVec[i].first;
RowAggFunctionType aggOp = functionIdMap(returnedColVec[i].second);
RowAggFunctionType stats = statsFuncIdMap(returnedColVec[i].second);
// skip on PM if this is a constant
if (aggOp == ROWAGG_CONSTANT)
@@ -2504,7 +2645,8 @@ void TupleAggregateStep::prep2PhasesAggregate(
}
if ((aggOp == ROWAGG_SUM || aggOp == ROWAGG_COUNT_COL_NAME) &&
(avgSet.find(aggKey) != avgSet.end()))
(returnedColVec[i].second == AggregateColumn::AVG))
// (avgSet.find(aggKey) != avgSet.end()))
// skip sum / count(column) if avg is also selected
continue;
@@ -2513,7 +2655,24 @@ void TupleAggregateStep::prep2PhasesAggregate(
continue;
uint64_t colProj = projColPosMap[aggKey];
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colProj, colAggPm));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
if (udafc)
{
// Create a RowAggFunctionCol (UDAF subtype) with the context.
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
}
else
{
throw logic_error("prep2PhasesAggregate: A UDAF function is called but there's no UDAFColumn");
}
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colProj, colAggPm));
}
functionVecPm.push_back(funct);
aggFuncMap.insert(make_pair(make_pair(aggKey, aggOp), colAggPm));
@@ -2667,7 +2826,31 @@ void TupleAggregateStep::prep2PhasesAggregate(
colAggPm++;
}
break;
case ROWAGG_UDAF:
{
// Return column
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(funct.get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
oidsAggPm.push_back(oidsProj[colProj]);
keysAggPm.push_back(aggKey);
scaleAggPm.push_back(udafFuncCol->fUDAFContext.getScale());
precisionAggPm.push_back(udafFuncCol->fUDAFContext.getPrecision());
typeAggPm.push_back(udafFuncCol->fUDAFContext.getResultType());
widthAggPm.push_back(udafFuncCol->fUDAFContext.getColWidth());
colAggPm++;
// Dummy Column for UDAF UserData struct
oidsAggPm.push_back(oidsProj[colProj]);
keysAggPm.push_back(aggKey);
scaleAggPm.push_back(0);
precisionAggPm.push_back(0);
typeAggPm.push_back(CalpontSystemCatalog::VARBINARY);
widthAggPm.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2); // Binary column needs +2 for length bytes
funct->fAuxColumnIndex = colAggPm++;
break;
}
default:
{
ostringstream emsg;
@@ -2849,7 +3032,16 @@ void TupleAggregateStep::prep2PhasesAggregate(
// update the aggregate function vector
else
{
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colPm, i));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colPm, i));
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colPm, i));
}
if (aggOp == ROWAGG_COUNT_NO_OP)
funct->fAuxColumnIndex = colPm;
else if (aggOp == ROWAGG_CONSTANT)
@@ -2909,14 +3101,33 @@ void TupleAggregateStep::prep2PhasesAggregate(
}
}
// add auxiliary fields for statistics functions
// add auxiliary fields for UDAF and statistics functions
for (uint64_t i = 0; i < functionVecUm.size(); i++)
{
uint64_t j = functionVecUm[i]->fInputColumnIndex;
if (functionVecUm[i]->fAggFunction == ROWAGG_UDAF)
{
// Dummy column for UDAF user data
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(functionVecUm[i].get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
functionVecUm[i]->fAuxColumnIndex = lastCol++;
oidsAggUm.push_back(oidsAggUm[j]); // Dummy?
keysAggUm.push_back(keysAggUm[j]); // Dummy?
scaleAggUm.push_back(0);
precisionAggUm.push_back(0);
typeAggUm.push_back(CalpontSystemCatalog::VARBINARY);
widthAggUm.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2);
continue;
}
if (functionVecUm[i]->fAggFunction != ROWAGG_STATS)
continue;
functionVecUm[i]->fAuxColumnIndex = lastCol;
uint64_t j = functionVecUm[i]->fInputColumnIndex;
// sum(x)
oidsAggUm.push_back(oidsAggUm[j]);
@@ -3170,7 +3381,32 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
continue;
uint64_t colProj = projColPosMap[aggKey];
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colProj, colAggPm));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
if (udafc)
{
mcsv1sdk::UDAF_MAP::iterator funcIter = mcsv1sdk::UDAFMap::getMap().find(udafc->getContext().getName());
if (UNLIKELY(funcIter == mcsv1sdk::UDAFMap::getMap().end()))
{
std::ostringstream errmsg;
errmsg << "prep2PhasesAggregate: A UDAF function, " << udafc->getContext().getName() <<
", is called but there's no entry in UDAF_MAP";
throw std::logic_error(errmsg.str());
}
// Create a RowAggFunctionCol (UDAF subtype) with the context.
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colProj, colAggPm));
}
else
{
throw logic_error("prep2PhasesDistinctAggregate: A UDAF function is called but there's no UDAFColumn");
}
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colProj, colAggPm));
}
functionVecPm.push_back(funct);
aggFuncMap.insert(make_pair(make_pair(aggKey, aggOp), colAggPm));
@@ -3314,6 +3550,32 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
}
break;
case ROWAGG_UDAF:
{
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(funct.get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
// Return column
oidsAggPm.push_back(oidsProj[colProj]);
keysAggPm.push_back(aggKey);
scaleAggPm.push_back(udafFuncCol->fUDAFContext.getScale());
precisionAggPm.push_back(udafFuncCol->fUDAFContext.getPrecision());
typeAggPm.push_back(udafFuncCol->fUDAFContext.getResultType());
widthAggPm.push_back(udafFuncCol->fUDAFContext.getColWidth());
colAggPm++;
// Dummy column for UDAF UserData struct
oidsAggPm.push_back(oidsProj[colProj]);
keysAggPm.push_back(aggKey);
scaleAggPm.push_back(0);
precisionAggPm.push_back(0);
typeAggPm.push_back(CalpontSystemCatalog::VARBINARY);
widthAggPm.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2); // Binary column needs +2 for length bytes
funct->fAuxColumnIndex = colAggPm++;
break;
}
default:
{
ostringstream emsg;
@@ -3337,13 +3599,27 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
for (uint32_t idx = 0; idx < functionVecPm.size(); idx++)
{
SP_ROWAGG_FUNC_t funct;
SP_ROWAGG_FUNC_t funcPm = functionVecPm[idx];
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(
funcPm->fAggFunction,
funcPm->fStatsFunction,
funcPm->fOutputColumnIndex,
funcPm->fOutputColumnIndex,
funcPm->fAuxColumnIndex));
// UDAF support
if (funcPm->fAggFunction == ROWAGG_UDAF)
{
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(funcPm.get());
funct.reset(new RowUDAFFunctionCol(
udafFuncCol->fUDAFContext,
udafFuncCol->fOutputColumnIndex,
udafFuncCol->fOutputColumnIndex,
udafFuncCol->fAuxColumnIndex));
}
else
{
funct.reset(new RowAggFunctionCol(
funcPm->fAggFunction,
funcPm->fStatsFunction,
funcPm->fOutputColumnIndex,
funcPm->fOutputColumnIndex,
funcPm->fAuxColumnIndex));
}
functionNoDistVec.push_back(funct);
}
@@ -3611,7 +3887,16 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
// update the aggregate function vector
else
{
SP_ROWAGG_FUNC_t funct(new RowAggFunctionCol(aggOp, stats, colUm, i));
SP_ROWAGG_FUNC_t funct;
if (aggOp == ROWAGG_UDAF)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(jobInfo.nonConstCols[i].get());
funct.reset(new RowUDAFFunctionCol(udafc->getContext(), colUm, i));
}
else
{
funct.reset(new RowAggFunctionCol(aggOp, stats, colUm, i));
}
if (aggOp == ROWAGG_COUNT_NO_OP)
funct->fAuxColumnIndex = colUm;
else if (aggOp == ROWAGG_CONSTANT)
@@ -3704,14 +3989,33 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
}
}
// add auxiliary fields for statistics functions
// add auxiliary fields for UDAF and statistics functions
for (uint64_t i = 0; i < functionVecUm.size(); i++)
{
uint64_t j = functionVecUm[i]->fInputColumnIndex;
if (functionVecUm[i]->fAggFunction == ROWAGG_UDAF)
{
// Dummy column for UDAF user data
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(functionVecUm[i].get());
if (!udafFuncCol)
{
throw logic_error("(9)A UDAF function is called but there's no RowUDAFFunctionCol");
}
functionVecUm[i]->fAuxColumnIndex = lastCol++;
oidsAggDist.push_back(oidsAggUm[j]); // Dummy?
keysAggDist.push_back(keysAggUm[j]); // Dummy?
scaleAggDist.push_back(0);
precisionAggDist.push_back(0);
typeAggDist.push_back(CalpontSystemCatalog::BIGINT);
widthAggDist.push_back(bigIntWidth);
widthAggUm.push_back(udafFuncCol->fUDAFContext.getUserDataSize()+2);
continue;
}
if (functionVecUm[i]->fAggFunction != ROWAGG_STATS)
continue;
functionVecUm[i]->fAuxColumnIndex = lastCol;
uint64_t j = functionVecUm[i]->fInputColumnIndex;
// sum(x)
oidsAggDist.push_back(oidsAggDist[j]);
@@ -3880,27 +4184,39 @@ void TupleAggregateStep::prep2PhasesDistinctAggregate(
vector<SP_ROWAGG_FUNC_t>::iterator it = functionVecUm.begin();
while (it != functionVecUm.end())
{
SP_ROWAGG_FUNC_t funct;
SP_ROWAGG_FUNC_t f = *it++;
if ((f->fOutputColumnIndex == k) &&
(f->fAggFunction == ROWAGG_COUNT_ASTERISK ||
f->fAggFunction == ROWAGG_COUNT_COL_NAME ||
f->fAggFunction == ROWAGG_SUM ||
f->fAggFunction == ROWAGG_AVG ||
f->fAggFunction == ROWAGG_MIN ||
f->fAggFunction == ROWAGG_MAX ||
f->fAggFunction == ROWAGG_STATS ||
f->fAggFunction == ROWAGG_BIT_AND ||
f->fAggFunction == ROWAGG_BIT_OR ||
f->fAggFunction == ROWAGG_BIT_XOR ||
f->fAggFunction == ROWAGG_CONSTANT))
if (f->fOutputColumnIndex == k)
{
SP_ROWAGG_FUNC_t funct(
new RowAggFunctionCol(
f->fAggFunction,
f->fStatsFunction,
f->fInputColumnIndex,
f->fOutputColumnIndex,
f->fAuxColumnIndex));
if (f->fAggFunction == ROWAGG_UDAF)
{
RowUDAFFunctionCol* udafFuncCol = dynamic_cast<RowUDAFFunctionCol*>(f.get());
funct.reset(new RowUDAFFunctionCol(
udafFuncCol->fUDAFContext,
udafFuncCol->fInputColumnIndex,
udafFuncCol->fOutputColumnIndex,
udafFuncCol->fAuxColumnIndex));
}
else if (f->fAggFunction == ROWAGG_COUNT_ASTERISK ||
f->fAggFunction == ROWAGG_COUNT_COL_NAME ||
f->fAggFunction == ROWAGG_SUM ||
f->fAggFunction == ROWAGG_AVG ||
f->fAggFunction == ROWAGG_MIN ||
f->fAggFunction == ROWAGG_MAX ||
f->fAggFunction == ROWAGG_STATS ||
f->fAggFunction == ROWAGG_BIT_AND ||
f->fAggFunction == ROWAGG_BIT_OR ||
f->fAggFunction == ROWAGG_BIT_XOR ||
f->fAggFunction == ROWAGG_CONSTANT)
{
funct.reset(
new RowAggFunctionCol(
f->fAggFunction,
f->fStatsFunction,
f->fInputColumnIndex,
f->fOutputColumnIndex,
f->fAuxColumnIndex));
}
functionSub2.push_back(funct);
}
}
@@ -4292,6 +4608,7 @@ void TupleAggregateStep::threadedAggregateRowGroups(uint32_t threadID)
for (uint32_t j = 0; j < multiDist->subAggregators().size(); j++)
{
fRowGroupIns[threadID].getRow(0, &rowIn);
rowIn.setUserDataStore(rgDatas[c].getUserDataStore());
for (uint64_t i = 0; i < fRowGroupIns[threadID].getRowCount(); ++i)
{
for (uint64_t k = 0;
@@ -4313,6 +4630,7 @@ void TupleAggregateStep::threadedAggregateRowGroups(uint32_t threadID)
{
fRowGroupIns[threadID].setData(&rgDatas[c]);
fRowGroupIns[threadID].getRow(0, &rowIn);
rowIn.setUserDataStore(rgDatas[c].getUserDataStore());
for (uint64_t i = 0; i < fRowGroupIns[threadID].getRowCount(); ++i)
{
// The key is the groupby columns, which are the leading columns.

20
dbcon/joblist/windowfunctionstep.cpp Normal file → Executable file
View File

@@ -146,6 +146,7 @@ WindowFunctionStep::WindowFunctionStep(const JobInfo& jobInfo) :
fEndOfResult(false),
fIsSelect(true),
fUseSSMutex(false),
fUseUFMutex(false),
fInputDL(NULL),
fOutputDL(NULL),
fInputIterator(-1),
@@ -531,6 +532,7 @@ void WindowFunctionStep::initialize(const RowGroup& rg, JobInfo& jobInfo)
// @bug6065, window functions that will update string table
int64_t wfsUpdateStringTable = 0;
int64_t wfsUserFunctionCount = 0;
for (RetColsVector::iterator i=jobInfo.windowCols.begin(); i<jobInfo.windowCols.end(); i++)
{
// window function type
@@ -541,12 +543,19 @@ void WindowFunctionStep::initialize(const RowGroup& rg, JobInfo& jobInfo)
CalpontSystemCatalog::ColType rt = wc->resultType();
if ((types[ridx] == CalpontSystemCatalog::CHAR ||
types[ridx] == CalpontSystemCatalog::VARCHAR ||
types[ridx] == CalpontSystemCatalog::TEXT) &&
types[ridx] == CalpontSystemCatalog::TEXT ||
types[ridx] == CalpontSystemCatalog::VARBINARY ||
types[ridx] == CalpontSystemCatalog::BLOB) &&
rg.getColumnWidth(ridx) >= jobInfo.stringTableThreshold)
{
wfsUpdateStringTable++;
++wfsUpdateStringTable;
}
}
// if (boost::iequals(wc->functionName(),"UDAF_FUNC")
if (wc->functionName() == "UDAF_FUNC")
{
++wfsUserFunctionCount;
}
vector<int64_t> fields;
fields.push_back(ridx); // result
@@ -609,7 +618,7 @@ void WindowFunctionStep::initialize(const RowGroup& rg, JobInfo& jobInfo)
// create the functor based on function name
boost::shared_ptr<WindowFunctionType> func =
WindowFunctionType::makeWindowFunction(fn, ct);
WindowFunctionType::makeWindowFunction(fn, ct, wc);
// parse parms after peer and fields are set
// functions may need to set order column index
@@ -751,7 +760,8 @@ void WindowFunctionStep::initialize(const RowGroup& rg, JobInfo& jobInfo)
if (wfsUpdateStringTable > 1)
fUseSSMutex = true;
if (wfsUserFunctionCount > 1)
fUseUFMutex = true;
fRowGroupOut = fRowGroupDelivered;
}
@@ -799,6 +809,8 @@ void WindowFunctionStep::execute()
//@bug6065, make StringStore::storeString() thread safe, default to false.
rgData.useStoreStringMutex(fUseSSMutex);
// For the User Data of UDAnF
rgData.useUserDataMutex(fUseUFMutex);
// window function does not change row count
fRowsReturned += rowCnt;

2
dbcon/joblist/windowfunctionstep.h Normal file → Executable file
View File

@@ -160,7 +160,7 @@ private:
bool fEndOfResult;
bool fIsSelect;
bool fUseSSMutex; //@bug6065, mutex for setStringField
bool fUseUFMutex; // To ensure thread safety of User Data (UDAnF)
// for input/output datalist
RowGroupDL* fInputDL;
RowGroupDL* fOutputDL;

View File

@@ -80,6 +80,7 @@ using namespace cal_impl_if;
#include "groupconcatcolumn.h"
#include "outerjoinonfilter.h"
#include "intervalcolumn.h"
#include "udafcolumn.h"
using namespace execplan;
#include "funcexp.h"
@@ -447,6 +448,9 @@ void debug_walk(const Item *item, void *arg)
case Item_sum::MAX_FUNC:
cout << "MAX_FUNC: " << item_name << endl;
break;
case Item_sum::UDF_SUM_FUNC:
cout << "UDAF_FUNC: " << item_name << endl;
break;
default:
cout << "SUM_FUNC_ITEM type=" << isp->sum_func() << endl;
break;
@@ -2135,6 +2139,9 @@ uint32_t setAggOp(AggregateColumn* ac, Item_sum* isp)
return ER_CHECK_NOT_IMPLEMENTED;
return rc;
}
case Item_sum::UDF_SUM_FUNC:
ac->aggOp(AggregateColumn::UDAF);
return rc;
default:
return ER_CHECK_NOT_IMPLEMENTED;
}
@@ -3527,7 +3534,9 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
gwi.aggOnSelect = true;
// N.B. argument_count() is the # of formal parms to the agg fcn. InifniDB only supports 1 argument
if (isp->argument_count() != 1 && isp->sum_func() != Item_sum::GROUP_CONCAT_FUNC)
// TODO: Support more than one parm
if (isp->argument_count() != 1 && isp->sum_func() != Item_sum::GROUP_CONCAT_FUNC
&& isp->sum_func() != Item_sum::UDF_SUM_FUNC)
{
gwi.fatalParseError = true;
gwi.parseErrorText = IDBErrorInfo::instance()->errorMsg(ERR_MUL_ARG_AGG);
@@ -3536,9 +3545,18 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
AggregateColumn* ac = NULL;
if (isp->sum_func() == Item_sum::GROUP_CONCAT_FUNC)
{
ac = new GroupConcatColumn(gwi.sessionid);
}
else
if (isp->sum_func() == Item_sum::UDF_SUM_FUNC)
{
ac = new UDAFColumn(gwi.sessionid);
}
else
{
ac = new AggregateColumn(gwi.sessionid);
}
if (isp->name)
ac->alias(isp->name);
@@ -3894,6 +3912,53 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
{
gwi.count_asterisk_list.push_back(ac);
}
// For UDAF, populate the context and call the UDAF init() function.
if (isp->sum_func() == Item_sum::UDF_SUM_FUNC)
{
UDAFColumn* udafc = dynamic_cast<UDAFColumn*>(ac);
if (udafc)
{
mcsv1Context& context = udafc->getContext();
context.setName(isp->func_name());
// Set up the return type defaults for the call to init()
context.setResultType(udafc->resultType().colDataType);
context.setColWidth(udafc->resultType().colWidth);
context.setScale(udafc->resultType().scale);
context.setPrecision(udafc->resultType().precision);
COL_TYPES colTypes;
execplan::CalpontSelectExecutionPlan::ColumnMap::iterator cmIter;
// Build the column type vector. For now, there is only one
colTypes.push_back(make_pair(udafc->functionParms()->alias(), udafc->functionParms()->resultType().colDataType));
// Call the user supplied init()
if (context.getFunction()->init(&context, colTypes) == mcsv1_UDAF::ERROR)
{
gwi.fatalParseError = true;
gwi.parseErrorText = udafc->getContext().getErrorMessage();
return NULL;
}
if (udafc->getContext().getRunFlag(UDAF_OVER_REQUIRED))
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WINDOW_FUNC_ONLY,
context.getName());
return NULL;
}
// Set the return type as set in init()
CalpontSystemCatalog::ColType ct;
ct.colDataType = context.getResultType();
ct.colWidth = context.getColWidth();
ct.scale = context.getScale();
ct.precision = context.getPrecision();
udafc->resultType(ct);
}
}
return ac;
}

View File

@@ -582,6 +582,8 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
(*f)->field_length = 40;
//float float_val = *(float*)(&value);
//f2->store(float_val);
if (f2->decimals() < (uint32_t)row.getScale(s))
f2->dec = (uint32_t)row.getScale(s);
f2->store(dl);
if ((*f)->null_ptr)
*(*f)->null_ptr &= ~(*f)->null_bit;
@@ -603,6 +605,8 @@ int fetchNextRow(uchar *buf, cal_table_info& ti, cal_connection_info* ci)
(*f)->field_length = 310;
//double double_val = *(double*)(&value);
//f2->store(double_val);
if (f2->decimals() < (uint32_t)row.getScale(s))
f2->dec = (uint32_t)row.getScale(s);
f2->store(dl);
if ((*f)->null_ptr)
*(*f)->null_ptr &= ~(*f)->null_bit;

View File

@@ -45,6 +45,9 @@ using namespace logging;
#include "funcexp.h"
using namespace funcexp;
#include "mcsv1_udaf.h"
using namespace mcsv1sdk;
namespace cal_impl_if {
ReturnedColumn* nullOnError(gp_walk_info& gwi)
@@ -232,7 +235,7 @@ string ConvertFuncName(Item_sum* item)
return "BIT_XOR";
break;
case Item_sum::UDF_SUM_FUNC:
return "UDF_SUM_FUNC"; // Not supported
return "UDAF_FUNC";
break;
case Item_sum::GROUP_CONCAT_FUNC:
return "GROUP_CONCAT"; // Not supported
@@ -286,14 +289,14 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
gwi.hasWindowFunc = true;
Item_window_func* wf = (Item_window_func*)item;
string funcName = ConvertFuncName(wf->window_func());
Item_sum* item_sum = wf->window_func();
string funcName = ConvertFuncName(item_sum);
WindowFunctionColumn* ac = new WindowFunctionColumn(funcName);
ac->distinct(wf->window_func()->has_with_distinct());
ac->distinct(item_sum->has_with_distinct());
Window_spec *win_spec = wf->window_spec;
SRCP srcp;
// arguments
vector<SRCP> funcParms;
Item_sum* item_sum = (Item_sum*)wf->arguments()[0];
for (uint32_t i = 0; i < item_sum->argument_count(); i++)
{
srcp.reset(buildReturnedColumn((item_sum->arguments()[i]), gwi, nonSupport));
@@ -303,17 +306,76 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
if (gwi.clauseType == WHERE && !gwi.rcWorkStack.empty())
gwi.rcWorkStack.pop();
}
// Setup UDAnF functions
if (item_sum->sum_func() == Item_sum::UDF_SUM_FUNC)
{
Item_udf_sum* udfsum = (Item_udf_sum*)item_sum;
mcsv1sdk::mcsv1Context& context = ac->getUDAFContext();
context.setName(udfsum->func_name());
// Set up the return type defaults for the call to init()
execplan::CalpontSystemCatalog::ColType& rt = ac->resultType();
context.setResultType(rt.colDataType);
context.setColWidth(rt.colWidth);
context.setScale(rt.scale);
context.setPrecision(rt.precision);
// Turn on the Analytic flag so the function is aware it is being called
// as a Window Function.
context.setContextFlag(CONTEXT_IS_ANALYTIC);
COL_TYPES colTypes;
execplan::CalpontSelectExecutionPlan::ColumnMap::iterator cmIter;
// Build the column type vector.
for (size_t i=0; i < funcParms.size(); ++i)
{
colTypes.push_back(make_pair(funcParms[i]->alias(), funcParms[i]->resultType().colDataType));
}
// Call the user supplied init()
if (context.getFunction()->init(&context, colTypes) == mcsv1_UDAF::ERROR)
{
gwi.fatalParseError = true;
gwi.parseErrorText = context.getErrorMessage();
return NULL;
}
if (!context.getRunFlag(UDAF_OVER_REQUIRED) && !context.getRunFlag(UDAF_OVER_ALLOWED))
{
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_UDANF_NOT_ALLOWED,
context.getName());
return nullOnError(gwi);
}
// Set the return type as set in init()
CalpontSystemCatalog::ColType ct;
ct.colDataType = context.getResultType();
ct.colWidth = context.getColWidth();
ct.scale = context.getScale();
ct.precision = context.getPrecision();
ac->resultType(ct);
}
// Some functions, such as LEAD/LAG don't have all parameters implemented in the
// front end. Add dummies here to make the backend use defaults.
// Some of these will be temporary until they are implemented in the front end.
// Others need to stay because the back end expects them, but the front end
// no longer sends them.
// This case is kept in enum order in hopes the compiler can optimize
switch (wf->window_func()->sum_func())
switch (item_sum->sum_func())
{
case Item_sum::COUNT_FUNC:
case Item_sum::COUNT_DISTINCT_FUNC:
case Item_sum::UDF_SUM_FUNC:
{
uint64_t bIgnoreNulls = (ac->getUDAFContext().getRunFlag(mcsv1sdk::UDAF_IGNORE_NULLS));
char sIgnoreNulls[18];
sprintf(sIgnoreNulls, "%lu", bIgnoreNulls);
srcp.reset(new ConstantColumn(sIgnoreNulls, (uint64_t)bIgnoreNulls, ConstantColumn::NUM)); // IGNORE/RESPECT NULLS. 1 => RESPECT
funcParms.push_back(srcp);
break;
}
case Item_sum::FIRST_VALUE_FUNC:
srcp.reset(new ConstantColumn("1", (uint64_t)1, ConstantColumn::NUM)); // OFFSET (always one)
funcParms.push_back(srcp);
@@ -365,251 +427,319 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
ac->partitions(partitions);
// Order by
WF_OrderBy orderBy;
// order columns
if (win_spec->order_list)
{
WF_OrderBy orderBy;
// order columns
if (win_spec->order_list)
// It is an error to have an order by clause if a UDAnF says it shouldn't
if (item_sum->sum_func() == Item_sum::UDF_SUM_FUNC)
{
vector<SRCP> orders;
ORDER* orderCol = reinterpret_cast<ORDER*>(win_spec->order_list->first);
for (; orderCol; orderCol= orderCol->next)
mcsv1sdk::mcsv1Context& context = ac->getUDAFContext();
if (!context.getRunFlag(UDAF_ORDER_ALLOWED))
{
Item* orderItem = *(orderCol->item);
srcp.reset(buildReturnedColumn(orderItem, gwi, nonSupport));
if (!srcp)
return nullOnError(gwi);
srcp->asc(orderCol->direction == ORDER::ORDER_ASC ? true : false);
// srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls first, 0-nulls last
srcp->nullsFirst(orderCol->direction == ORDER::ORDER_ASC ? 1 : 0); // WINDOWS TODO: implement NULLS FIRST/LAST in 10.2 front end
orders.push_back(srcp);
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_UDANF_ORDER_NOT_ALLOWED,
context.getName());
return nullOnError(gwi);
}
orderBy.fOrders = orders;
}
// window frame
WF_Frame frm;
if (win_spec->window_frame)
vector<SRCP> orders;
ORDER* orderCol = reinterpret_cast<ORDER*>(win_spec->order_list->first);
for (; orderCol; orderCol= orderCol->next)
{
frm.fIsRange = win_spec->window_frame->units == Window_frame::UNITS_RANGE;
// start
if (win_spec->window_frame->top_bound)
Item* orderItem = *(orderCol->item);
srcp.reset(buildReturnedColumn(orderItem, gwi, nonSupport));
if (!srcp)
return nullOnError(gwi);
srcp->asc(orderCol->direction == ORDER::ORDER_ASC ? true : false);
// srcp->nullsFirst(orderCol->nulls); // nulls 2-default, 1-nulls first, 0-nulls last
srcp->nullsFirst(orderCol->direction == ORDER::ORDER_ASC ? 1 : 0); // WINDOWS TODO: implement NULLS FIRST/LAST in 10.2 front end
orders.push_back(srcp);
}
orderBy.fOrders = orders;
}
else
{
if (item_sum->sum_func() == Item_sum::UDF_SUM_FUNC)
{
mcsv1sdk::mcsv1Context& context = ac->getUDAFContext();
if (context.getRunFlag(UDAF_ORDER_REQUIRED))
{
frm.fStart.fFrame = frame(win_spec->window_frame->top_bound->precedence_type,
win_spec->window_frame->top_bound->offset); // offset NULL means UNBOUNDED
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_UDANF_NOT_ALLOWED,
context.getName());
return nullOnError(gwi);
}
}
}
if (win_spec->window_frame->top_bound->offset)
// window frame
WF_Frame frm;
if (win_spec->window_frame)
{
// It is an error to have a frame clause if a UDAnF says it shouldn't
if (item_sum->sum_func() == Item_sum::UDF_SUM_FUNC)
{
mcsv1sdk::mcsv1Context& context = ac->getUDAFContext();
if (!context.getRunFlag(UDAF_WINDOWFRAME_ALLOWED))
{
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_UDANF_FRAME_NOT_ALLOWED,
context.getName());
return nullOnError(gwi);
}
}
frm.fIsRange = win_spec->window_frame->units == Window_frame::UNITS_RANGE;
// start
if (win_spec->window_frame->top_bound)
{
frm.fStart.fFrame = frame(win_spec->window_frame->top_bound->precedence_type,
win_spec->window_frame->top_bound->offset); // offset NULL means UNBOUNDED
if (win_spec->window_frame->top_bound->offset)
{
frm.fStart.fVal.reset(buildReturnedColumn(win_spec->window_frame->top_bound->offset, gwi, nonSupport));
if (!frm.fStart.fVal)
return nullOnError(gwi);
// 1. check expr is numeric type (rows) or interval (range)
bool boundTypeErr = false;
switch (frm.fStart.fVal->resultType().colDataType)
{
frm.fStart.fVal.reset(buildReturnedColumn(win_spec->window_frame->top_bound->offset, gwi, nonSupport));
if (!frm.fStart.fVal)
return nullOnError(gwi);
// 1. check expr is numeric type (rows) or interval (range)
bool boundTypeErr = false;
switch (frm.fStart.fVal->resultType().colDataType)
{
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
boundTypeErr = true;
break;
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
if (!frm.fIsRange)
boundTypeErr = true;
break;
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
if (!frm.fIsRange)
boundTypeErr = true;
else if (dynamic_cast<IntervalColumn*>(frm.fStart.fVal.get()) == NULL)
boundTypeErr = true;
break;
default: //okay
break;
}
if (boundTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_BOUND_TYPE,
colDataTypeToString(frm.fStart.fVal->resultType().colDataType));
return nullOnError(gwi);
}
}
}
// end
if (win_spec->window_frame->bottom_bound)
{
frm.fEnd.fFrame = frame(win_spec->window_frame->bottom_bound->precedence_type,
win_spec->window_frame->bottom_bound->offset);
if (win_spec->window_frame->bottom_bound->offset)
{
frm.fEnd.fVal.reset(buildReturnedColumn(win_spec->window_frame->bottom_bound->offset, gwi, nonSupport));
if (!frm.fEnd.fVal)
return nullOnError(gwi);
// check expr is numeric type (rows) or interval (range)
bool boundTypeErr = false;
switch (frm.fEnd.fVal->resultType().colDataType)
{
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
else if (dynamic_cast<IntervalColumn*>(frm.fStart.fVal.get()) == NULL)
boundTypeErr = true;
break;
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
if (!frm.fIsRange)
boundTypeErr = true;
else if (dynamic_cast<IntervalColumn*>(frm.fEnd.fVal.get()) == NULL)
boundTypeErr = true;
break;
default: //okay
break;
}
if (boundTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_BOUND_TYPE,
colDataTypeToString(frm.fStart.fVal->resultType().colDataType));
return nullOnError(gwi);
}
break;
default: //okay
break;
}
}
else // no end specified. default end to current row
{
frm.fEnd.fFrame = WF_CURRENT_ROW;
}
if (frm.fStart.fVal || frm.fEnd.fVal)
{
// check order by key only 1 (should be error-ed out in parser. double check here)
if (frm.fIsRange && orderBy.fOrders.size() > 1)
if (boundTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_ORDER_KEY);
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_BOUND_TYPE,
colDataTypeToString(frm.fStart.fVal->resultType().colDataType));
return nullOnError(gwi);
}
// check order by key type is numeric or date/datetime
bool orderTypeErr = false;
if (frm.fIsRange && orderBy.fOrders.size() == 1)
{
switch (orderBy.fOrders[0]->resultType().colDataType)
{
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
orderTypeErr = true;
break;
default: //okay
// interval bound has to have date/datetime order key
if ((dynamic_cast<IntervalColumn*>(frm.fStart.fVal.get()) != NULL ||
dynamic_cast<IntervalColumn*>(frm.fEnd.fVal.get()) != NULL))
{
if (orderBy.fOrders[0]->resultType().colDataType != CalpontSystemCatalog::DATE &&
orderBy.fOrders[0]->resultType().colDataType != CalpontSystemCatalog::DATETIME)
orderTypeErr = true;
}
else
{
if (orderBy.fOrders[0]->resultType().colDataType == CalpontSystemCatalog::DATETIME)
orderTypeErr = true;
}
break;
}
if (orderTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_ORDER_TYPE,
colDataTypeToString(orderBy.fOrders[0]->resultType().colDataType));
return nullOnError(gwi);
}
}
}
}
// construct +,- or interval function for boundary
if (frm.fIsRange && frm.fStart.fVal)
// end
if (win_spec->window_frame->bottom_bound)
{
frm.fEnd.fFrame = frame(win_spec->window_frame->bottom_bound->precedence_type,
win_spec->window_frame->bottom_bound->offset);
if (win_spec->window_frame->bottom_bound->offset)
{
frm.fStart.fBound.reset(buildBoundExp(frm.fStart, orderBy.fOrders[0], gwi));
if (!frm.fStart.fBound)
return nullOnError(gwi);
}
if (frm.fIsRange && frm.fEnd.fVal)
{
frm.fEnd.fBound.reset(buildBoundExp(frm.fEnd, orderBy.fOrders[0], gwi));
frm.fEnd.fVal.reset(buildReturnedColumn(win_spec->window_frame->bottom_bound->offset, gwi, nonSupport));
if (!frm.fEnd.fVal)
return nullOnError(gwi);
// check expr is numeric type (rows) or interval (range)
bool boundTypeErr = false;
switch (frm.fEnd.fVal->resultType().colDataType)
{
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
boundTypeErr = true;
break;
case CalpontSystemCatalog::DATE:
case CalpontSystemCatalog::DATETIME:
if (!frm.fIsRange)
boundTypeErr = true;
else if (dynamic_cast<IntervalColumn*>(frm.fEnd.fVal.get()) == NULL)
boundTypeErr = true;
break;
default: //okay
break;
}
if (boundTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_BOUND_TYPE,
colDataTypeToString(frm.fStart.fVal->resultType().colDataType));
return nullOnError(gwi);
}
}
}
else
else // no end specified. default end to current row
{
// Certain function types have different default boundaries
// This case is kept in enum order in hopes the compiler can optimize
switch (wf->window_func()->sum_func())
{
case Item_sum::COUNT_FUNC:
case Item_sum::COUNT_DISTINCT_FUNC:
case Item_sum::SUM_FUNC:
case Item_sum::SUM_DISTINCT_FUNC:
case Item_sum::AVG_FUNC:
case Item_sum::AVG_DISTINCT_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::MIN_FUNC:
case Item_sum::MAX_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
// frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::STD_FUNC:
case Item_sum::VARIANCE_FUNC:
case Item_sum::SUM_BIT_FUNC:
case Item_sum::UDF_SUM_FUNC:
case Item_sum::GROUP_CONCAT_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::ROW_NUMBER_FUNC:
case Item_sum::RANK_FUNC:
case Item_sum::DENSE_RANK_FUNC:
case Item_sum::PERCENT_RANK_FUNC:
case Item_sum::CUME_DIST_FUNC:
case Item_sum::NTILE_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
break;
case Item_sum::FIRST_VALUE_FUNC:
case Item_sum::LAST_VALUE_FUNC:
case Item_sum::NTH_VALUE_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::LEAD_FUNC:
case Item_sum::LAG_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
break;
default:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
};
frm.fEnd.fFrame = WF_CURRENT_ROW;
}
orderBy.fFrame = frm;
ac->orderBy(orderBy);
if (frm.fStart.fVal || frm.fEnd.fVal)
{
// check order by key only 1 (should be error-ed out in parser. double check here)
if (frm.fIsRange && orderBy.fOrders.size() > 1)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_ORDER_KEY);
return nullOnError(gwi);
}
// check order by key type is numeric or date/datetime
bool orderTypeErr = false;
if (frm.fIsRange && orderBy.fOrders.size() == 1)
{
switch (orderBy.fOrders[0]->resultType().colDataType)
{
case CalpontSystemCatalog::CHAR:
case CalpontSystemCatalog::VARCHAR:
case CalpontSystemCatalog::VARBINARY:
case CalpontSystemCatalog::BLOB:
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
orderTypeErr = true;
break;
default: //okay
// interval bound has to have date/datetime order key
if ((dynamic_cast<IntervalColumn*>(frm.fStart.fVal.get()) != NULL ||
dynamic_cast<IntervalColumn*>(frm.fEnd.fVal.get()) != NULL))
{
if (orderBy.fOrders[0]->resultType().colDataType != CalpontSystemCatalog::DATE &&
orderBy.fOrders[0]->resultType().colDataType != CalpontSystemCatalog::DATETIME)
orderTypeErr = true;
}
else
{
if (orderBy.fOrders[0]->resultType().colDataType == CalpontSystemCatalog::DATETIME)
orderTypeErr = true;
}
break;
}
if (orderTypeErr)
{
gwi.fatalParseError = true;
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_INVALID_ORDER_TYPE,
colDataTypeToString(orderBy.fOrders[0]->resultType().colDataType));
return nullOnError(gwi);
}
}
}
// construct +,- or interval function for boundary
if (frm.fIsRange && frm.fStart.fVal)
{
frm.fStart.fBound.reset(buildBoundExp(frm.fStart, orderBy.fOrders[0], gwi));
if (!frm.fStart.fBound)
return nullOnError(gwi);
}
if (frm.fIsRange && frm.fEnd.fVal)
{
frm.fEnd.fBound.reset(buildBoundExp(frm.fEnd, orderBy.fOrders[0], gwi));
if (!frm.fEnd.fVal)
return nullOnError(gwi);
}
}
else
{
// Certain function types have different default boundaries
// This case is kept in enum order in hopes the compiler can optimize
switch (item_sum->sum_func())
{
case Item_sum::COUNT_FUNC:
case Item_sum::COUNT_DISTINCT_FUNC:
case Item_sum::SUM_FUNC:
case Item_sum::SUM_DISTINCT_FUNC:
case Item_sum::AVG_FUNC:
case Item_sum::AVG_DISTINCT_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::MIN_FUNC:
case Item_sum::MAX_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
// frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::STD_FUNC:
case Item_sum::VARIANCE_FUNC:
case Item_sum::SUM_BIT_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::UDF_SUM_FUNC:
{
mcsv1sdk::mcsv1Context& context = ac->getUDAFContext();
if (context.getRunFlag(UDAF_WINDOWFRAME_REQUIRED))
{
gwi.parseErrorText =
logging::IDBErrorInfo::instance()->errorMsg(logging::ERR_WF_UDANF_FRAME_REQUIRED,
context.getName());
return nullOnError(gwi);
}
int32_t bound;
char sBound[18];
context.getStartFrame(frm.fStart.fFrame, bound);
sprintf(sBound, "%d", bound);
srcp.reset(new ConstantColumn(sBound, (int64_t)bound, ConstantColumn::NUM));
frm.fStart.fVal = srcp;
frm.fStart.fBound.reset(buildBoundExp(frm.fStart, orderBy.fOrders[0], gwi));
if (!frm.fStart.fBound)
return nullOnError(gwi);
context.getEndFrame(frm.fEnd.fFrame, bound);
sprintf(sBound, "%d", bound);
srcp.reset(new ConstantColumn(sBound, (int64_t)bound, ConstantColumn::NUM));
frm.fEnd.fVal = srcp;
frm.fEnd.fBound.reset(buildBoundExp(frm.fEnd, orderBy.fOrders[0], gwi));
if (!frm.fEnd.fBound)
return nullOnError(gwi);
}
break;
case Item_sum::GROUP_CONCAT_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::ROW_NUMBER_FUNC:
case Item_sum::RANK_FUNC:
case Item_sum::DENSE_RANK_FUNC:
case Item_sum::PERCENT_RANK_FUNC:
case Item_sum::CUME_DIST_FUNC:
case Item_sum::NTILE_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
break;
case Item_sum::FIRST_VALUE_FUNC:
case Item_sum::LAST_VALUE_FUNC:
case Item_sum::NTH_VALUE_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
case Item_sum::LEAD_FUNC:
case Item_sum::LAG_FUNC:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_UNBOUNDED_FOLLOWING;
break;
default:
frm.fStart.fFrame = WF_UNBOUNDED_PRECEDING;
frm.fEnd.fFrame = WF_CURRENT_ROW;
break;
};
}
orderBy.fFrame = frm;
ac->orderBy(orderBy);
}
if (gwi.fatalParseError || nonSupport)
@@ -620,7 +750,8 @@ ReturnedColumn* buildWindowFunctionColumn(Item* item, gp_walk_info& gwi, bool& n
return NULL;
}
ac->resultType(colType_MysqlToIDB(wf->arguments()[0]));
ac->resultType(colType_MysqlToIDB(item_sum));
// bug5736. Make the result type double for some window functions when
// infinidb_double_for_decimal_math is set.
ac->adjustResultType();

View File

@@ -310,7 +310,7 @@ fi
kill_by_pid() {
# let's see if we can kill the 2 mysql procs by hand
# get the our mysql from ps
eval $(ps -ef | grep "$COLUMNSTORE_INSTALL_DIR/mysql//bin/mysqld " | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}')
eval $(ps -ef | grep "$COLUMNSTORE_INSTALL_DIR/mysql//bin/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}')
if [ -n "$pid" ]; then
ppid=$(ps -o ppid= -p $pid)