
    A>i                     B   S r SSKrSSKrSSKrSSKrSSKrSSKJr	  SSK
Jr  \R                  R                  r\R                  " S5      r\R                  " S5      r\R                  " S5      r\R&                  " S/ SQ5      r\R*                  S	 5       r " S
 S5      rg)z
Tests for the Apache Iceberg format.

Tests in this file use a simple Iceberg catalog based on SQLite, with the same
data used for Parquet tests (``pandas/tests/io/data/parquet/simple.parquet``).
    N)read_iceberg	pyicebergzpyiceberg.catalogzpyarrow.parquetCatalognameuri	warehousec           	   #     #    SU S3nSU 3n[        U S5      (       a  U R                  OS n[        R                  U=(       d    SSUUS9nUR	                  S5        [
        R                  [        R                  " [        5      R                  S	-  S
-  S-  5      nUR                  SUR                  S9nUR                  U5        Ubi  [        R                  R                  5       S-  n[        USSS9 n	U	R!                  SU SU SU 35        S S S 5        ["        R$                  " [        5        ['        U=(       d    SX#S9v   Ub  WR)                  5         g g ! , (       d  f       NR= f7f)Nz
sqlite:///z/catalog.sqlitezfile://paramdefaultsql)typer   r	   nsdataparquetzsimple.parquetns.my_table)schemaz.pyiceberg.yamlwzutf-8)encodingzcatalog:
  z:
    type: sql
    uri: z
    warehouse: r   )hasattrr   pyiceberg_catalogload_catalogcreate_namespacepq
read_tablepathlibPath__file__parentcreate_tabler   appendhomeopenwrite	importlibreloadr   unlink)
requesttmp_pathr   r	   catalog_namecatalogdftableconfig_pathfs
             [/var/www/html/land-tabula/venv/lib/python3.13/site-packages/pandas/tests/io/test_iceberg.pyr+   r+      sg     xj
0C($I$+GW$=$=7==4L,,!		 - G T"	X%%.:=MM
B   ryy AE	LLll''),==+sW5GG . 

 {  6 	*+
|0yc
OO   65s   C5E/7EAE/
E,(E/c                       \ rS rSrS r\R                  R                  SSS/SS9S 5       rS	 r	S
 r
S rS r\R                  R                  SSS/SS9S 5       rS rS rSrg)TestIcebergC   c                     [         R                  " / SQ/ SQS.5      n[        SSUR                  0S9n[        R
                  " X25        g )N         foor:   r:   ABr   r   catalog_propertiespd	DataFramer   r   tmassert_frame_equalselfr+   expectedresults       r0   	test_readTestIceberg.test_readD   sF    <<*
  %w{{3
 	f/    r+   r   pandas_testsT)indirectc                     [         R                  " / SQ/ SQS.5      n[        SUR                  S9n[        R
                  " X25        g )Nr5   r9   r;   r   r*   )rA   rB   r   r   rC   rD   rE   s       r0   test_read_by_catalog_name%TestIceberg.test_read_by_catalog_nameQ   sA    <<*
  
 	f/rK   c                     [         R                  " SS/SS/S.5      n[        SSUR                  0SS9n[        R
                  " X25        g )	Nr7   r8   r:   r;   r   r   zA > 1)r?   
row_filterr@   rE   s       r0   test_read_with_row_filter%TestIceberg.test_read_with_row_filter_   sQ    <<VU^
  %w{{3

 	f/rK   c                 .   [         R                  " S/ SQ05      n[        SSUR                  0S/SS9n[        R
                  " X25        [        R                  " [        SS	9   [        SSUR                  0S/S
S9  S S S 5        g ! , (       d  f       g = f)Nr<   r5   r   r   aF)r?   columnscase_sensitivez^Could not find column)matchT)	rA   rB   r   r   rC   rD   pytestraises
ValueErrorrE   s       r0   test_read_with_case_sensitive)TestIceberg.test_read_with_case_sensitivem   s    <<Y

  %w{{3E 	
 	f/]]:-EF$)7;;#7#	 GFFs   #B
Bc                     [         R                  " SS/SS/S.5      n[        SSUR                  0SS9n[        R
                  " X25        g )Nr6   r7   r:   r;   r   r   )r?   limitr@   rE   s       r0   test_read_with_limit TestIceberg.test_read_with_limit   sQ    <<VU^
  %w{{3

 	f/rK   c                     [         R                  " / SQ/ SQS.5      nUR                  SSUR                  0UR                  S9  [        SSUR                  0S9n[        R                  " X25        g )Nr5   r9   r;   ns.new_tabler   )r?   locationr>   rA   rB   
to_icebergr   r	   r   rC   rD   rF   r+   r,   rH   s       r0   
test_writeTestIceberg.test_write   sq    \\*
 	 %w{{3&& 	 	

  %w{{3
 	f)rK   c                     [         R                  " / SQ/ SQS.5      nUR                  SUR                  S9  [	        SUR                  S9n[
        R                  " X25        g )Nr5   r9   r;   re   rO   )rA   rB   rh   r   r   rC   rD   ri   s       r0   test_write_by_catalog_name&TestIceberg.test_write_by_catalog_name   s^    \\*
 	  	 	
  
 	f)rK   c                 >   [        SSUR                  0S9n[        R                  " / SQ/ SQS.5      n[        R                  " X#/SS9nUR                  SSUR                  0UR                  SS	9  [        SSUR                  0S9n[        R                  " XT5        g )
Nr   r   r>   r5   r9   r;   T)ignore_indexr?   rf   r!   )	r   r   rA   rB   concatrh   r	   rC   rD   )rF   r+   originalnewrG   rH   s         r0   *test_write_existing_table_with_append_true6TestIceberg.test_write_existing_table_with_append_true   s     %w{{3
 ll*
 99h_4@ %w{{3&&	 	 	
  %w{{3
 	f/rK   c                     [         R                  " / SQ/ SQS.5      nUR                  SSUR                  0UR                  SS9  [        SSUR                  0S9n[        R                  " X25        g )	Nr5   r9   r;   r   r   Frq   r>   rg   ri   s       r0   +test_write_existing_table_with_append_false7TestIceberg.test_write_existing_table_with_append_false   st    \\*
 	 %w{{3&&	 	 	
  %w{{3
 	f)rK    N)__name__
__module____qualname____firstlineno__rI   r[   markparametrizerP   rT   r^   rb   rj   rm   ru   rx   __static_attributes__rz   rK   r0   r2   r2   C   s    0 [[YN(CdS0 T00,0*$ [[YN(CdS* T*"00*rK   r2   )__doc__collectionsr%   r   r[   pandasrA   pandas._testing_testingrC   pandas.io.icebergr   r   
single_cpu
pytestmarkimportorskipr   r   r   
namedtupler   fixturer+   r2   rz   rK   r0   <module>r      s          *[[##
,	''(;< *+

 
 ,H
I # #L[* [*rK   