"""This file is auto-generated from _func.py by setup.py. Do not edit lines!"""

from .parts import Column


def CAST(type1, type2):
    return Column('CAST(%s)' % _actual_n('%s AS %s' % (type1, type2)))


def CONCAT(*args):
    arg = ['"%s"' % _actual_n(a) for a in args]
    arg = ', '.join(arg)
    return Column('CONCAT(%s)' % arg)


def _fn_factory(name):
    def _fn(*col):
        return Column('{0}({1})'.format(name, ','.join(_actual_n(x) for x in col)))
    return _fn


def _actual_n(col):
    if isinstance(col, str):
        return col
    elif isinstance(col, Column):
        return col.real_name
    else:
        return str(col)

BIT_COUNT = _fn_factory('BIT_COUNT')
JSON_EXTRACT = _fn_factory('JSON_EXTRACT')
JSON_EXTRACT_SCALAR = _fn_factory('JSON_EXTRACT_SCALAR')
IN = _fn_factory('IN')
COALESCE = _fn_factory('COALESCE')
GREATEST = _fn_factory('GREATEST')
IFNULL = _fn_factory('IFNULL')
IS_INF = _fn_factory('IS_INF')
IS_NAN = _fn_factory('IS_NAN')
IS_EXPLICITLY_DEFINED = _fn_factory('IS_EXPLICITLY_DEFINED')
LEAST = _fn_factory('LEAST')
NVL = _fn_factory('NVL')
REGEXP_MATCH = _fn_factory('REGEXP_MATCH')
REGEXP_EXTRACT = _fn_factory('REGEXP_EXTRACT')
REGEXP_REPLACE = _fn_factory('REGEXP_REPLACE')
ABS = _fn_factory('ABS')
ACOS = _fn_factory('ACOS')
ACOSH = _fn_factory('ACOSH')
ASIN = _fn_factory('ASIN')
ASINH = _fn_factory('ASINH')
ATAN = _fn_factory('ATAN')
ATANH = _fn_factory('ATANH')
ATAN2 = _fn_factory('ATAN2')
CEIL = _fn_factory('CEIL')
COS = _fn_factory('COS')
COSH = _fn_factory('COSH')
DEGREES = _fn_factory('DEGREES')
EXP = _fn_factory('EXP')
FLOOR = _fn_factory('FLOOR')
LN = _fn_factory('LN')
LOG = _fn_factory('LOG')
LOG2 = _fn_factory('LOG2')
LOG10 = _fn_factory('LOG10')
PI = _fn_factory('PI')
POW = _fn_factory('POW')
RADIANS = _fn_factory('RADIANS')
RAND = _fn_factory('RAND')
ROUND = _fn_factory('ROUND')
SIN = _fn_factory('SIN')
SINH = _fn_factory('SINH')
SQRT = _fn_factory('SQRT')
TAN = _fn_factory('TAN')
TANH = _fn_factory('TANH')
FORMAT_IP = _fn_factory('FORMAT_IP')
PARSE_IP = _fn_factory('PARSE_IP')
FORMAT_PACKED_IP = _fn_factory('FORMAT_PACKED_IP')
PARSE_PACKED_IP = _fn_factory('PARSE_PACKED_IP')
HOST = _fn_factory('HOST')
DOMAIN = _fn_factory('DOMAIN')
TLD = _fn_factory('TLD')
CUME_DIST = _fn_factory('CUME_DIST')
DENSE_RANK = _fn_factory('DENSE_RANK')
FIRST_VALUE = _fn_factory('FIRST_VALUE')
LAG = _fn_factory('LAG')
LAST_VALUE = _fn_factory('LAST_VALUE')
LEAD = _fn_factory('LEAD')
NTH_VALUE = _fn_factory('NTH_VALUE')
NTILE = _fn_factory('NTILE')
PERCENT_RANK = _fn_factory('PERCENT_RANK')
PERCENTILE_CONT = _fn_factory('PERCENTILE_CONT')
PERCENTILE_DISC = _fn_factory('PERCENTILE_DISC')
RANK = _fn_factory('RANK')
RATIO_TO_REPORT = _fn_factory('RATIO_TO_REPORT')
ROW_NUMBER = _fn_factory('ROW_NUMBER')
CURRENT_USER = _fn_factory('CURRENT_USER')
EVERY = _fn_factory('EVERY')
HASH = _fn_factory('HASH')
IF = _fn_factory('IF')
POSITION = _fn_factory('POSITION')
SOME = _fn_factory('SOME')
AVG = _fn_factory('AVG')
BIT_AND = _fn_factory('BIT_AND')
BIT_OR = _fn_factory('BIT_OR')
BIT_XOR = _fn_factory('BIT_XOR')
CORR = _fn_factory('CORR')
COUNT = _fn_factory('COUNT')
COVAR_POP = _fn_factory('COVAR_POP')
COVAR_SAMP = _fn_factory('COVAR_SAMP')
EXACT_COUNT_DISTINCT = _fn_factory('EXACT_COUNT_DISTINCT')
FIRST = _fn_factory('FIRST')
GROUP_CONCAT = _fn_factory('GROUP_CONCAT')
GROUP_CONCAT_UNQUOTED = _fn_factory('GROUP_CONCAT_UNQUOTED')
LAST = _fn_factory('LAST')
MAX = _fn_factory('MAX')
MIN = _fn_factory('MIN')
NEST = _fn_factory('NEST')
NTH = _fn_factory('NTH')
QUANTILES = _fn_factory('QUANTILES')
STDDEV = _fn_factory('STDDEV')
STDDEV_POP = _fn_factory('STDDEV_POP')
STDDEV_SAMP = _fn_factory('STDDEV_SAMP')
SUM = _fn_factory('SUM')
TOP = _fn_factory('TOP')
UNIQUE = _fn_factory('UNIQUE')
VARIANCE = _fn_factory('VARIANCE')
VAR_POP = _fn_factory('VAR_POP')
VAR_SAMP = _fn_factory('VAR_SAMP')
CURRENT_DATE = _fn_factory('CURRENT_DATE')
CURRENT_TIME = _fn_factory('CURRENT_TIME')
CURRENT_TIMESTAMP = _fn_factory('CURRENT_TIMESTAMP')
DATE = _fn_factory('DATE')
DATE_ADD = _fn_factory('DATE_ADD')
DATEDIFF = _fn_factory('DATEDIFF')
DAY = _fn_factory('DAY')
DAYOFWEEK = _fn_factory('DAYOFWEEK')
DAYOFYEAR = _fn_factory('DAYOFYEAR')
FORMAT_UTC_USEC = _fn_factory('FORMAT_UTC_USEC')
HOUR = _fn_factory('HOUR')
MINUTE = _fn_factory('MINUTE')
MONTH = _fn_factory('MONTH')
MSEC_TO_TIMESTAMP = _fn_factory('MSEC_TO_TIMESTAMP')
NOW = _fn_factory('NOW')
PARSE_UTC_USEC = _fn_factory('PARSE_UTC_USEC')
QUARTER = _fn_factory('QUARTER')
SEC_TO_TIMESTAMP = _fn_factory('SEC_TO_TIMESTAMP')
SECOND = _fn_factory('SECOND')
STRFTIME_UTC_USEC = _fn_factory('STRFTIME_UTC_USEC')
TIME = _fn_factory('TIME')
TIMESTAMP = _fn_factory('TIMESTAMP')
TIMESTAMP_TO_MSEC = _fn_factory('TIMESTAMP_TO_MSEC')
TIMESTAMP_TO_SEC = _fn_factory('TIMESTAMP_TO_SEC')
TIMESTAMP_TO_USEC = _fn_factory('TIMESTAMP_TO_USEC')
USEC_TO_TIMESTAMP = _fn_factory('USEC_TO_TIMESTAMP')
UTC_USEC_TO_DAY = _fn_factory('UTC_USEC_TO_DAY')
UTC_USEC_TO_HOUR = _fn_factory('UTC_USEC_TO_HOUR')
UTC_USEC_TO_MONTH = _fn_factory('UTC_USEC_TO_MONTH')
UTC_USEC_TO_WEEK = _fn_factory('UTC_USEC_TO_WEEK')
UTC_USEC_TO_YEAR = _fn_factory('UTC_USEC_TO_YEAR')
WEEK = _fn_factory('WEEK')
YEAR = _fn_factory('YEAR')
TABLE_DATE_RANGE = _fn_factory('TABLE_DATE_RANGE')
TABLE_DATE_RANGE_STRICT = _fn_factory('TABLE_DATE_RANGE_STRICT')
TABLE_QUERY = _fn_factory('TABLE_QUERY')
BOOLEAN = _fn_factory('BOOLEAN')
FLOAT = _fn_factory('FLOAT')
HEX_STRING = _fn_factory('HEX_STRING')
INTEGER = _fn_factory('INTEGER')
STRING = _fn_factory('STRING')
INSTR = _fn_factory('INSTR')
LEFT = _fn_factory('LEFT')
LENGTH = _fn_factory('LENGTH')
LOWER = _fn_factory('LOWER')
LPAD = _fn_factory('LPAD')
LTRIM = _fn_factory('LTRIM')
REPLACE = _fn_factory('REPLACE')
RIGHT = _fn_factory('RIGHT')
RPAD = _fn_factory('RPAD')
RTRIM = _fn_factory('RTRIM')
SPLIT = _fn_factory('SPLIT')
SUBSTR = _fn_factory('SUBSTR')
UPPER = _fn_factory('UPPER')
