Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Maintainer | Ozgun Ataman |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Implements functions defined on functions-and-operators
Synopsis
- windowFn :: Ref Function -> [SExp] -> WOver -> SExp
- mkMod :: (a -> b) -> Maybe a -> [b]
- anyValue :: SExp -> Maybe WOver -> SExp
- arrayAgg :: SExp -> [FunModifier] -> SExp
- arrayConcatAgg :: SExp -> [Order] -> Maybe Int -> SExp
- bqAvg :: SExp -> Either Distinctness WOver -> SExp
- bitAnd :: SExp -> SExp
- bitOr :: SExp -> SExp
- bitXor :: SExp -> Distinctness -> SExp
- bqCount :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqCountDistinct :: SExp -> Maybe WOver -> SExp
- countIf :: SExp -> Maybe WOver -> SExp
- logicalAnd :: SExp -> SExp
- logicalOr :: SExp -> SExp
- bqMax :: SExp -> Maybe WOver -> SExp
- bqMin :: SExp -> Maybe WOver -> SExp
- bqSum :: SExp -> Distinctness -> Maybe WOver -> SExp
- corr :: SExp -> SExp -> SExp
- covarPop :: SExp -> SExp -> SExp
- covarSamp :: SExp -> SExp -> SExp
- bqStddevPop :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqStddevSamp :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqStddev :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqVarPop :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqVarSamp :: SExp -> Distinctness -> Maybe WOver -> SExp
- bqVariance :: SExp -> Distinctness -> Maybe WOver -> SExp
- approxCountDistinct :: SExp -> SExp
- approxQuantiles :: SExp -> Int -> Distinctness -> Maybe NullStrategy -> SExp
- approxTopCount :: SExp -> Int -> SExp
- approxTopSum :: SExp -> SExp -> Int -> SExp
- newtype HLLPrecision = HLLPrecision {}
- hllPrecision :: Int -> HLLPrecision
- hllInit :: [SExp] -> Maybe HLLPrecision -> SExp
- hllMerge :: SExp -> SExp
- hllMergePartial :: SExp -> SExp
- hllExtract :: SExp -> SExp
- rank :: WOver -> SExp
- denseRank :: WOver -> SExp
- percentRank :: WOver -> SExp
- rowNumber :: WOver -> SExp
- cumeDist :: WOver -> SExp
- ntile :: Int -> WOver -> SExp
- firstValue :: SExp -> WOver -> Maybe NullStrategy -> SExp
- lastValue :: SExp -> WOver -> Maybe NullStrategy -> SExp
- nthValue :: SExp -> Int -> WOver -> Maybe NullStrategy -> SExp
- lead :: SExp -> Int -> Maybe SExp -> WOver -> SExp
- lag :: SExp -> Int -> Maybe SExp -> WOver -> SExp
- percentileCont :: SExp -> Double -> [SExp] -> Maybe NullStrategy -> SExp
- percentileDisc :: SExp -> Double -> [SExp] -> Maybe NullStrategy -> SExp
- bitCount :: SExp -> SExp
- type UFunc = SExp -> SExp
- type BinFunc = SExp -> SExp -> SExp
- type NulFunc = SExp
- type MulFunc = [SExp] -> SExp
- isInf :: UFunc
- isNan :: UFunc
- ieeeDivide :: BinFunc
- rand :: NulFunc
- sqrt :: UFunc
- pow :: BinFunc
- power :: BinFunc
- exp :: UFunc
- ln :: UFunc
- log :: BinFunc
- log10 :: UFunc
- greatest :: MulFunc
- least :: MulFunc
- div :: BinFunc
- safeDiv :: BinFunc
- mod :: BinFunc
- round :: UFunc
- roundN :: SExp -> Int -> SExp
- trunc :: UFunc
- truncN :: Val a => SExp -> a -> SExp
- ceil :: UFunc
- floor :: UFunc
- cos :: UFunc
- cosh :: UFunc
- acos :: UFunc
- acosh :: UFunc
- sin :: UFunc
- sinh :: UFunc
- asin :: UFunc
- asinh :: UFunc
- tan :: UFunc
- tanh :: UFunc
- atan :: UFunc
- atanh :: UFunc
- atan2 :: BinFunc
- farmFingerprint :: UFunc
- md5 :: UFunc
- sha1 :: UFunc
- sha256 :: UFunc
- sha512 :: UFunc
- byteLength :: UFunc
- charLength :: UFunc
- codePointsToBytes :: UFunc
- codePointsToString :: UFunc
- concat :: MulFunc
- endsWith :: BinFunc
- format :: String -> [SExp] -> SExp
- fromBase64 :: UFunc
- length :: UFunc
- lpad :: SExp -> Int -> Maybe String -> SExp
- lower :: UFunc
- ltrim :: SExp -> Maybe String -> SExp
- regexpContains :: SExp -> String -> SExp
- regexpExtract :: SExp -> String -> SExp
- regexpExtractAll :: SExp -> String -> SExp
- regexpReplace :: SExp -> String -> String -> SExp
- replace :: SExp -> String -> String -> SExp
- repeat :: Val a => SExp -> a -> SExp
- reverse :: UFunc
- rpad :: SExp -> Int -> Maybe String -> SExp
- rtrim :: SExp -> Maybe String -> SExp
- safeConvertBytesToString :: UFunc
- safeCast :: SExp -> Type -> SExp
- split :: SExp -> Text -> SExp
- startsWith :: SExp -> SExp -> SExp
- strPos :: SExp -> SExp -> SExp
- substr :: SExp -> Int -> Maybe Int -> SExp
- toBase64 :: UFunc
- toCodePoints :: UFunc
- toHex :: UFunc
- trim :: SExp -> Maybe String -> SExp
- upper :: UFunc
- data JSONPath
- jsonPath_key :: String -> JSONPath
- jsonPath_index :: Int -> JSONPath
- renderJSONPath :: [JSONPath] -> String
- jsonExtract :: SExp -> [JSONPath] -> SExp
- jsonExtractScalar :: SExp -> [JSONPath] -> SExp
- toJsonString :: SExp -> Maybe Bool -> SExp
- arrayConcat :: NonEmpty SExp -> SExp
- arrayLength :: SExp -> SExp
- arrayToString :: SExp -> String -> Maybe String -> SExp
- generateArray :: SExp -> SExp -> Maybe SExp -> SExp
- generateDateArray :: SExp -> SExp -> Maybe IntInterval -> SExp
- arrayReverse :: SExp -> SExp
- offset :: Int -> SExp -> SExp
- ordinal :: Int -> SExp -> SExp
- currentDate :: Maybe String -> SExp
- dateYMD :: SExp -> SExp -> SExp -> SExp
- dateTimestamp :: SExp -> Maybe SExp -> SExp
- dateAdd :: SExp -> IntInterval -> SExp
- dateSub :: SExp -> IntInterval -> SExp
- dateDiff :: DatePart -> SExp -> SExp -> SExp
- dateTrunc :: DatePart -> SExp -> SExp
- dateFromUnixDate :: SExp -> SExp
- formatDate :: SExp -> SExp -> SExp
- parseDate :: SExp -> SExp -> SExp
- unixDate :: SExp -> SExp
- currentDatetime :: Maybe SExp -> SExp
- dateTimeYMDHMS :: SExp -> SExp -> SExp -> SExp -> SExp -> SExp -> SExp
- dateTimeDateAndTime :: SExp -> SExp -> SExp
- dateTimeTimestamp :: SExp -> Maybe SExp -> SExp
- dateTimeAdd :: SExp -> IntInterval -> SExp
- dateTimeSub :: SExp -> IntInterval -> SExp
- dateTimeDiff :: DatePart -> SExp -> SExp -> SExp
- dateTimeTrunc :: DatePart -> SExp -> SExp
- formatDateTime :: SExp -> SExp -> SExp
- parseDateTime :: SExp -> SExp -> SExp
- currentTime :: SExp
- timeHMS :: SExp -> SExp -> SExp -> SExp
- timeTS :: SExp -> Maybe SExp -> SExp
- timeAdd :: SExp -> IntInterval -> SExp
- timeSub :: SExp -> IntInterval -> SExp
- timeDiff :: DatePart -> SExp -> SExp -> SExp
- timeTrunc :: DatePart -> SExp -> SExp
- bqFormatTime :: SExp -> SExp -> SExp
- bqParseTime :: SExp -> SExp -> SExp
- currentTimestamp :: SExp
- extract :: DatePart -> SExp -> Maybe SExp -> SExp
- string :: SExp -> Maybe SExp -> SExp
- timestamp :: SExp -> Maybe SExp -> SExp
- timestampAdd :: SExp -> IntInterval -> SExp
- timestampSub :: SExp -> IntInterval -> SExp
- timestampDiff :: DatePart -> SExp -> SExp -> SExp
- timestampTrunc :: DatePart -> SExp -> Maybe SExp -> SExp
- formatTimestamp :: SExp -> SExp -> Maybe SExp -> SExp
- parseTimestamp :: SExp -> SExp -> Maybe SExp -> SExp
- timestampSeconds :: SExp -> SExp
- timestampMillis :: SExp -> SExp
- timestampMicros :: SExp -> SExp
- unixSeconds :: SExp -> SExp
- unixMillis :: SExp -> SExp
- unixMicros :: SExp -> SExp
- sessionUser :: SExp
- netIPFromString :: SExp -> SExp
- netSafeIPFromString :: SExp -> SExp
- netIPToString :: SExp -> SExp
- netIPNetMask :: SExp -> SExp -> SExp
- netIPTrunc :: SExp -> SExp -> SExp
- netIPV4FromInt64 :: SExp -> SExp
- netIPV4ToInt64 :: SExp -> SExp
- netHost :: SExp -> SExp
- netPublicSuffix :: SExp -> SExp
- netRegDomain :: SExp -> SExp
- coalesce :: [SExp] -> SExp
- ifnull :: SExp -> SExp -> SExp
- nullif :: SExp -> SExp -> SExp
- like :: SExp -> SExp -> SExp
- between :: SExp -> SExp -> SExp -> SExp
- scope :: SExp -> SExp -> SExp
- scoped :: SExp -> SExp -> SExp
- inferAgg :: SExp -> AggLevel
- unitBoundary :: SExp -> [SExp]
- modifyUnitBoundary :: (SExp -> SExp) -> SExp -> SExp
- bigQueryMeta :: BackendFunctionMeta
- bigQueryAggs :: [(Ref Function, SExp)]
- textInfix :: SExp -> SExp -> SExp
- nullIfEmpty :: SExp -> SExp
- seekBackIgnoreNulls :: SExp -> Int -> WOver -> SExp
- seekForwardIgnoreNulls :: SExp -> Int -> WOver -> SExp
- lagIgnoreNulls :: SExp -> Int -> WOver -> SExp
- leadIgnoreNulls :: SExp -> Int -> WOver -> SExp
- denseAvg :: SExp -> SExp
- weightedAvg :: SExp -> SExp -> SExp
- nzAvg :: SExp -> SExp
- percentDiff :: SExp -> SExp -> SExp
- data SubQueryTransformState = SubQueryTransformState {}
- subQueryTransformState_refs :: Lens' SubQueryTransformState RefStore
- subQueryTransformState_mapping :: Lens' SubQueryTransformState (Map SExp (Ref SExp))
- subqueryTransform :: Query -> Query
- humanAge :: SExp -> SExp -> SExp
Documentation
arrayAgg :: SExp -> [FunModifier] -> SExp #
bitXor :: SExp -> Distinctness -> SExp #
logicalAnd :: SExp -> SExp #
bqStddevPop :: SExp -> Distinctness -> Maybe WOver -> SExp #
bqStddevSamp :: SExp -> Distinctness -> Maybe WOver -> SExp #
bqVariance :: SExp -> Distinctness -> Maybe WOver -> SExp #
approxCountDistinct :: SExp -> SExp #
Approximate Aggregate Functions
approxQuantiles :: SExp -> Int -> Distinctness -> Maybe NullStrategy -> SExp #
approxTopCount :: SExp -> Int -> SExp #
hllPrecision :: Int -> HLLPrecision #
hllMergePartial :: SExp -> SExp #
hllExtract :: SExp -> SExp #
percentRank :: WOver -> SExp #
firstValue :: SExp -> WOver -> Maybe NullStrategy -> SExp #
percentileCont :: SExp -> Double -> [SExp] -> Maybe NullStrategy -> SExp #
ieeeDivide :: BinFunc #
Hash Functions
byteLength :: UFunc #
String Functions
charLength :: UFunc #
fromBase64 :: UFunc #
regexpContains :: SExp -> String -> SExp #
regexpExtract :: SExp -> String -> SExp #
regexpExtractAll :: SExp -> String -> SExp #
startsWith :: SExp -> SExp -> SExp #
toCodePoints :: UFunc #
JSON Functions
jsonPath_key :: String -> JSONPath #
jsonPath_index :: Int -> JSONPath #
renderJSONPath :: [JSONPath] -> String #
jsonExtract :: SExp -> [JSONPath] -> SExp #
jsonExtractScalar :: SExp -> [JSONPath] -> SExp #
arrayConcat :: NonEmpty SExp -> SExp #
Array Functions
arrayLength :: SExp -> SExp #
generateDateArray :: SExp -> SExp -> Maybe IntInterval -> SExp #
arrayReverse :: SExp -> SExp #
currentDate :: Maybe String -> SExp #
Date Functions
:: SExp | Date expression |
-> IntInterval | |
-> SExp |
:: SExp | Date expression |
-> IntInterval | |
-> SExp |
:: SExp | Datetime expression |
-> IntInterval | |
-> SExp |
:: SExp | Datetime expression |
-> IntInterval | |
-> SExp |
dateTimeTrunc :: DatePart -> SExp -> SExp #
currentTime :: SExp #
Time Functions
:: SExp | Time expression |
-> IntInterval | |
-> SExp |
:: SExp | Time expression |
-> IntInterval | |
-> SExp |
Timestamp Functions
timestampAdd :: SExp -> IntInterval -> SExp #
timestampSub :: SExp -> IntInterval -> SExp #
sessionUser :: SExp #
Security Functions
Like netIPFromString
but returns NULL rather than throwing on error.
unitBoundary :: SExp -> [SExp] #
bigQueryAggs :: [(Ref Function, SExp)] #
nullIfEmpty :: SExp -> SExp #
Replace empty string with NULL
seekBackIgnoreNulls :: SExp -> Int -> WOver -> SExp #
Use nthValue
under the hood with IgnoreNulls
, set window
frame to start at current row (so nth-value can index) and flip the
ordering in given OVER clause so that it semantically behaves like
lag
but with ignore nulls functionality.
It will start with current row, so setting to 1 will just return current row's value.
lagIgnoreNulls :: SExp -> Int -> WOver -> SExp #
BigQuery can't ignore nulls while lagging/leading. Use the
seekBackignorenulls
machinery intelligently to mimic a proper lag
with ignore nulls.
weightedAvg :: SExp -> SExp -> SExp #
percentDiff :: SExp -> SExp -> SExp #
percent difference of a
over b
with typecast to Double
subqueryTransform :: Query -> Query #
humanAge :: SExp -> SExp -> SExp #
Calculates the year-based human age given a "current date" and a date in the past. Returns float-based age. DATE_DIFF(CURRENT_DATE, cast('1990-01-01' as date), YEAR) + IF(EXTRACT(DAYOFYEAR FROM CURRENT_DATE) < EXTRACT(DAYOFYEAR FROM cast('1990-01-01' as date)), -1, 0)