Skip to content

Commit

Permalink
fixing nullref
Browse files Browse the repository at this point in the history
  • Loading branch information
aloneguid committed Jan 10, 2024
1 parent 5e535e0 commit 6358d31
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 46 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Whether you want to build apps for Linux, MacOS, Windows, iOS, Android, Tizen, X

## UI

This repository now includes an implementation of parquet desktop viewer application called **Floor** (parquet floor, get it?). It's cross-platform, self-contained executable made with Avalonia, and is compiled for Linux, Windows and MacOS. You can download it from the releases section.
This repository now includes an implementation of parquet desktop viewer application called **Floor** (parquet floor, get it?). It's cross-platform, self-contained executable made with Avalonia, and is compiled for Linux, Windows and MacOS. You can download it from the [releases section](https://github.com/aloneguid/parquet-dotnet/releases).

**Floor** is not meant to be the best parquet viewer on the planet, but just a reference implementation. There are probably better, more feature-rich applications out there.

Expand Down
2 changes: 1 addition & 1 deletion src/Parquet.Floor/Parquet.Floor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AssemblyName>floor</AssemblyName>
<PublishTrimmed>false</PublishTrimmed>
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<ApplicationIcon>Assets/icon.ico</ApplicationIcon>
Expand Down
93 changes: 49 additions & 44 deletions src/Parquet.Floor/ViewModels/FileMetaDataViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,50 +269,55 @@ public FileMetaDataViewModel(FileMetaData? fm) {
for(int i = 0; i < rg.Columns.Count; i++) {
ColumnChunk cc = rg.Columns[i];

r.Add(new PropertyModel($"[{i}]", "") {
Children = Shrink(new ObservableCollection<PropertyModel> {
new PropertyModel(nameof(cc.FilePath), cc.FilePath),
new PropertyModel(nameof(cc.FileOffset), cc.FileOffset.ToString()),
new PropertyModel(nameof(cc.OffsetIndexOffset), cc.OffsetIndexOffset?.ToString()),
new PropertyModel(nameof(cc.OffsetIndexLength), cc.OffsetIndexLength?.ToString()),
new PropertyModel(nameof(cc.ColumnIndexOffset), cc.ColumnIndexOffset?.ToString()),
new PropertyModel(nameof(cc.ColumnIndexLength), cc.ColumnIndexLength?.ToString()),
new PropertyModel(nameof(cc.MetaData), "") {
Children = cc.MetaData == null
? null
: Shrink(new ObservableCollection<PropertyModel> {
new PropertyModel(nameof(cc.MetaData.Type), cc.MetaData.Type.ToString()),
new PropertyModel(nameof(cc.MetaData.Encodings), string.Join(';', cc.MetaData.Encodings.Select(e => e.ToString()))),
new PropertyModel(nameof(cc.MetaData.PathInSchema), string.Join('.', cc.MetaData.PathInSchema)),
new PropertyModel(nameof(cc.MetaData.Codec), cc.MetaData.Codec.ToString()),
new PropertyModel(nameof(cc.MetaData.NumValues), cc.MetaData.NumValues.ToString()),
new PropertyModel(nameof(cc.MetaData.TotalUncompressedSize), cc.MetaData.TotalUncompressedSize.ToString()),
new PropertyModel(nameof(cc.MetaData.TotalCompressedSize), cc.MetaData.TotalCompressedSize.ToString()),
new PropertyModel(nameof(cc.MetaData.KeyValueMetadata), cc.MetaData.KeyValueMetadata?.Count.ToString()) {
Children = cc.MetaData.KeyValueMetadata == null
? null
: new ObservableCollection<PropertyModel>(cc.MetaData.KeyValueMetadata.Select(kv => new PropertyModel(kv.Key, kv.Value)))
},
new PropertyModel(nameof(cc.MetaData.DataPageOffset), cc.MetaData.DataPageOffset.ToString()),
new PropertyModel(nameof(cc.MetaData.IndexPageOffset), cc.MetaData.IndexPageOffset?.ToString()),
new PropertyModel(nameof(cc.MetaData.DictionaryPageOffset), cc.MetaData.DictionaryPageOffset?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics), cc.MetaData.Statistics == null ? null : "") {
Children = Shrink(new ObservableCollection<PropertyModel> {
new PropertyModel(nameof(cc.MetaData.Statistics.NullCount), cc.MetaData.Statistics!.NullCount?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.DistinctCount), cc.MetaData.Statistics.DistinctCount?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.Min), cc.MetaData.Statistics.Min?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.Max), cc.MetaData.Statistics.Max?.ToString()),
})
},
new PropertyModel(nameof(cc.MetaData.EncodingStats), cc.MetaData.EncodingStats == null ? null : "") {
Children = MakeEncodingStats(cc.MetaData.EncodingStats)
},
new PropertyModel(nameof(cc.MetaData.BloomFilterOffset), cc.MetaData.BloomFilterOffset?.ToString()),
new PropertyModel(nameof(cc.MetaData.BloomFilterLength), cc.MetaData.BloomFilterLength?.ToString())
})
}
})
});
var root = new PropertyModel($"[{i}]", "");
root.Children = new ObservableCollection<PropertyModel>();
root.Children.Add(new PropertyModel(nameof(cc.FilePath), cc.FilePath));
root.Children.Add(new PropertyModel(nameof(cc.FileOffset), cc.FileOffset.ToString()));
root.Children.Add(new PropertyModel(nameof(cc.OffsetIndexOffset), cc.OffsetIndexOffset?.ToString()));
root.Children.Add(new PropertyModel(nameof(cc.OffsetIndexLength), cc.OffsetIndexLength?.ToString()));
root.Children.Add(new PropertyModel(nameof(cc.ColumnIndexOffset), cc.ColumnIndexOffset?.ToString()));
root.Children.Add(new PropertyModel(nameof(cc.ColumnIndexLength), cc.ColumnIndexLength?.ToString()));

if(cc.MetaData != null) {
var metadata = new PropertyModel(nameof(cc.MetaData), "");
metadata.Children = new ObservableCollection<PropertyModel>();
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.Type), cc.MetaData.Type.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.Encodings), string.Join(';', cc.MetaData.Encodings.Select(e => e.ToString()))));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.PathInSchema), string.Join('.', cc.MetaData.PathInSchema)));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.Codec), cc.MetaData.Codec.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.NumValues), cc.MetaData.NumValues.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.TotalUncompressedSize), cc.MetaData.TotalUncompressedSize.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.TotalCompressedSize), cc.MetaData.TotalCompressedSize.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.KeyValueMetadata), cc.MetaData.KeyValueMetadata?.Count.ToString()) {
Children = cc.MetaData.KeyValueMetadata == null
? null
: new ObservableCollection<PropertyModel>(cc.MetaData.KeyValueMetadata.Select(kv => new PropertyModel(kv.Key, kv.Value)))
});
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.DataPageOffset), cc.MetaData.DataPageOffset.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.IndexPageOffset), cc.MetaData.IndexPageOffset?.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.DictionaryPageOffset), cc.MetaData.DictionaryPageOffset?.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.Statistics), cc.MetaData.Statistics == null ? null : "") {
Children = cc.MetaData.Statistics == null
? null
: Shrink(new ObservableCollection<PropertyModel> {
new PropertyModel(nameof(cc.MetaData.Statistics.NullCount), cc.MetaData.Statistics!.NullCount?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.DistinctCount), cc.MetaData.Statistics.DistinctCount?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.Min), cc.MetaData.Statistics.Min?.ToString()),
new PropertyModel(nameof(cc.MetaData.Statistics.Max), cc.MetaData.Statistics.Max?.ToString()),
})
});
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.EncodingStats), cc.MetaData.EncodingStats == null ? null : "") {
Children = MakeEncodingStats(cc.MetaData.EncodingStats)
});
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.BloomFilterOffset), cc.MetaData.BloomFilterOffset?.ToString()));
metadata.Children.Add(new PropertyModel(nameof(cc.MetaData.BloomFilterLength), cc.MetaData.BloomFilterLength?.ToString()));
metadata.Children = Shrink(metadata.Children);
root.Children.Add(metadata);
}

root.Children = Shrink(root.Children);

r.Add(root);
}

return r;
Expand Down

0 comments on commit 6358d31

Please sign in to comment.