napkin-0.5.13
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Napkin.Untyped.Utils.BigQuery

Description

 
Synopsis

Documentation

dedupByArray #

Arguments

:: AsRelation s 
=> [SExp]

Group by / uniquness conditions

-> s

A table like thing

-> Q (Ref SExp) 

Use BigQuery's ARRAY support to keep only one row per given partition.

dedupByRowNumber :: (MaybeQuery s, AsRelation s) => Partition -> s -> Q () #

Use BigQuery's ROW_NUMBER function to keep only one row per given partition.

topSelect #

Arguments

:: [Selected SExp]

Partition within this window; i.e. the unique entity

-> [Selected SExp]

Select the top-by-count among these breakdowns - e.g. "name" of a product

-> SExp

Numeric expression to determine frequency

-> Q a

Rest of the query that should contain the FROM and any WHERE clauses

-> Q () 

Select the values with the highest occurence within partitions.

combineTablesOuter #

Arguments

:: DefinedRelation 
-> [(DefinedRelation, [Ref Relation -> SExp])]

Table definitions and primary keys each shares with the first table in list

-> Q () 

TODO. Subtract primary keys from combined fields and explicitly add PK selects.

normalizeExtremes #

Arguments

:: DatePart

Time bucketing granularity

-> Int

# of bucket periods to look back

-> Relation

From table/query

-> (Ref Relation -> SExp)

Way to obtain timestamp

-> [(Ref Relation -> SExp, Ref a)]

Way to obtain the columns being trimmed, along with their new names

-> Q [Ref SExp] 

computePercentiles #

Arguments

:: Int

# of buckets

-> Relation

name of the table

-> SExp

order by (implicit ASC)

-> [SExp]

partition by

-> Name

new column created on ordered column

-> Q (Ref SExp)