fix: Rename database to namespace in the commands I just added
parent
d65a6a86dd
commit
ace497d47c
|
|
@ -11,8 +11,8 @@ service CatalogService {
|
|||
// Get the partition catalog records by the table id
|
||||
rpc GetPartitionsByTableId(GetPartitionsByTableIdRequest) returns (GetPartitionsByTableIdResponse);
|
||||
|
||||
// Get the parquet_file catalog records in the given database and table name
|
||||
rpc GetParquetFilesByDatabaseTable(GetParquetFilesByDatabaseTableRequest) returns (GetParquetFilesByDatabaseTableResponse);
|
||||
// Get the parquet_file catalog records in the given namespace and table name
|
||||
rpc GetParquetFilesByNamespaceTable(GetParquetFilesByNamespaceTableRequest) returns (GetParquetFilesByNamespaceTableResponse);
|
||||
}
|
||||
|
||||
message GetParquetFilesByPartitionIdRequest {
|
||||
|
|
@ -51,15 +51,15 @@ message GetPartitionsByTableIdResponse {
|
|||
repeated Partition partitions = 1;
|
||||
}
|
||||
|
||||
message GetParquetFilesByDatabaseTableRequest {
|
||||
// the database name
|
||||
string database_name = 1;
|
||||
message GetParquetFilesByNamespaceTableRequest {
|
||||
// the namespace name
|
||||
string namespace_name = 1;
|
||||
|
||||
// the table name in the database
|
||||
// the table name in the namespace
|
||||
string table_name = 2;
|
||||
}
|
||||
|
||||
message GetParquetFilesByDatabaseTableResponse {
|
||||
// the parquet_file records in the table in the database
|
||||
message GetParquetFilesByNamespaceTableResponse {
|
||||
// the parquet_file records in the table in the namespace
|
||||
repeated ParquetFile parquet_files = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,13 +41,12 @@ struct Get {
|
|||
file_name: String,
|
||||
}
|
||||
|
||||
/// Get all the Parquet files for a particular database's table
|
||||
/// into a local directory
|
||||
/// Get all the Parquet files for a particular namespace's table into a local directory
|
||||
#[derive(Debug, clap::Parser)]
|
||||
struct GetTable {
|
||||
/// The database (namespace) to get the Parquet files for
|
||||
/// The namespace to get the Parquet files for
|
||||
#[clap(action)]
|
||||
database: String,
|
||||
namespace: String,
|
||||
|
||||
/// The name of the table to get the Parquet files for
|
||||
#[clap(action)]
|
||||
|
|
@ -91,8 +90,8 @@ pub async fn command(connection: Connection, config: Config) -> Result<(), Error
|
|||
let mut store_client = store::Client::new(connection);
|
||||
|
||||
let parquet_files = catalog_client
|
||||
.get_parquet_files_by_database_table(
|
||||
get_table.database.clone(),
|
||||
.get_parquet_files_by_namespace_table(
|
||||
get_table.namespace.clone(),
|
||||
get_table.table.clone(),
|
||||
)
|
||||
.await?;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ async fn remote_store_get_table() {
|
|||
.assert()
|
||||
.failure()
|
||||
.stderr(predicate::str::contains(
|
||||
"Database nacho-namespace not found",
|
||||
"Namespace nacho-namespace not found",
|
||||
));
|
||||
}
|
||||
.boxed()
|
||||
|
|
|
|||
|
|
@ -50,16 +50,16 @@ impl Client {
|
|||
Ok(response.into_inner().partitions)
|
||||
}
|
||||
|
||||
/// Get the Parquet file records by their database and table names
|
||||
pub async fn get_parquet_files_by_database_table(
|
||||
/// Get the Parquet file records by their namespace and table names
|
||||
pub async fn get_parquet_files_by_namespace_table(
|
||||
&mut self,
|
||||
database_name: String,
|
||||
namespace_name: String,
|
||||
table_name: String,
|
||||
) -> Result<Vec<ParquetFile>, Error> {
|
||||
let response = self
|
||||
.inner
|
||||
.get_parquet_files_by_database_table(GetParquetFilesByDatabaseTableRequest {
|
||||
database_name,
|
||||
.get_parquet_files_by_namespace_table(GetParquetFilesByNamespaceTableRequest {
|
||||
namespace_name,
|
||||
table_name,
|
||||
})
|
||||
.await?;
|
||||
|
|
|
|||
|
|
@ -81,20 +81,20 @@ impl catalog_service_server::CatalogService for CatalogService {
|
|||
Ok(Response::new(response))
|
||||
}
|
||||
|
||||
async fn get_parquet_files_by_database_table(
|
||||
async fn get_parquet_files_by_namespace_table(
|
||||
&self,
|
||||
request: Request<GetParquetFilesByDatabaseTableRequest>,
|
||||
) -> Result<Response<GetParquetFilesByDatabaseTableResponse>, Status> {
|
||||
request: Request<GetParquetFilesByNamespaceTableRequest>,
|
||||
) -> Result<Response<GetParquetFilesByNamespaceTableResponse>, Status> {
|
||||
let mut repos = self.catalog.repositories().await;
|
||||
let req = request.into_inner();
|
||||
|
||||
let namespace = repos
|
||||
.namespaces()
|
||||
.get_by_name(&req.database_name)
|
||||
.get_by_name(&req.namespace_name)
|
||||
.await
|
||||
.map_err(|e| Status::unknown(e.to_string()))?
|
||||
.ok_or_else(|| {
|
||||
Status::not_found(format!("Database {} not found", req.database_name))
|
||||
Status::not_found(format!("Namespace {} not found", req.namespace_name))
|
||||
})?;
|
||||
|
||||
let table = repos
|
||||
|
|
@ -113,7 +113,7 @@ impl catalog_service_server::CatalogService for CatalogService {
|
|||
.map_err(|e| {
|
||||
warn!(
|
||||
error=%e,
|
||||
%req.database_name,
|
||||
%req.namespace_name,
|
||||
%req.table_name,
|
||||
"failed to get parquet_files for table"
|
||||
);
|
||||
|
|
@ -122,7 +122,7 @@ impl catalog_service_server::CatalogService for CatalogService {
|
|||
|
||||
let parquet_files: Vec<_> = parquet_files.into_iter().map(to_parquet_file).collect();
|
||||
|
||||
let response = GetParquetFilesByDatabaseTableResponse { parquet_files };
|
||||
let response = GetParquetFilesByNamespaceTableResponse { parquet_files };
|
||||
|
||||
Ok(Response::new(response))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue