1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
// This file is @generated by prost-build.
/// Schema description of a metastore partition column.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FieldSchema {
/// Required. The name of the column.
/// The maximum length of the name is 1024 characters
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Required. The type of the metastore partition column. Maximum allowed
/// length is 1024 characters.
#[prost(string, tag = "2")]
pub r#type: ::prost::alloc::string::String,
}
/// Contains information about the physical storage of the data in the metastore
/// partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StorageDescriptor {
/// Optional. The physical location of the metastore partition
/// (e.g. `gs://spark-dataproc-data/pangea-data/case_sensitive/` or
/// `gs://spark-dataproc-data/pangea-data/*`).
#[prost(string, tag = "1")]
pub location_uri: ::prost::alloc::string::String,
/// Optional. Specifies the fully qualified class name of the InputFormat
/// (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat").
/// The maximum length is 128 characters.
#[prost(string, tag = "2")]
pub input_format: ::prost::alloc::string::String,
/// Optional. Specifies the fully qualified class name of the OutputFormat
/// (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat").
/// The maximum length is 128 characters.
#[prost(string, tag = "3")]
pub output_format: ::prost::alloc::string::String,
/// Optional. Serializer and deserializer information.
#[prost(message, optional, tag = "4")]
pub serde_info: ::core::option::Option<SerDeInfo>,
}
/// Serializer and deserializer information.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SerDeInfo {
/// Optional. Name of the SerDe.
/// The maximum length is 256 characters.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Required. Specifies a fully-qualified class name of the serialization
/// library that is responsible for the translation of data between table
/// representation and the underlying low-level input and output format
/// structures. The maximum length is 256 characters.
#[prost(string, tag = "2")]
pub serialization_library: ::prost::alloc::string::String,
/// Optional. Key-value pairs that define the initialization parameters for the
/// serialization library.
/// Maximum size 10 Kib.
#[prost(btree_map = "string, string", tag = "3")]
pub parameters: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
/// Information about a Hive partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetastorePartition {
/// Required. Represents the values of the partition keys, where each value
/// corresponds to a specific partition key in the order in which the keys are
/// defined. Each value is limited to 1024 characters.
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Output only. The creation time of the partition.
#[prost(message, optional, tag = "2")]
pub create_time: ::core::option::Option<::prost_types::Timestamp>,
/// Optional. Contains information about the physical storage of the data in
/// the partition.
#[prost(message, optional, tag = "3")]
pub storage_descriptor: ::core::option::Option<StorageDescriptor>,
/// Optional. Additional parameters or metadata associated with the partition.
/// Maximum size 10 KiB.
#[prost(btree_map = "string, string", tag = "4")]
pub parameters: ::prost::alloc::collections::BTreeMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Optional. List of columns.
#[prost(message, repeated, tag = "5")]
pub fields: ::prost::alloc::vec::Vec<FieldSchema>,
}
/// List of metastore partitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetastorePartitionList {
/// Required. List of partitions.
#[prost(message, repeated, tag = "1")]
pub partitions: ::prost::alloc::vec::Vec<MetastorePartition>,
}
/// Information about a single stream that is used to read partitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadStream {
/// Output only. Identifier. Name of the stream, in the form
/// `projects/{project_id}/locations/{location}/sessions/{session_id}/streams/{stream_id}`.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
/// List of streams.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamList {
/// Output only. List of streams.
#[prost(message, repeated, tag = "1")]
pub streams: ::prost::alloc::vec::Vec<ReadStream>,
}
/// Represents the values of a metastore partition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetastorePartitionValues {
/// Required. The values of the partition keys, where each value corresponds to
/// a specific partition key in the order in which the keys are defined.
#[prost(string, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Request message for CreateMetastorePartition. The MetastorePartition is
/// uniquely identified by values, which is an ordered list. Hence, there is no
/// separate name or partition id field.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateMetastorePartitionRequest {
/// Required. Reference to the table to where the metastore partition to be
/// added, in the format of
/// projects/{project}/databases/{databases}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The metastore partition to be added.
#[prost(message, optional, tag = "2")]
pub metastore_partition: ::core::option::Option<MetastorePartition>,
}
/// Request message for BatchCreateMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateMetastorePartitionsRequest {
/// Required. Reference to the table to where the metastore partitions to be
/// added, in the format of
/// projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Requests to add metastore partitions to the table.
#[prost(message, repeated, tag = "2")]
pub requests: ::prost::alloc::vec::Vec<CreateMetastorePartitionRequest>,
/// Optional. Mimics the ifNotExists flag in IMetaStoreClient
/// add_partitions(..). If the flag is set to false, the server will return
/// ALREADY_EXISTS if any partition already exists. If the flag is set to true,
/// the server will skip existing partitions and insert only the non-existing
/// partitions.
#[prost(bool, tag = "3")]
pub skip_existing_partitions: bool,
}
/// Response message for BatchCreateMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchCreateMetastorePartitionsResponse {
/// The list of metastore partitions that have been created.
#[prost(message, repeated, tag = "1")]
pub partitions: ::prost::alloc::vec::Vec<MetastorePartition>,
}
/// Request message for BatchDeleteMetastorePartitions. The MetastorePartition is
/// uniquely identified by values, which is an ordered list. Hence, there is no
/// separate name or partition id field.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchDeleteMetastorePartitionsRequest {
/// Required. Reference to the table to which these metastore partitions
/// belong, in the format of
/// projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. The list of metastore partitions (identified by its values) to be
/// deleted. A maximum of 100 partitions can be deleted in a batch.
#[prost(message, repeated, tag = "2")]
pub partition_values: ::prost::alloc::vec::Vec<MetastorePartitionValues>,
}
/// Request message for UpdateMetastorePartition.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateMetastorePartitionRequest {
/// Required. The metastore partition to be updated.
#[prost(message, optional, tag = "1")]
pub metastore_partition: ::core::option::Option<MetastorePartition>,
/// Optional. The list of fields to update.
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
/// Request message for BatchUpdateMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchUpdateMetastorePartitionsRequest {
/// Required. Reference to the table to which these metastore partitions
/// belong, in the format of
/// projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Required. Requests to update metastore partitions in the table.
#[prost(message, repeated, tag = "2")]
pub requests: ::prost::alloc::vec::Vec<UpdateMetastorePartitionRequest>,
}
/// Response message for BatchUpdateMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchUpdateMetastorePartitionsResponse {
/// The list of metastore partitions that have been updated.
#[prost(message, repeated, tag = "1")]
pub partitions: ::prost::alloc::vec::Vec<MetastorePartition>,
}
/// Request message for ListMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListMetastorePartitionsRequest {
/// Required. Reference to the table to which these metastore partitions
/// belong, in the format of
/// projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Optional. SQL text filtering statement, similar to a WHERE clause in a
/// query. Only supports single-row expressions. Aggregate functions are not
/// supported.
///
/// Examples: "int_field > 5"
/// "date_field = CAST('2014-9-27' as DATE)"
/// "nullable_field is not NULL"
/// "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))"
/// "numeric_field BETWEEN 1.0 AND 5.0"
/// Restricted to a maximum length for 1 MB.
#[prost(string, tag = "2")]
pub filter: ::prost::alloc::string::String,
}
/// Response message for ListMetastorePartitions.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListMetastorePartitionsResponse {
/// The response depends on the number of metastore partitions to be returned;
/// it can be a list of partitions or a list of
/// [ReadStream]((<https://cloud.google.com/bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1#readstream>))
/// objects. For the second situation, the BigQuery [Read API
/// ReadRows](<https://cloud.google.com/bigquery/docs/reference/storage#read_from_a_session_stream>)
/// method must be used to stream the data and convert it into a list of
/// partitions.
#[prost(oneof = "list_metastore_partitions_response::Response", tags = "1, 2")]
pub response: ::core::option::Option<list_metastore_partitions_response::Response>,
}
/// Nested message and enum types in `ListMetastorePartitionsResponse`.
pub mod list_metastore_partitions_response {
/// The response depends on the number of metastore partitions to be returned;
/// it can be a list of partitions or a list of
/// [ReadStream]((<https://cloud.google.com/bigquery/docs/reference/storage/rpc/google.cloud.bigquery.storage.v1#readstream>))
/// objects. For the second situation, the BigQuery [Read API
/// ReadRows](<https://cloud.google.com/bigquery/docs/reference/storage#read_from_a_session_stream>)
/// method must be used to stream the data and convert it into a list of
/// partitions.
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
/// The list of partitions.
#[prost(message, tag = "1")]
Partitions(super::MetastorePartitionList),
/// The list of streams.
#[prost(message, tag = "2")]
Streams(super::StreamList),
}
}
/// The top-level message sent by the client to the
/// [Partitions.StreamMetastorePartitions][] method.
/// Follows the default gRPC streaming maximum size of 4 MB.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamMetastorePartitionsRequest {
/// Required. Reference to the table to where the partition to be added, in the
/// format of
/// projects/{project}/locations/{location}/datasets/{dataset}/tables/{table}.
#[prost(string, tag = "1")]
pub parent: ::prost::alloc::string::String,
/// Optional. A list of metastore partitions to be added to the table.
#[prost(message, repeated, tag = "2")]
pub metastore_partitions: ::prost::alloc::vec::Vec<MetastorePartition>,
/// Optional. Mimics the ifNotExists flag in IMetaStoreClient
/// add_partitions(..). If the flag is set to false, the server will return
/// ALREADY_EXISTS on commit if any partition already exists. If the flag is
/// set to true:
/// 1) the server will skip existing partitions
/// insert only the non-existing partitions as part of the commit.
/// 2) The client must set the `skip_existing_partitions` field to true for
/// all requests in the stream.
#[prost(bool, tag = "3")]
pub skip_existing_partitions: bool,
}
/// This is the response message sent by the server
/// to the client for the [Partitions.StreamMetastorePartitions][] method when
/// the commit is successful. Server will close the stream after sending this
/// message.
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StreamMetastorePartitionsResponse {
/// Total count of partitions streamed by the client during the lifetime of the
/// stream. This is only set in the final response message before closing the
/// stream.
#[prost(int64, tag = "2")]
pub total_partitions_streamed_count: i64,
/// Total count of partitions inserted by the server during the lifetime of the
/// stream. This is only set in the final response message before closing the
/// stream.
#[prost(int64, tag = "3")]
pub total_partitions_inserted_count: i64,
}
/// Structured custom error message for batch size too large error.
/// The error can be attached as error details in the returned rpc Status for
/// more structured error handling in the client.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchSizeTooLargeError {
/// The maximum number of items that are supported in a single batch. This is
/// returned as a hint to the client to adjust the batch size.
#[prost(int64, tag = "1")]
pub max_batch_size: i64,
/// Optional. The error message that is returned to the client.
#[prost(string, tag = "2")]
pub error_message: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod metastore_partition_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// BigQuery Metastore Partition Service API.
/// This service is used for managing metastore partitions in BigQuery metastore.
/// The service supports only batch operations for write.
#[derive(Debug, Clone)]
pub struct MetastorePartitionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl<T> MetastorePartitionServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> MetastorePartitionServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
MetastorePartitionServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// Adds metastore partitions to a table.
pub async fn batch_create_metastore_partitions(
&mut self,
request: impl tonic::IntoRequest<
super::BatchCreateMetastorePartitionsRequest,
>,
) -> std::result::Result<
tonic::Response<super::BatchCreateMetastorePartitionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.storage.v1alpha.MetastorePartitionService/BatchCreateMetastorePartitions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.bigquery.storage.v1alpha.MetastorePartitionService",
"BatchCreateMetastorePartitions",
),
);
self.inner.unary(req, path, codec).await
}
/// Deletes metastore partitions from a table.
pub async fn batch_delete_metastore_partitions(
&mut self,
request: impl tonic::IntoRequest<
super::BatchDeleteMetastorePartitionsRequest,
>,
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.storage.v1alpha.MetastorePartitionService/BatchDeleteMetastorePartitions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.bigquery.storage.v1alpha.MetastorePartitionService",
"BatchDeleteMetastorePartitions",
),
);
self.inner.unary(req, path, codec).await
}
/// Updates metastore partitions in a table.
pub async fn batch_update_metastore_partitions(
&mut self,
request: impl tonic::IntoRequest<
super::BatchUpdateMetastorePartitionsRequest,
>,
) -> std::result::Result<
tonic::Response<super::BatchUpdateMetastorePartitionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.storage.v1alpha.MetastorePartitionService/BatchUpdateMetastorePartitions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.bigquery.storage.v1alpha.MetastorePartitionService",
"BatchUpdateMetastorePartitions",
),
);
self.inner.unary(req, path, codec).await
}
/// Gets metastore partitions from a table.
pub async fn list_metastore_partitions(
&mut self,
request: impl tonic::IntoRequest<super::ListMetastorePartitionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListMetastorePartitionsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.storage.v1alpha.MetastorePartitionService/ListMetastorePartitions",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.bigquery.storage.v1alpha.MetastorePartitionService",
"ListMetastorePartitions",
),
);
self.inner.unary(req, path, codec).await
}
/// This is a bi-di streaming rpc method that allows the client to send
/// a stream of partitions and commit all of them atomically at the end.
/// If the commit is successful, the server will return a
/// response and close the stream. If the commit fails (due to duplicate
/// partitions or other reason), the server will close the stream with an
/// error. This method is only available via the gRPC API (not REST).
pub async fn stream_metastore_partitions(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::StreamMetastorePartitionsRequest,
>,
) -> std::result::Result<
tonic::Response<
tonic::codec::Streaming<super::StreamMetastorePartitionsResponse>,
>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/google.cloud.bigquery.storage.v1alpha.MetastorePartitionService/StreamMetastorePartitions",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"google.cloud.bigquery.storage.v1alpha.MetastorePartitionService",
"StreamMetastorePartitions",
),
);
self.inner.streaming(req, path, codec).await
}
}
}