Skip to content

Instantly share code, notes, and snippets.

javi santana javisantana

Block or report user

Report or block javisantana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
javisantana / summing_merge_tree.sql
Created Jan 17, 2020
SummingMergetree multiple keys in nested maps
View summing_merge_tree.sql
MacBook-Pro-de-javi.local :) create table multiple_keys (tmp Int32, testMap Nested (a Int32, bKey Int32, value Int32)) Engine=SummingMergeTree() order by (tmp);
CREATE TABLE multiple_keys
`tmp` Int32,
`testMap` Nested(
a Int32,
bKey Int32,
value Int32)
javisantana / compile clickhouse on
Last active Mar 11, 2020
compile clickhouse on mojave
View compile clickhouse on

clickhouse on osx

These are the steps I followed to compile clickhouse on OSX mojave (10.4.3). These might not be the best way to make it compile on OSX, my knowledge about C++ and build tooling is really limited but they do the work.

clickhouse sha-1: 2ad4df1d6a

compile command (apply the patch below before running cmake)

javisantana / res.sql
Last active Jun 20, 2019
filter ourside the join vs inside the join in clickhouse
View res.sql
MacBook-Pro-de-javi.local :) select cityHash64(groupArray(cityHash64(*))) from A a asof inner join (select * from B where ts<toDateTime('1970-01-01 02:00:00')) b on and a.ts=b.ts where a.ts<toDateTime('1970-01-01 02:00:00');
SELECT cityHash64(groupArray(cityHash64(*)))
WHERE ts < toDateTime('1970-01-01 02:00:00')
) AS b ON ( = AND (a.ts = b.ts)
View charla
javisantana /
Last active May 21, 2019
how to build clickhouse on osx high sierra

IMPORTANT, this worked with CH stable (76629e9) version on 2019/02/14

install requirements

from the original osx build doc page

build clickhouse

Add /usr/local/include to the default path for gcc (for some reason gcc-7 was not using that folder on osx)

javisantana /
Created Jan 20, 2018
mercator projection using numpy
projects a numpy array with (lon, lat) to (x, y) in mercator coordinates using numpy
license: MIT
adapted from
import numpy as np
import math
"""haversine function adapted to work with numpy arrays
Adapted from
License: MIT
import math
import numpy as np
AVG_EARTH_RADIUS = 6371 * 1000 # m
View .vimrc
set nocompatible
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
let g:ackprg = 'ag --nogroup --nocolor --column'
map <F6> :%s/>\s*</>\r</g<CR>ggVG=
"colorscheme koehler
View mercator.js
// license: BSD3
const WEBMERCATOR_R = 6378137.0;
class Mercator {
static project(lon, lat) {
var x = DIAMETER * lon/360.0;
var sinlat = Math.sin(lat * Math.PI/180.0);
var y = DIAMETER *Math.log((1+sinlat)/(1-sinlat)) / (4*Math.PI);
return { x, y };
import urllib,sys,csv;
print reduce(lambda p, new: (p[0] + (new - p[0])/p[1], p[1] + 1), map(float, (x['tip_amount'] for x in csv.DictReader(urllib.urlopen(sys.argv[1])))), (0, 1))
You can’t perform that action at this time.