Skip to content

Commit 96592ec

Browse files
committed
feat(BigQuery): Add BqSchemaToStorageTableSchema, StorageTableSchemaToBqSchema, NormalizeDescriptor, StorageSchemaToProtoDescriptor
1 parent aa7e28e commit 96592ec

14 files changed

+1952
-1
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@
5858
<PackageVersion Include="NLog" Version="5.5.1" />
5959
<PackageVersion Include="Grpc.AspNetCore" Version="2.40.0" />
6060
<PackageVersion Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.0" />
61+
<PackageVersion Include="Grpc.Tools" Version="2.61.0" />
6162
</ItemGroup>
6263
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Google.Cloud.ClientTesting;
16+
using Xunit;
17+
18+
namespace Google.Cloud.BigQuery.Storage.V1.IntegrationTests
19+
{
20+
[CollectionDefinition(nameof(BigQueryStorageFixture))]
21+
public class BigQueryStorageFixture : CloudProjectFixtureBase, ICollectionFixture<BigQueryStorageFixture>
22+
{
23+
24+
public BigQueryStorageFixture()
25+
{
26+
}
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0;net462</TargetFrameworks>
5+
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">net8.0</TargetFrameworks>
6+
<IsPackable>false</IsPackable>
7+
<NoWarn>1701;1702;1705;xUnit2004;xUnit2013</NoWarn>
8+
</PropertyGroup>
9+
<ItemGroup>
10+
<ProjectReference Include="..\Google.Cloud.BigQuery.Storage.V1\Google.Cloud.BigQuery.Storage.V1.csproj" />
11+
<ProjectReference Include="..\..\..\tools\Google.Cloud.ClientTesting\Google.Cloud.ClientTesting.csproj" />
12+
<PackageReference Include="Microsoft.NET.Test.Sdk" />
13+
<PackageReference Include="NSubstitute" />
14+
<PackageReference Include="System.Linq.Async" />
15+
<PackageReference Include="Xunit.Combinatorial" />
16+
<PackageReference Include="Xunit.SkippableFact" />
17+
<PackageReference Include="xunit" />
18+
<PackageReference Include="xunit.runner.visualstudio" />
19+
<PackageReference Include="Google.Protobuf" />
20+
<PackageReference Include="Grpc.Tools" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" PrivateAssets="all" />
21+
<PackageReference Include="Google.Cloud.BigQuery.V2" VersionOverride="[3.11.0, 4.0.0)" />
22+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
23+
</ItemGroup>
24+
<ItemGroup>
25+
<Protobuf Include="Protos\simple_test.proto" GrpcServices="None" />
26+
<Protobuf Include="Protos\complex_test.proto" GrpcServices="None" />
27+
<Protobuf Include="Protos\recursive_test.proto" GrpcServices="None" />
28+
<Protobuf Include="Protos\oneof_test.proto" GrpcServices="None" />
29+
<Protobuf Include="Protos\business_test.proto" GrpcServices="None" />
30+
</ItemGroup>
31+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
syntax = "proto3";
2+
3+
import "google/protobuf/wrappers.proto";
4+
5+
package Google.Cloud.BigQuery.Storage.V1.IntegrationTests;
6+
7+
message BusinessChangedEvent {
8+
Business business = 1;
9+
}
10+
11+
message Business {
12+
string id = 1;
13+
google.protobuf.StringValue finance_email = 9;
14+
bool disabled = 19;
15+
bool active = 24;
16+
BusinessStatus status = 18;
17+
repeated string tags = 27;
18+
string meta_ts = 11;
19+
int64 meta_op = 12;
20+
}
21+
22+
enum BusinessStatus {
23+
BUSINESS_STATUS_UNDEFINED = 0;
24+
BUSINESS_STATUS_IN_REVIEW = 1;
25+
BUSINESS_STATUS_APPROVED = 2;
26+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
syntax = "proto3";
2+
3+
package Google.Cloud.BigQuery.Storage.V1.IntegrationTests;
4+
5+
import "google/protobuf/timestamp.proto";
6+
7+
message ComplexTestMessage {
8+
string id = 1;
9+
int32 count = 2;
10+
bool is_active = 3;
11+
google.protobuf.Timestamp created_at = 4;
12+
bytes data = 5;
13+
repeated string tags = 6;
14+
NestedMessage nested_field = 7;
15+
repeated NestedMessage repeated_nested_field = 8;
16+
Status status = 9;
17+
}
18+
19+
message NestedMessage {
20+
string name = 1;
21+
double score = 2;
22+
}
23+
24+
enum Status {
25+
STATUS_UNSPECIFIED = 0;
26+
ACTIVE = 1;
27+
INACTIVE = 2;
28+
PENDING = 3;
29+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
syntax = "proto3";
2+
3+
package Google.Cloud.BigQuery.Storage.V1.IntegrationTests;
4+
5+
message OneOfTestMessage {
6+
optional string optional_field = 1;
7+
8+
oneof my_oneof {
9+
string oneof_string = 2;
10+
int32 oneof_int32 = 3;
11+
}
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
syntax = "proto3";
2+
3+
package Google.Cloud.BigQuery.Storage.V1.IntegrationTests;
4+
5+
message RecursiveMessage {
6+
string name = 1;
7+
RecursiveMessage recursive_field = 2;
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
syntax = "proto3";
2+
3+
package Google.Cloud.BigQuery.Storage.V1.IntegrationTests;
4+
5+
message SimpleTestMessage {
6+
string name = 1;
7+
int64 value = 2;
8+
}

0 commit comments

Comments
 (0)