当前位置:网站首页>UDF implementation of Dameng database
UDF implementation of Dameng database
2022-07-05 18:54:00 【Q446512799】
The official introduction is very simple , Actually, it's a little pit
Header file reference
//-I/dm/dmdbms/include/
#include "de_pub.h"
Library file reference
-L/dm/dmdbms/bin/ -ldmde
String splicing code ( Function names must be uppercase , Otherwise, the creation succeeds , Call error 【[-7095]: Failed to load external function .】)
de_data C_CONCAT(de_args *args)
{
de_data de_ret;
char* str1;
char* str2;
char* str3;
int len1;
int len2;
str1 = (char*)de_get_str(args, 0); /* Take the... From the parameter list 0 Parameters */
str2 = (char*)de_get_str_with_len(args, 1, (udint4*)&len2); /* Take the... From the parameter list 1 The value and length of the parameters */
len1 = strlen(str1);
str3 = (char*)malloc(len1 + len2);
memcpy(str3, str1, len1);
memcpy(str3 + len1, str2, len2);
de_str_free((sdbyte*)str1); /* call get Function gets the string , You need to call this function to free the string space */
de_str_free((sdbyte*)str2);
de_ret = de_return_str_with_len((udbyte*)str3, len1 + len2); /* Return string */
free(str3);
return de_ret;
}
Build dynamic library
Create a function
CREATE OR REPLACE FUNCTION C_CONCAT(A VARCHAR, B VARCHAR)
RETURN VARCHAR
EXTERNAL '/dm/dmdbms/bin/libtestudf.so' C_CONCAT USING C;
/
Actual project use
notes : because c Write Dameng udf Is take the dmap agent (/dm/dmdbms/bin/dmap), So you need to start the agent first . If the library depends on external environment variables , You need to start it manually on the console that configures the environment variables dmap, Instead of running disql Command line console configuration , Otherwise, environment variables cannot be recognized normally .
边栏推荐
- 7-1 链表也简单fina
- c期末复习
- Emqx 5.0 officially released: a single cluster supports 100million mqtt connections
- 7-2 保持链表有序
- sample_ What is the relationship between rate, sample and duration
- 进程间通信(IPC):共享内存
- 自动化测试的好处
- The monthly list of Tencent cloud developer community videos was released in May 2022
- Use of websocket tool
- 2022年5月腾讯云开发者社区视频月度榜单公布
猜你喜欢
技术分享 | 接口测试价值与体系
The road of enterprise digital transformation starts from here
技术分享 | 常见接口协议解析
【HCIA-cloud】【1】云计算的定义、什么是云计算、云计算的架构与技术说明、华为云计算产品、华为内存DDR配置工具说明
2022年阿里Android高级面试题分享,2022阿里手淘Android面试题目
Overview of video self supervised learning
Reptile 01 basic principles of reptile
【Autosar 十四 启动流程详解】
The 11th China cloud computing standards and Applications Conference | cloud computing national standards and white paper series release, and Huayun data fully participated in the preparation
SAP 特征 特性 说明
随机推荐
集合处理的利器
Chinese postman? Really powerful!
What are the cache interfaces of nailing open platform applet API?
Linear table - abstract data type
sample_rate(采样率),sample(采样),duration(时长)是什么关系
Deep copy and shallow copy [interview question 3]
Cronab log: how to record the output of my cron script
Use file and directory properties and properties
Isprs2020/ cloud detection: transferring deep learning models for cloud detection between landsat-8 and proba-v
Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
Thoroughly understand why network i/o is blocked?
Pytorch yolov5 training custom data
企业数字化转型之路,从这里开始
Isprs2022/ cloud detection: cloud detection with boundary nets
《ClickHouse原理解析与应用实践》读书笔记(5)
The origin of PTS, DTS and duration of audio and video packages
A2L file parsing based on CAN bus (3)
5. 数据访问 - EntityFramework集成
Problems encountered in the project u-parse component rendering problems
技术分享 | 接口测试价值与体系