Skip to content

Commit

Permalink
Add support for TPCH connector and TPCDS connector (#293)
Browse files Browse the repository at this point in the history
# Description

Needed for research of demo datasets
  • Loading branch information
sbernauer committed Sep 20, 2022
1 parent 9091d7c commit 085786d
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

- Add support for Trino `395-stackable0.1.0` and `396-stackable0.1.0` ([#292]).
- Add support for [Iceberg connector](https://trino.io/docs/current/connector/iceberg.html) ([#286]).
- Add support for [TPCH connector](https://trino.io/docs/current/connector/tpch.html) and [TPCDS connector](https://trino.io/docs/current/connector/tpcds.html) ([#293]).

### Fixed

Expand All @@ -16,6 +17,7 @@ All notable changes to this project will be documented in this file.
[#286]: https://github.com/stackabletech/trino-operator/pull/286
[#289]: https://github.com/stackabletech/trino-operator/pull/289
[#292]: https://github.com/stackabletech/trino-operator/pull/292
[#293]: https://github.com/stackabletech/trino-operator/pull/293

## [0.6.0] - 2022-09-08

Expand Down
8 changes: 8 additions & 0 deletions deploy/crd/trinocatalog.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
- hive
- required:
- iceberg
- required:
- tpcds
- required:
- tpch
properties:
hive:
properties:
Expand Down Expand Up @@ -279,6 +283,10 @@ spec:
required:
- metastore
type: object
tpcds:
type: object
tpch:
type: object
type: object
required:
- connector
Expand Down
8 changes: 8 additions & 0 deletions deploy/helm/trino-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,10 @@ spec:
- hive
- required:
- iceberg
- required:
- tpcds
- required:
- tpch
properties:
hive:
properties:
Expand Down Expand Up @@ -1439,6 +1443,10 @@ spec:
required:
- metastore
type: object
tpcds:
type: object
tpch:
type: object
type: object
required:
- connector
Expand Down
8 changes: 8 additions & 0 deletions deploy/manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,10 @@ spec:
- hive
- required:
- iceberg
- required:
- tpcds
- required:
- tpch
properties:
hive:
properties:
Expand Down Expand Up @@ -1440,6 +1444,10 @@ spec:
required:
- metastore
type: object
tpcds:
type: object
tpch:
type: object
type: object
required:
- connector
Expand Down
2 changes: 2 additions & 0 deletions docs/modules/ROOT/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ Currently the following connectors are supported:

* https://trino.io/docs/current/connector/hive.html[Hive]
* https://trino.io/docs/current/connector/iceberg.html[Iceberg]
* https://trino.io/docs/current/connector/tpcds.html[TPCDS]
* https://trino.io/docs/current/connector/tpch.html[TPCH]

An instance of a connector is called a catalog.
Think of a setup containing a large Hive warehouses based on a HDFS.
Expand Down
6 changes: 6 additions & 0 deletions rust/crd/src/catalog/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pub mod commons;
pub mod hive;
pub mod iceberg;
pub mod tpcds;
pub mod tpch;

use serde::{Deserialize, Serialize};
use stackable_operator::{
Expand All @@ -11,6 +13,8 @@ use std::collections::HashMap;

use hive::HiveConnector;
use iceberg::IcebergConnector;
use tpcds::TpcdsConnector;
use tpch::TpchConnector;

#[derive(Clone, CustomResource, Debug, Deserialize, JsonSchema, PartialEq, Serialize)]
#[kube(
Expand All @@ -37,4 +41,6 @@ pub struct TrinoCatalogSpec {
pub enum TrinoCatalogConnector {
Hive(HiveConnector),
Iceberg(IcebergConnector),
Tpcds(TpcdsConnector),
Tpch(TpchConnector),
}
6 changes: 6 additions & 0 deletions rust/crd/src/catalog/tpcds.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use serde::{Deserialize, Serialize};
use stackable_operator::schemars::{self, JsonSchema};

#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TpcdsConnector {}
6 changes: 6 additions & 0 deletions rust/crd/src/catalog/tpch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use serde::{Deserialize, Serialize};
use stackable_operator::schemars::{self, JsonSchema};

#[derive(Clone, Debug, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct TpchConnector {}
10 changes: 10 additions & 0 deletions rust/operator-binary/src/catalog/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ impl CatalogConfig {
.to_catalog_config(&catalog_name, catalog_namespace, client)
.await
}
TrinoCatalogConnector::Tpcds(connector) => {
connector
.to_catalog_config(&catalog_name, catalog_namespace, client)
.await
}
TrinoCatalogConnector::Tpch(connector) => {
connector
.to_catalog_config(&catalog_name, catalog_namespace, client)
.await
}
}?;

catalog_config
Expand Down
2 changes: 2 additions & 0 deletions rust/operator-binary/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ pub mod commons;
pub mod config;
pub mod hive;
pub mod iceberg;
pub mod tpcds;
pub mod tpch;

use self::config::CatalogConfig;
use async_trait::async_trait;
Expand Down
19 changes: 19 additions & 0 deletions rust/operator-binary/src/catalog/tpcds.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::tpcds::TpcdsConnector;

pub const CONNECTOR_NAME: &str = "tpcds";

#[async_trait]
impl ToCatalogConfig for TpcdsConnector {
async fn to_catalog_config(
&self,
catalog_name: &str,
_catalog_namespace: Option<String>,
_client: &Client,
) -> Result<CatalogConfig, FromTrinoCatalogError> {
// No additional properties needed
Ok(CatalogConfig::new(catalog_name.to_string(), CONNECTOR_NAME))
}
}
19 changes: 19 additions & 0 deletions rust/operator-binary/src/catalog/tpch.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use super::{config::CatalogConfig, FromTrinoCatalogError, ToCatalogConfig};
use async_trait::async_trait;
use stackable_operator::client::Client;
use stackable_trino_crd::catalog::tpch::TpchConnector;

pub const CONNECTOR_NAME: &str = "tpch";

#[async_trait]
impl ToCatalogConfig for TpchConnector {
async fn to_catalog_config(
&self,
catalog_name: &str,
_catalog_namespace: Option<String>,
_client: &Client,
) -> Result<CatalogConfig, FromTrinoCatalogError> {
// No additional properties needed
Ok(CatalogConfig::new(catalog_name.to_string(), CONNECTOR_NAME))
}
}

0 comments on commit 085786d

Please sign in to comment.