This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Build a sample from the given values array with replacement. | |
*/ | |
function sample(values) { | |
var sampleValues = []; | |
for (let i = 0; i < values.length; i++) { | |
sampleValues.push(values[Math.floor(Math.random() * values.length)]); | |
} | |
return sampleValues; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This query creates a combined view of tracks and pages from segment data. | |
Sessions are computed by finding the any session start timestamp denoted by an activity gap of 30 minutes. | |
Session IDs are assigned to each track or page record using a combination of the session index, user ID, and date. | |
*/ | |
WITH | |
with_session_starts AS ( | |
SELECT | |
*, | |
COALESCE( (UNIX_MILLIS(timestamp) - UNIX_MILLIS(LAG(timestamp) OVER (PARTITION BY user_id ORDER BY timestamp ASC)))/(1000*60) >= 30, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
load("@rules_proto_grpc//:defs.bzl", "proto_plugin") | |
load("@npm//:@protobuf-ts/plugin/package_json.bzl", protobuf_ts_plugin = "bin") | |
package(default_visibility = ["//visibility:public"]) | |
protobuf_ts_plugin.protoc_gen_ts_binary( | |
name = "protoc_gen_ts", | |
) | |
proto_plugin( |