Skip to content

Instantly share code, notes, and snippets.

ClickHouse: Correct MV Aggregation Over CDC Data

Background

This document describes patterns for building materialized views over tables that use Change Data Capture (CDC) via ReplacingMergeTree. The core challenge is that MVs in ClickHouse are insert triggers, not recomputed views — so they see raw CDC rows before deduplication, and naive aggregations will be wrong.

CDC primer

Extensible Symbolic Programming in Julia

       Vancouver Julia Meetup

            04/20/2021
           Shashi Gowda

         PhD candidate in

Computational Science and Engineering

@shashi
shashi / tullio_matmul.jl
Last active August 19, 2020 22:27
distributed matmul using Tullio.jl
using Tullio
using Dagger
using Dagger: DArray, chunks, Thunk, ArrayDomain
struct Zero end
Base.zero(::Type{Thunk}) = delayed(()->Zero())()
Base.zero(::Type{Union{Zero, ArrayDomain}}) = Zero()
Base.:(+)(z::Zero, x) = x
Base.:(+)(x, z::Zero) = x
Base.:(+)(z::Zero, x::Zero) = z
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shashi
shashi / Benchmarks - loadtable.ipynb
Last active November 27, 2017 13:03
JuliaDB benchmarks vs Pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shashi
shashi / either.jl
Last active December 27, 2016 17:25
immutable IRef{T}
value::T
IRef() = new()
IRef(value) = new(value)
end
immutable Result{T,S}
issuccess::Bool
value::IRef{T}
error::IRef{S}
@shashi
shashi / docgen.jl
Last active October 12, 2015 12:00
using Lazy
function methoddoc(name, sign, doc)
vbox(
fontweight(bold, code(string(name) * "(" * join(map(string, sign.types), ", ") *")" )),
doc
)
end
function showdoc(fn::Function, fndoc)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shashi
shashi / sneaky-dom.js
Last active March 29, 2016 18:29
Sneaky, Shady DOM
(function() {
function Sneaky (node) {
var lightNode = Polymer.dom(node)
this.lightNode = lightNode
this.node = lightNode.node
}
Sneaky.prototype = Polymer.dom()
Object.defineProperties(Sneaky.prototype, {
@shashi
shashi / layout.jl
Created April 27, 2015 17:45
Slides for my talk at MetaRefresh 2015. Made with https://github.com/shashi/Escher.jl
# An infinite number of mathematicians walk into a bar...
using Color
colors = distinguishable_colors(9)
box(w, h, n) =
empty |> fillcolor(colors[n % 9 + 1]) |> size(w, h)