Skip to content

Instantly share code, notes, and snippets.

View ucasfl's full-sized avatar
👋
Focusing

flynn ucasfl

👋
Focusing
View GitHub Profile
#include <iostream>
#include <vector>
namespace A
{
class Array
{
public:
Array() = default;
void test() { }
# This is the CMakeCache file.
# For build in directory: /essd/fenglv/ClickHouse/rel
# It was generated by CMake: /essd/fenglv/gentoo/usr/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
#include <iostream>
#include <vector>
using namespace std;
int maxDiff(std::vector<int> & nums)
{
if (nums.size() <= 1)
return 0;
vector<int> max_v;
#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
extern int optind, opterr, optopt;
extern char * optarg;
DROP DATABASE IF EXISTS yg_projection;
CREATE DATABASE yg_projection;
USE yg_projection;
CREATE TABLE app_flow_entrance_data_detail_local
(
`hour` Int32,
`minute` Int32,
#include <iostream>
#include <thread>
#include <vector>
class A
{
public:
void func()
{
auto f = [&](int i) { vec[i] = i; };

如何在ClickHouse中添加自定义函数

在数据库中,通常有三类不同的函数,简称UDF,UDAF和UDTF。

UDF是指用户自定义函数,在ClickHouse中,这类函数不会改变数据的行数,其会对输入的列进行相应的计算,产生新的数据列。

UDAF是指用户自定义聚合函数,数据库中常见的sumcount等函数即为聚合函数,这类函数对输入的数据进行聚合计算,最终只输出一个聚合后的数据。

UDTF是指用户自定义表函数,正如名字所示,这类函数会返回一个临时的表(Table),从而可以通过SELECT语句从中读取数据,甚至通过INSERT语句插入数据。

struct CustomizeASTSelectWithUnionQueryNormalize
{
using TypeToVisit = ASTSelectWithUnionQuery;
const UnionMode & union_default_mode;
static void getSelectsFromUnionListNode(ASTPtr & ast_select, ASTs & selects)
{
if (auto * inner_union = ast_select->as<ASTSelectWithUnionQuery>())
{
#include <Parsers/ASTExpressionList.h>
#include <Parsers/ASTSelectWithUnionQuery.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parsers/ParserSelectWithUnionQuery.h>
#include <Parsers/ParserUnionQueryElement.h>
#include <Common/typeid_cast.h>
namespace DB
{
static void getSelectsFromUnionListNode(ASTPtr & ast_select, ASTs & selects)
@ucasfl
ucasfl / dlopen_sample.c
Created October 13, 2020 08:23 — forked from tailriver/ dlopen_sample.c
A sample of using dlopen library.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
int main(int argc, char** argv)
{
void *handle;
void (*func_print_name)(const char*);