Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ repos:
rm -f apache-arrow-dotnet.tar.gz"
always_run: true
pass_filenames: false
- id: format
name: Format
language: system
entry: |
dotnet format --exclude src/Apache.Arrow/Flatbuf/FlatBuffers/
always_run: true
pass_filenames: false
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Compression/Lz4CompressionCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Lz4CompressionCodec(int? compressionLevel = null)
{
_settings = new LZ4EncoderSettings
{
CompressionLevel = (LZ4Level) compressionLevel
CompressionLevel = (LZ4Level)compressionLevel
};
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/Apache.Arrow.Flight.Sql/DoPutResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public DoPutResult(FlightClientRecordBatchStreamWriter writer, IAsyncStreamReade
Writer = writer;
Reader = reader;
}

/// <summary>
/// Reads the metadata asynchronously from the reader.
/// </summary>
Expand All @@ -43,7 +43,7 @@ public DoPutResult(FlightClientRecordBatchStreamWriter writer, IAsyncStreamReade
}
throw new RpcException(new Status(StatusCode.Internal, "No metadata available in the response stream."));
}

/// <summary>
/// Completes the writer by signaling the end of the writing process.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight.Sql/FlightCallOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public FlightCallOptions()
{
Timeout = TimeSpan.FromSeconds(-1);
}

// Implement any necessary options for RPC calls
public Metadata Headers { get; set; } = new();

Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight.Sql/FlightExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ public static int ExtractRowCount(this RecordBatch batch)

return length;
}
}
}
6 changes: 3 additions & 3 deletions src/Apache.Arrow.Flight.Sql/FlightSqlServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ namespace Apache.Arrow.Flight.Sql;
public abstract class FlightSqlServer : FlightServer
{
private ILogger? Logger { get; }
public static readonly Schema CatalogSchema = new(new List<Field> {new("catalog_name", StringType.Default, false)}, null);
public static readonly Schema TableTypesSchema = new(new List<Field> {new("table_type", StringType.Default, false)}, null);
public static readonly Schema DbSchemaFlightSchema = new(new List<Field> {new("catalog_name", StringType.Default, true), new("db_schema_name", StringType.Default, false)}, null);
public static readonly Schema CatalogSchema = new(new List<Field> { new("catalog_name", StringType.Default, false) }, null);
public static readonly Schema TableTypesSchema = new(new List<Field> { new("table_type", StringType.Default, false) }, null);
public static readonly Schema DbSchemaFlightSchema = new(new List<Field> { new("catalog_name", StringType.Default, true), new("db_schema_name", StringType.Default, false) }, null);

public static readonly Schema PrimaryKeysSchema = new(new List<Field>
{
Expand Down
6 changes: 3 additions & 3 deletions src/Apache.Arrow.Flight.Sql/PreparedStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ public async Task<FlightInfo> ExecuteAsync(FlightCallOptions? options = default,
{
PreparedStatementHandle = ByteString.CopyFrom(_handle, Encoding.UTF8),
};

var descriptor = FlightDescriptor.CreateCommandDescriptor(command.PackAndSerialize());
cancellationToken.ThrowIfCancellationRequested();

if (_recordsBatch != null)
{
await BindParametersAsync(descriptor, _recordsBatch, options, cancellationToken).ConfigureAwait(false);
Expand Down Expand Up @@ -286,7 +286,7 @@ public async Task<long> ExecuteUpdateAsync(
{
throw new ArgumentNullException(nameof(parameterBatch), "Parameter batch cannot be null.");
}

var command = new CommandPreparedStatementQuery
{
PreparedStatementHandle = ByteString.CopyFrom(_handle, Encoding.UTF8),
Expand Down
6 changes: 3 additions & 3 deletions src/Apache.Arrow.Flight.Sql/SchemaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ public static Schema DeserializeSchema(ReadOnlyMemory<byte> serializedSchema)
using var reader = new ArrowStreamReader(serializedSchema);
return reader.Schema;
}

/// <summary>
/// Serializes the provided schema to a byte array.
/// </summary>
public static byte[] SerializeSchema(Schema schema)
{
using var memoryStream = new MemoryStream();
using var writer = new ArrowStreamWriter(memoryStream, schema);
writer.WriteStart();
writer.WriteStart();
writer.WriteEnd();
return memoryStream.ToArray();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Apache.Arrow.Flight.Protocol;
using Apache.Arrow.Flight.Internal;
using Apache.Arrow.Flight.Protocol;
using Grpc.Core;

namespace Apache.Arrow.Flight.Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Apache.Arrow.Flight.Protocol;
using Apache.Arrow.Flight.Internal;
using Apache.Arrow.Flight.Protocol;
using Grpc.Core;

namespace Apache.Arrow.Flight.Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// limitations under the License.

using System;
using Grpc.Core;
using System.Threading.Tasks;
using Grpc.Core;

namespace Apache.Arrow.Flight.Client
{
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/Extensions/FlightInfoExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Apache.Arrow.Flight.Extensions
public static class FlightInfoExtensions
{
public static ByteString ToByteString(this FlightInfo flightInfo)
{
{
return flightInfo.ToProtocol().ToByteString();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/FlightActionType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal Protocol.ActionType ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightActionType other)
if (obj is FlightActionType other)
{
return Equals(_actionType, other._actionType);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Apache.Arrow.Flight/FlightDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private FlightDescriptor(params string[] paths)
Type = Protocol.FlightDescriptor.Types.DescriptorType.Path
};

foreach(var path in paths)
foreach (var path in paths)
{
_flightDescriptor.Path.Add(path);
}
Expand All @@ -66,7 +66,7 @@ public static FlightDescriptor CreatePathDescriptor(params string[] paths)

internal FlightDescriptor(Protocol.FlightDescriptor flightDescriptor)
{
if(flightDescriptor.Type != Protocol.FlightDescriptor.Types.DescriptorType.Cmd && flightDescriptor.Type != Protocol.FlightDescriptor.Types.DescriptorType.Path)
if (flightDescriptor.Type != Protocol.FlightDescriptor.Types.DescriptorType.Cmd && flightDescriptor.Type != Protocol.FlightDescriptor.Types.DescriptorType.Path)
{
throw new NotSupportedException();
}
Expand All @@ -92,7 +92,7 @@ public override int GetHashCode()

public override bool Equals(object obj)
{
if(obj is FlightDescriptor other)
if (obj is FlightDescriptor other)
{
return Equals(_flightDescriptor, other._flightDescriptor);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Apache.Arrow.Flight/FlightEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal Protocol.FlightEndpoint ToProtocol()
Ticket = _ticket.ToProtocol()
};

foreach(var location in _locations)
foreach (var location in _locations)
{
output.Location.Add(location.ToProtocol());
}
Expand All @@ -56,7 +56,7 @@ internal Protocol.FlightEndpoint ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightEndpoint other)
if (obj is FlightEndpoint other)
{
return Equals(_ticket, other._ticket) &&
Enumerable.SequenceEqual(_locations, other._locations);
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/FlightHandshakeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal Protocol.HandshakeRequest ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightHandshakeRequest other)
if (obj is FlightHandshakeRequest other)
{
return Equals(_result, other._result);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Apache.Arrow.Flight/FlightInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal FlightInfo(Protocol.FlightInfo flightInfo)
Descriptor = new FlightDescriptor(flightInfo.FlightDescriptor);

var endpoints = new List<FlightEndpoint>();
foreach(var endpoint in flightInfo.Endpoint)
foreach (var endpoint in flightInfo.Endpoint)
{
endpoints.Add(new FlightEndpoint(endpoint));
}
Expand All @@ -41,11 +41,11 @@ internal FlightInfo(Protocol.FlightInfo flightInfo)
Ordered = flightInfo.Ordered;
AppMetadata = flightInfo.AppMetadata;
}
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1):this(schema,descriptor,endpoints,totalRecords,totalBytes,false, ByteString.Empty)
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords = -1, long totalBytes = -1) : this(schema, descriptor, endpoints, totalRecords, totalBytes, false, ByteString.Empty)
{
}

public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords, long totalBytes, bool ordered = false, ByteString appMetadata=null)
public FlightInfo(Schema schema, FlightDescriptor descriptor, IReadOnlyList<FlightEndpoint> endpoints, long totalRecords, long totalBytes, bool ordered = false, ByteString appMetadata = null)
{
Schema = schema;
Descriptor = descriptor;
Expand Down Expand Up @@ -81,7 +81,7 @@ internal Protocol.FlightInfo ToProtocol()
TotalBytes = TotalBytes,
TotalRecords = TotalRecords,
Ordered = Ordered,
AppMetadata = AppMetadata
AppMetadata = AppMetadata
};

foreach (var endpoint in Endpoints)
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/FlightLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal Protocol.Location ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightLocation other)
if (obj is FlightLocation other)
{
return Equals(_location, other._location);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/FlightResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal Protocol.Result ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightResult other)
if (obj is FlightResult other)
{
return Equals(_result, other._result);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/FlightTicket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ internal Protocol.Ticket ToProtocol()

public override bool Equals(object obj)
{
if(obj is FlightTicket other)
if (obj is FlightTicket other)
{
return Equals(_ticket, other._ticket);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Apache.Arrow.Flight/Internal/FlightDataStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task SendSchema()
{
_currentFlightData = new Protocol.FlightData();

if(_flightDescriptor != null)
if (_flightDescriptor != null)
{
_currentFlightData.FlightDescriptor = _flightDescriptor.ToProtocol();
}
Expand Down Expand Up @@ -76,7 +76,7 @@ public async Task Write(RecordBatch recordBatch, ByteString applicationMetadata)

_currentFlightData = new Protocol.FlightData();

if(applicationMetadata != null)
if (applicationMetadata != null)
{
_currentFlightData.AppMetadata = applicationMetadata;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override async ValueTask ReadSchemaAsync(CancellationToken cancellationTo

// AppMetadata will never be null, but length 0 if empty
// Those are skipped
if(_flightDataStream.Current.AppMetadata.Length > 0)
if (_flightDataStream.Current.AppMetadata.Length > 0)
{
_applicationMetadatas.Add(_flightDataStream.Current.AppMetadata);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow.Flight/Internal/SchemaWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void WriteSchema(Schema schema, CancellationToken cancellationToken)

public static ByteString SerializeSchema(Schema schema, CancellationToken cancellationToken = default(CancellationToken))
{
using(var memoryStream = new MemoryStream())
using (var memoryStream = new MemoryStream())
{
var writer = new SchemaWriter(memoryStream, schema);
writer.WriteSchema(schema, cancellationToken);
Expand Down
4 changes: 2 additions & 2 deletions src/Apache.Arrow/Arrays/ArrayData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Apache.Arrow.Memory;
using Apache.Arrow.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using Apache.Arrow.Memory;
using Apache.Arrow.Types;

namespace Apache.Arrow
{
Expand Down
8 changes: 4 additions & 4 deletions src/Apache.Arrow/Arrays/ArrayDataConcatenator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using Apache.Arrow.Memory;
using Apache.Arrow.Scalars;
using Apache.Arrow.Types;
using System;
using System.Collections.Generic;

namespace Apache.Arrow
{
Expand Down Expand Up @@ -329,11 +329,11 @@ private ArrowBuffer ConcatenateValidityBuffer()
{
if (arrayData.NullCount == 0)
{
builder.AppendRange(true , length);
builder.AppendRange(true, length);
}
else if (arrayData.NullCount == length)
{
builder.AppendRange(false , length);
builder.AppendRange(false, length);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow/Arrays/ArrayDataTypeComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private static bool CompareNested(NestedType expectedType, NestedType actualType
}
}

return true;
return true;
}

public void Visit(IArrowType actualType)
Expand Down
2 changes: 1 addition & 1 deletion src/Apache.Arrow/Arrays/ArrowArrayBuilderFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Apache.Arrow.Types;
using System;
using Apache.Arrow.Types;

namespace Apache.Arrow
{
Expand Down
8 changes: 4 additions & 4 deletions src/Apache.Arrow/Arrays/ArrowArrayConcatenator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Apache.Arrow.Memory;
using System.Collections.Generic;
using Apache.Arrow.Memory;

namespace Apache.Arrow
{
public static class ArrowArrayConcatenator
{
public static IArrowArray Concatenate(IReadOnlyList<IArrowArray> arrowArrayList , MemoryAllocator allocator = default)
public static IArrowArray Concatenate(IReadOnlyList<IArrowArray> arrowArrayList, MemoryAllocator allocator = default)
{
if(arrowArrayList == null || arrowArrayList.Count == 0)
if (arrowArrayList == null || arrowArrayList.Count == 0)
{
return null;
}
Expand All @@ -34,7 +34,7 @@ public static IArrowArray Concatenate(IReadOnlyList<IArrowArray> arrowArrayList

var arrayDataList = new List<ArrayData>(arrowArrayList.Count);

foreach(IArrowArray array in arrowArrayList)
foreach (IArrowArray array in arrowArrayList)
{
arrayDataList.Add(array.Data);
}
Expand Down
Loading
Loading