Skip to content

Commit

Permalink
Tidy up unused parameter and fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreeve committed Jun 10, 2022
1 parent d511a27 commit 2d6d797
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions csharp.test/TestLogicalTypeRoundtrip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ string GetRandomString() => string.Join(
var repLevels = new short[dataLength];
for (var i = 0; i < dataLength; ++i)
{
repLevels[i] = (short)(i % arrayLength == 0 ? 0 : 1);
repLevels[i] = (short) (i % arrayLength == 0 ? 0 : 1);
defLevels[i] = 3;
}

Expand All @@ -540,7 +540,7 @@ string GetRandomString() => string.Join(
propertiesBuilder.Compression(Compression.Snappy);
propertiesBuilder.DataPagesize(1024);
using var writerProperties = propertiesBuilder.Build();

using var fileWriter = new ParquetFileWriter(outStream, new Column[] {new Column<string[]>("a")},
writerProperties);
using var rowGroupWriter = fileWriter.AppendRowGroup();
Expand Down
16 changes: 9 additions & 7 deletions csharp/LogicalColumnReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public override int ReadBatch(Span<TElement> destination)
// Handle arrays
if (elementType != typeof(byte[]) && elementType.IsArray)
{
var result = (Span<TElement>) (TElement[]) ReadArray(schemaNodes, typeof(TElement), _converter, _bufferedReader, destination.Length, 0, definitionLevel);
var result = (Span<TElement>) (TElement[]) ReadArray(schemaNodes, typeof(TElement), _bufferedReader, destination.Length, 0, definitionLevel);
result.CopyTo(destination);
return result.Length;
}
Expand All @@ -208,8 +208,8 @@ public override int ReadBatch(Span<TElement> destination)
}

private static Array ReadArray(
ReadOnlySpan<Node> schemaNodes, Type elementType, LogicalRead<TLogical, TPhysical>.Converter converter,
BufferedReader<TLogical, TPhysical> valueReader, int numArrayEntriesToRead, short repetitionLevel, short definitionLevel)
ReadOnlySpan<Node> schemaNodes, Type elementType, BufferedReader<TLogical, TPhysical> valueReader,
int numArrayEntriesToRead, short repetitionLevel, short definitionLevel)
{
// Handle structs
var (definitionLevelDelta, schemaSlice) = StructSkip(schemaNodes);
Expand All @@ -223,7 +223,8 @@ private static Array ReadArray(
if (schemaNodes[0] is GroupNode {LogicalType: ListLogicalType, Repetition: Repetition.Optional} &&
schemaNodes[1] is GroupNode {LogicalType: NoneLogicalType, Repetition: Repetition.Repeated})
{
return ReadArrayIntermediateLevel(schemaNodes, valueReader, elementType, converter, numArrayEntriesToRead, repetitionLevel, definitionLevel);
return ReadArrayIntermediateLevel(
schemaNodes, valueReader, elementType, numArrayEntriesToRead, repetitionLevel, definitionLevel);
}
}

Expand All @@ -238,8 +239,9 @@ private static Array ReadArray(
throw new Exception("ParquetSharp does not understand the schema used");
}

private static Array ReadArrayIntermediateLevel(ReadOnlySpan<Node> schemaNodes, BufferedReader<TLogical, TPhysical> valueReader, Type elementType,
LogicalRead<TLogical, TPhysical>.Converter converter, int numArrayEntriesToRead, short repetitionLevel, short definitionLevel)
private static Array ReadArrayIntermediateLevel(
ReadOnlySpan<Node> schemaNodes, BufferedReader<TLogical, TPhysical> valueReader, Type elementType,
int numArrayEntriesToRead, short repetitionLevel, short definitionLevel)
{
var acc = new List<Array?>();

Expand All @@ -251,7 +253,7 @@ private static Array ReadArrayIntermediateLevel(ReadOnlySpan<Node> schemaNodes,

if (defn.DefLevel >= definitionLevel + 2)
{
newItem = ReadArray(schemaNodes.Slice(2), elementType.GetElementType(), converter, valueReader, -1, (short) (repetitionLevel + 1), (short) (definitionLevel + 2));
newItem = ReadArray(schemaNodes.Slice(2), elementType.GetElementType(), valueReader, -1, (short) (repetitionLevel + 1), (short) (definitionLevel + 2));
}
else
{
Expand Down

0 comments on commit 2d6d797

Please sign in to comment.