From a9ce3b3d8e5b9eeeaa2dfa558b006c5575165404 Mon Sep 17 00:00:00 2001 From: Sal Date: Tue, 28 Nov 2023 14:31:26 -0500 Subject: [PATCH] update test with better struct test file --- .../Data/STRUCT_TEST1.parquet | Bin 946 -> 12898 bytes src/ParquetViewer.Tests/SanityTests.cs | 25 ++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/ParquetViewer.Tests/Data/STRUCT_TEST1.parquet b/src/ParquetViewer.Tests/Data/STRUCT_TEST1.parquet index 97cdddd70eeb493623ff17d2076a981744214180..1549dd3fd3aca0c298f9dd629f39441a7f920606 100644 GIT binary patch literal 12898 zcmdU0Z)hCH72iFbPG{*N%dU1=8DT4jeaMMc+53OziqwhI+72c)Zkh&~5cbcUeD(dy z-O8zJ4E_*G3Bd$Yj47c6K_Q<^NWYk1N(jc7Qi>7%&=1CxkOtFFA%xNoBJ|Dd?#$fo zO5Rm0*A?+;Z+71Ay?O7=ym{{_C!af&mjua>8Vk}iJfx)btg;`K^nzxT>#AjGNG+LV zO*OP?Nkugsm8!Lh)hKGwX34wfA0nC{2>DM(;d68jKK8@ED3Zdm_DWf9eQ6*hKMH*U zIq5SSg-JVWBk(zzbO_)R(6UmFN4xmLf4$HW1wl!BPZ-U6W}`s7>oAqxdk=UwMx^xw zL##~BAL;3RTh-tvubRbbQ7;>oS}Qj+wNx$F)LOob)G9J61x>5!`Ld~+Fm-Xz(R;mf zi$MG43bGXjqN!E0U?D>LrSufRey_7G9fq=~S#A8Hg;WugF z2z+-$6UBe1rcp8SWzA5F8sL>Gm4d2Ug__!E6bqK68}*7+2m?KIRJgxYfk1+pOIIUm z<;A1eT%7S!vz2LB!p>R(KBon`u3@9PvvwVJW{tsInEBikG5)jCv&>XV`nOeuIe9l7d+$ zon4ytW+-WI4rU!31=iypYjGq6KvU8*w+2yAL;*<2Z+m$+bzj#DpB5!IY(_T zB%>(TnZ@mxP~~2ngWU(*{+yKlI>PbG4DEzcu~0SZ)v8*k7Q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LpHIFM|3>) zRU?LEw1-Vai|qznip)R)iNU5P!f=`PGd;Nl-ya-_(|G~c6 z?$5cW>0Ev>uPx^1=8ctR%bL?`b*oWp)a%89Q9+GLrC78y_*>UHDr;ulsMf2Rfeb5u X5L*7Tg77%}C)|X;d_4*OcgcSNT|2Q( literal 946 zcmb7D%Wj)M6dhwkaOLfwL1JMc#Y!Xx1&nQKv8lRfv#FwN+o&4D5Tjsl25@9K-gXg1 z`I&rBex(;|FnvgE5RW@^&pCJIT;}q_m5C8{urt6S1QM1ta%5UVdvrFbg0X_&65wgK zkKnyaj}PGlm^QYX5?7%&r`#vv#fruyzg_U(ArU^sT*2OhfbC+p!R~ybE544x{FX=` zllY#ln+hFZ)&L0xI|vrkZ=bvAlJeW{sW)c}ibaIG#{v<WskM#+n?(X;iE=~F$;cD$+-e>TV diff --git a/src/ParquetViewer.Tests/SanityTests.cs b/src/ParquetViewer.Tests/SanityTests.cs index c4d254a..3490330 100644 --- a/src/ParquetViewer.Tests/SanityTests.cs +++ b/src/ParquetViewer.Tests/SanityTests.cs @@ -182,18 +182,21 @@ public async Task STRUCT_TYPE_TEST1() { using var parquetEngine = await ParquetEngine.OpenFileOrFolderAsync("Data/STRUCT_TEST1.parquet", default); - Assert.Equal(2, parquetEngine.RecordCount); - Assert.Equal(2, parquetEngine.Fields.Count); - - var dataTable = await parquetEngine.ReadRowsAsync(parquetEngine.Fields, 0, int.MaxValue, default); - Assert.IsType(dataTable.Rows[0][0]); - Assert.Equal("12345-6", (string)dataTable.Rows[0][0]); + Assert.Equal(10, parquetEngine.RecordCount); + Assert.Equal(6, parquetEngine.Fields.Count); + + //We currently only support three of the fields in this test file + string[] supportedFields = { "txn", "remove", "protocol" }; + var dataTable = await parquetEngine.ReadRowsAsync( + parquetEngine.Fields.Where(f => supportedFields.Contains(f)).ToList(), 0, int.MaxValue, default); + Assert.IsType(dataTable.Rows[0][0]); + Assert.Equal("{\"appId\":{},\"version\":0,\"lastUpdated\":{}}", ((StructValue)dataTable.Rows[0][0]).ToString()); Assert.IsType(dataTable.Rows[0][1]); - Assert.Equal("{\"firstName\":\"Ivan\",\"lastName\":\"Gavryliuk\"}", ((StructValue)dataTable.Rows[0][1]).ToString()); - Assert.IsType(dataTable.Rows[1][0]); - Assert.Equal("12345-7", (string)dataTable.Rows[1][0]); - Assert.IsType(dataTable.Rows[1][1]); - Assert.Equal("{\"firstName\":\"Richard\",\"lastName\":\"Conway\"}", ((StructValue)dataTable.Rows[1][1]).ToString()); + Assert.Equal("{\"path\":{},\"deletionTimestamp\":{},\"dataChange\":false}", ((StructValue)dataTable.Rows[0][1]).ToString()); + Assert.IsType(dataTable.Rows[0][2]); + Assert.Equal("{\"minReaderVersion\":1,\"minWriterVersion\":2}", ((StructValue)dataTable.Rows[0][2]).ToString()); + Assert.IsType(dataTable.Rows[9][2]); + Assert.Equal(DBNull.Value, dataTable.Rows[9][2]); } [Fact]