o
    Rh
                     @   s   d dl Z d dlmZmZmZ d dlmZ G dd deZG dd deZG dd	 d	ee j	d
Z
G dd de
ZG dd de
ZG dd de
ZdS )    N)FieldFunctionTerm)format_alias_sqlc                       s4   e Zd Zd	dededef fddZdd Z  ZS )
ArrayNvaluesconverter_optionsaliasc                    s(   t  | || _|| _|pt | _d S N)super__init___values_converter_clsdict_converter_options)selfr   converter_clsr   r	   	__class__ Y/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/pypika/clickhouse/array.pyr      s   zArray.__init__c                 C   sf   | j r(g }| jD ]}| j |fi | j}||  qddd|dg}nt| j}t|| jS )N [,])	r   r   r   appendget_sqljoinstrr   r	   )r   	convertedvalue	convertersqlr   r   r   r      s   

zArray.get_sql)NNN)	__name__
__module____qualname__listr   r   r   r   __classcell__r   r   r   r   r      s    r   c                	   @   s>   e Zd Z		ddepedepededefddZdd	d
ZdS )HasAnyN
left_arrayright_arrayr	   schemac                 C   s(   || _ || _|| _|| _d| _d| _d S )Nr   hasAny)_left_array_right_arrayr	   r+   argsname)r   r)   r*   r	   r+   r   r   r   r   !   s   
zHasAny.__init__Fc           	      K   sb   | j  }| j }dj| jt| j trd| n|t| jtr#d| n|d}t|| jfi |S )Nz{name}({left},{right})"%s")r0   leftright)	r-   r   r.   formatr0   
isinstancer   r   r	   )	r   
with_aliaswith_namespace
quote_chardialectkwargsr2   r3   r"   r   r   r   r   /   s   

zHasAny.get_sqlNN)FFNN)r#   r$   r%   r   r   r   r   r   r   r   r   r   r(       s    
r(   c                   @   sJ   e Zd Zddep	ededefddZddd	Zee	j
d
efddZdS )_AbstractArrayFunctionNarrayr	   r+   c                 C   s    || _ || _|  | _|| _d S r
   )r+   r	   clickhouse_functionr0   _array)r   r=   r	   r+   r   r   r   r   ;   s   

z_AbstractArrayFunction.__init__Fc                 K   sB   | j  }dj| jt| j trd| n|d}t|| jfi |S )Nz{name}({array})r1   )r0   r=   )r?   r   r4   r0   r5   r   r   r	   )r   r7   r8   r9   r:   r=   r"   r   r   r   r   A   s   
z_AbstractArrayFunction.get_sqlreturnc                 C   s   d S r
   r   clsr   r   r   r>   I   s   z*_AbstractArrayFunction.clickhouse_functionr;   )FNN)r#   r$   r%   r   r   r   r   r   classmethodabcabstractmethodr>   r   r   r   r   r<   :   s    
r<   )	metaclassc                   @      e Zd ZedefddZdS )NotEmptyr@   c                 C      dS )NnotEmptyr   rA   r   r   r   r>   P      zNotEmpty.clickhouse_functionNr#   r$   r%   rC   r   r>   r   r   r   r   rH   O       rH   c                   @   rG   )Emptyr@   c                 C   rI   )Nemptyr   rA   r   r   r   r>   V   rK   zEmpty.clickhouse_functionNrL   r   r   r   r   rN   U   rM   rN   c                   @   rG   )Lengthr@   c                 C   rI   )Nlengthr   rA   r   r   r   r>   \   rK   zLength.clickhouse_functionNrL   r   r   r   r   rP   [   rM   rP   )rD   pypika.termsr   r   r   pypika.utilsr   r   r(   ABCMetar<   rH   rN   rP   r   r   r   r   <module>   s    