Skip to content

Commit b9f29d8

Browse files
authored
Merge 95ed437 into 682dadf
2 parents 682dadf + 95ed437 commit b9f29d8

23 files changed

+1218
-283
lines changed

.github/workflows/build-test-publish.yaml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Test and Publish
22

33
on:
44
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- ready_for_review
510

611
permissions:
712
checks: write
@@ -46,7 +51,7 @@ jobs:
4651
checkPublish:
4752
runs-on: windows-latest
4853
needs: test
49-
if: github.repository == 'mukunku/ParquetViewer'
54+
if: github.repository == 'mukunku/ParquetViewer' && github.event.pull_request.draft == false
5055
outputs:
5156
release_version: ${{ steps.release-version.outputs.release_version }}
5257
should_publish: ${{ steps.should-publish.outputs.should_publish }}
@@ -141,26 +146,9 @@ jobs:
141146
wait-for-completion: true
142147
output-artifact-directory: '/signed-package'
143148

144-
- name: Generate _checksums.txt
145-
run: |
146-
$fileHash = (Get-FileHash "signed-package/ParquetViewer.exe" -Algorithm SHA256)
147-
$fileHashSelfContained = (Get-FileHash "signed-package/ParquetViewer_SelfContained.exe" -Algorithm SHA256)
148-
$fileSize = (Get-Item -Path "signed-package/ParquetViewer.exe").Length
149-
$fileSizeSelfContained = (Get-Item -Path "signed-package/ParquetViewer_SelfContained.exe").Length
150-
"v${{ env.VERSION_NUMBER }}" >> "_checksums.txt"
151-
"" >> "_checksums.txt"
152-
"Name: ParquetViewer.exe" >> "_checksums.txt"
153-
"Size: $fileSize bytes ($([math]::floor($fileSize/1KB)) KiB)" >> "_checksums.txt"
154-
"SHA256: $($fileHash.Hash)" >> "_checksums.txt"
155-
"" >> "_checksums.txt"
156-
"Name: ParquetViewer_SelfContained.exe" >> "_checksums.txt"
157-
"Size: $fileSizeSelfContained bytes ($([math]::floor($fileSizeSelfContained/1MB)) MiB)" >> "_checksums.txt"
158-
"SHA256: $($fileHashSelfContained.Hash)" >> "_checksums.txt"
159-
"" >> "_checksums.txt"
160-
161149
- uses: ncipollo/release-action@v1
162150
with:
163-
artifacts: "signed-package/ParquetViewer.exe,signed-package/ParquetViewer_SelfContained.exe,_checksums.txt"
151+
artifacts: "signed-package/ParquetViewer.exe,signed-package/ParquetViewer_SelfContained.exe"
164152
body: "PR: #${{ env.PR_NUMBER }}"
165153
allowUpdates: ${{ env.BRANCH_NAME != 'main' }}
166154
omitBodyDuringUpdate: true

src/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="Apache.Arrow" Version="20.0.0" />
7-
<PackageVersion Include="Parquet.Net" Version="5.1.1" />
6+
<PackageVersion Include="Apache.Arrow" Version="21.0.0" />
7+
<PackageVersion Include="Parquet.Net" Version="5.2.0" />
88
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
99
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
1010
<PackageVersion Include="RichardSzalay.MockHttp" Version="7.0.0" />

src/ParquetViewer.Engine/DataTableLite.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Data;
1+
using ParquetViewer.Engine.Exceptions;
2+
using System.Data;
23

34
namespace ParquetViewer.Engine
45
{
@@ -83,8 +84,31 @@ public DataTable ToDataTable(CancellationToken token, IProgress<int>? progress =
8384
{
8485
token.ThrowIfCancellationRequested();
8586

86-
//supposedly this is the fastest way to load data into a datatable https://stackoverflow.com/a/17123914/1458738
87-
dataTable.LoadDataRow(_rows[i]!, false);
87+
try
88+
{
89+
//supposedly this is the fastest way to load data into a datatable https://stackoverflow.com/a/17123914/1458738
90+
dataTable.LoadDataRow(_rows[i]!, false);
91+
}
92+
catch (Exception ex)
93+
{
94+
if (ex.Message.Contains("Type of value has a mismatch with column type"))
95+
{
96+
//Try figure out where the mismatch is
97+
var columnIndex = 0;
98+
foreach (var column in this._columns.Values)
99+
{
100+
if (_rows[i][columnIndex] != DBNull.Value && column.Type != _rows[i][columnIndex].GetType())
101+
{
102+
throw new TypeMismatchException($"Value type '{_rows[i][columnIndex]?.GetType()}' doesn't match column type {column.Type} for field `{column.Name}`");
103+
}
104+
columnIndex++;
105+
}
106+
107+
throw new TypeMismatchException(null, ex);
108+
}
109+
110+
throw;
111+
}
88112

89113
progress?.Report(_columns.Count);
90114
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace ParquetViewer.Engine.Exceptions
2+
{
3+
public class TypeMismatchException : Exception
4+
{
5+
public TypeMismatchException(string? message, Exception? ex = null) : base(message, ex)
6+
{
7+
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)