Skip to content

Commit

Permalink
8FixWrappedStrings (#9)
Browse files Browse the repository at this point in the history
Changed logic for mapping Int to Double. Wrapped strings are also
PSObjects, hence all wrapped strings were converted to Double
  • Loading branch information
Agazoth authored Sep 22, 2024
1 parent 423bdcd commit 9be0641
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
Invoke-psake .\PSParquet.psake.ps1 Test -Verbose -Erroraction Stop
- name: Upload Build Artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v4
with:
name: PSParquet
path: ./output/
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
Invoke-psake .\PSParquet.psake.ps1 Test -Verbose -ErrorAction Stop
- name: Upload Build Artifact
uses: actions/upload-artifact@v2.2.3
uses: actions/upload-artifact@v4
with:
name: PSParquet
path: ./output/
Expand All @@ -76,7 +76,7 @@ jobs:
dotnet-version: 8.0.x

- name: Download build artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: PSParquet
path: Artifact/
Expand Down
4 changes: 2 additions & 2 deletions PSParquet/PSParquet.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Axel Bøg Andersen
#
# Generated on: 22/07/2024
# Generated on: 22/09/2024
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'PSParquet.psm1'

# Version number of this module.
ModuleVersion = '0.2.13'
ModuleVersion = '0.2.14'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
5 changes: 4 additions & 1 deletion Tests/PSParquet.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Describe "Module tests" {
IntWithNull = (($_ % 3 -eq 0) ? $null : $_)
Text = "Iteration $_"
}
}
} | Select-Object *,@{Name='WrappedString';Expression={'Wrapped {0}' -f $_.Text}}
Export-Parquet -FilePath $tempFile.FullName -InputObject $data -Force
$Content = Import-Parquet -FilePath $tempFile.FullName
}
Expand Down Expand Up @@ -40,6 +40,9 @@ Describe "Module tests" {
it "Test is a string" {
($Content[0].Text -is [String]) | Should -Be $true
}
it "WrappedString is a string" {
($Content[0].WrappedString -is [String]) | Should -Be $true
}

AfterAll {
Remove-Item $tempFile -Force
Expand Down
5 changes: 3 additions & 2 deletions src/PSParquet/PSParquet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ public static async Task<bool> WriteParquetFile(PSObject[] inputObject, string f
{
var properties = inputObject[0].Members.Where(w => w.GetType() == typeof(PSNoteProperty)).ToList();
bool dataIsValid = true;

List<ParquetData> parquetData = properties.Select(s => new ParquetData
{
Parameter = s.Name,
// Making sure ps-typed int32s have sufficient size for all objects
Type = inputObject[0].Properties[s.Name].Value is PSObject ? Type.GetType("System.Double") : Type.GetType(s.TypeNameOfValue),
Type = inputObject[0].Properties[s.Name].Value is PSObject && s.TypeNameOfValue == "System.Int32" ?
Type.GetType("System.Double") :
Type.GetType(s.TypeNameOfValue),
Data = (from o in inputObject select o.Properties[s.Name].Value).ToArray()
}).ToList();

Expand Down

0 comments on commit 9be0641

Please sign in to comment.