diff --git a/docs/scalardb-analytics/README.mdx b/docs/scalardb-analytics/README.mdx
deleted file mode 100644
index fa416e71..00000000
--- a/docs/scalardb-analytics/README.mdx
+++ /dev/null
@@ -1,20 +0,0 @@
----
-tags:
- - Enterprise Option
-displayed_sidebar: docsEnglish
----
-
-# ScalarDB Analytics
-
-import WarningLicenseKeyContact from '/src/components/en-us/_warning-license-key-contact.mdx';
-
-**ScalarDB Analytics** is the analytical component of ScalarDB. Similar to ScalarDB, it unifies diverse data sources - ranging from RDBMSs like PostgreSQL and MySQL to NoSQL databases such as Cassandra and DynamoDB - into a single logical database. While ScalarDB focuses on operational workloads with strong transactional consistency across multiple databases, ScalarDB Analytics is optimized for analytical workloads. It supports a wide range of queries, including complex joins, aggregations, and window functions. ScalarDB Analytics operates seamlessly on both ScalarDB-managed data sources and non-ScalarDB-managed ones, enabling advanced analytical queries across various datasets.
-
-The current version of ScalarDB Analytics leverages **Apache Spark** as its execution engine. It provides a unified view of ScalarDB-managed and non-ScalarDB-managed data sources by utilizing a Spark custom catalog. Using ScalarDB Analytics, you can treat tables from these data sources as native Spark tables. This allows you to execute arbitrary Spark SQL queries seamlessly. For example, you can join a table stored in Cassandra with a table in PostgreSQL to perform a cross-database analysis with ease.
-
-
-
-## Further reading
-
-* For tutorials on how to use ScalarDB Analytics by using a sample dataset and application, see [Getting Started with ScalarDB Analytics](../scalardb-samples/scalardb-analytics-spark-sample/README.mdx).
-* For supported Spark and Scala versions, see [Version Compatibility of ScalarDB Analytics with Spark](./run-analytical-queries.mdx#version-compatibility)
diff --git a/docs/scalardb-analytics/deployment.mdx b/docs/scalardb-analytics/deployment.mdx
index b1f5a54f..d2211a25 100644
--- a/docs/scalardb-analytics/deployment.mdx
+++ b/docs/scalardb-analytics/deployment.mdx
@@ -4,25 +4,42 @@ tags:
displayed_sidebar: docsEnglish
---
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
# Deploy ScalarDB Analytics in Public Cloud Environments
-This guide explains how to deploy ScalarDB Analytics in a public cloud environment. ScalarDB Analytics currently uses Apache Spark as an execution engine and supports managed Spark services provided by public cloud providers, such as Amazon EMR and Databricks.
+This guide explains how to deploy ScalarDB Analytics in a public cloud environment. ScalarDB Analytics consists of two main components: a ScalarDB Analytics server and Apache Spark. In this guide, you can choose either Amazon EMR or Databricks for the Spark environment.
+For details about ScalarDB Analytics, refer to [ScalarDB Analytics Design](./design.mdx).
-## Supported managed Spark services and their application types
+## Deploy ScalarDB Analytics catalog server
+
+ScalarDB Analytics requires a catalog server to manage metadata and data source connections. The catalog server should be deployed by using Helm charts on a Kubernetes cluster.
+
+For detailed deployment instructions, see [TBD - Helm chart deployment guide].
+
+After deploying the catalog server, note the following information for Spark configuration:
+
+- Catalog server host address
+- Catalog port (default: 11051)
+- Metering port (default: 11052)
+
+## Deploy Spark with ScalarDB Analytics
+
+After deploying the catalog server, you can configure and deploy Spark with ScalarDB Analytics by using managed Spark services.
+
+### Supported managed Spark services and their application types
ScalarDB Analytics supports the following managed Spark services and application types.
-| Public Cloud Service | Spark Driver | Spark Connect | JDBC |
-| -------------------------- | ------------ | ------------- | ---- |
-| Amazon EMR (EMR on EC2) | ✅ | ✅ | ❌ |
-| Databricks | ✅ | ❌ | ✅ |
+| Public Cloud Service | Spark Driver | Spark Connect | JDBC |
+| ----------------------- | ------------ | ------------- | ---- |
+| Amazon EMR (EMR on EC2) | ✅ | ✅ | ❌ |
+| Databricks | ✅ | ❌ | ✅ |
-## Configure and deploy
+### Configure and deploy
-Select your public cloud environment, and follow the instructions to set up and deploy ScalarDB Analytics.
+Select your public cloud environment, and follow the instructions to set up and deploy Spark with ScalarDB Analytics.
@@ -41,12 +58,11 @@ To enable ScalarDB Analytics, you need to add the following configuration to the
"Classification": "spark-defaults",
"Properties": {
"spark.jars.packages": "com.scalar-labs:scalardb-analytics-spark-all-_:",
- "spark.sql.catalog.": "com.scalar.db.analytics.spark.ScalarDbAnalyticsCatalog",
- "spark.sql.extensions": "com.scalar.db.analytics.spark.extension.ScalarDbAnalyticsExtensions",
- "spark.sql.catalog..license.cert_pem": "",
- "spark.sql.catalog..license.key": "",
-
- // Add your data source configuration below
+ "spark.extraListeners": "com.scalar.db.analytics.spark.metering.ScalarDbAnalyticsListener",
+ "spark.sql.catalog.": "com.scalar.db.analytics.spark.catalog.ScalarDBAnalyticsCatalog",
+ "spark.sql.catalog..server.host": "",
+ "spark.sql.catalog..server.catalog.port": "11051",
+ "spark.sql.catalog..server.metering.port": "11052"
}
}
]
@@ -54,24 +70,23 @@ To enable ScalarDB Analytics, you need to add the following configuration to the
The following describes what you should change the content in the angle brackets to:
-- ``: The version of Spark.
-- ``: The version of Scala used to build Spark.
-- ``: The version of ScalarDB Analytics.
-- ``: The name of the catalog.
-- ``: The PEM encoded license certificate.
-- ``: The license key.
+- ``: The version of Spark (e.g., `3.5` or `3.4`).
+- ``: The version of Scala used to build Spark (for example, `2.13` or `2.12`).
+- ``: The version of ScalarDB Analytics (for example, `3.16.0`).
+- ``: The name of the catalog. This must match a catalog created on the ScalarDB Analytics server.
+- ``: The host address of your ScalarDB Analytics server.
For more details, refer to [Set up ScalarDB Analytics in the Spark configuration](./run-analytical-queries.mdx#set-up-scalardb-analytics-in-the-spark-configuration).
Run analytical queries via the Spark driver
-After the EMR Spark cluster has launched, you can use ssh to connect to the primary node of the EMR cluster and run your Spark application. For details on how to create a Spark Driver application, refer to [Spark Driver application](./run-analytical-queries.mdx?spark-application-type=spark-driver-application#develop-a-spark-application).
+After the EMR Spark cluster has launched, you can use ssh to connect to the primary node of the EMR cluster and run your Spark application. For details on how to create a Spark driver application, refer to [Spark driver application](./run-analytical-queries.mdx?spark-application-type=spark-driver#develop-a-spark-application).
Run analytical queries via Spark Connect
You can use Spark Connect to run your Spark application remotely by using the EMR cluster that you launched.
-You first need to configure the Software setting in the same way as the [Spark Driver application](./run-analytical-queries.mdx?spark-application-type=spark-driver-application#develop-a-spark-application). You also need to set the following configuration to enable Spark Connect.
+You first need to configure the Software setting in the same way as the [Spark driver application](./run-analytical-queries.mdx?spark-application-type=spark-driver#develop-a-spark-application). You also need to set the following configuration to enable Spark Connect.
Allow inbound traffic for a Spark Connect server
@@ -126,46 +141,26 @@ Note that Databricks provides a modified version of Apache Spark, which works di
ScalarDB Analytics works with all-purpose and jobs-compute clusters on Databricks. When you launch the cluster, you need to configure the cluster to enable ScalarDB Analytics as follows:
-1. Store the license certificate and license key in the cluster by using the Databricks CLI.
+1. Select "No isolation shared" for the cluster mode. (This is required. ScalarDB Analytics works only with this cluster mode.)
+2. Select an appropriate Databricks runtime version that supports Spark 3.4 or later.
+3. Configure "Advanced Options" > "Spark config" as follows:
-```console
-databricks secrets create-scope scalardb-analytics-secret # you can use any secret scope name
-cat license_key.json | databricks secrets put-secret scalardb-analytics-secret license-key
-cat license_cert.pem | databricks secrets put-secret scalardb-analytics-secret license-cert
```
-
-:::note
-
-For details on how to install and use the Databricks CLI, refer to the [Databricks CLI documentation](https://docs.databricks.com/en/dev-tools/cli/index.html).
-
-:::
-
-2. Select "No isolation shared" for the cluster mode. (This is required. ScalarDB Analytics works only with this cluster mode.)
-3. Select an appropriate Databricks runtime version that supports Spark 3.4 or later.
-4. Configure "Advanced Options" > "Spark config" as follows, replacing `` with the name of the catalog that you want to use:
-
-```
-spark.sql.catalog. com.scalar.db.analytics.spark.ScalarDbAnalyticsCatalog
-spark.sql.extensions com.scalar.db.analytics.spark.extension.ScalarDbAnalyticsExtensions
-spark.sql.catalog..license.key {{secrets/scalardb-analytics-secret/license-key}}
-spark.sql.catalog..license.cert_pem {{secrets/scalardb-analytics-secret/license-pem}}
+spark.extraListeners com.scalar.db.analytics.spark.metering.ScalarDbAnalyticsListener
+spark.sql.catalog. com.scalar.db.analytics.spark.catalog.ScalarDBAnalyticsCatalog
+spark.sql.catalog..server.host
+spark.sql.catalog..server.catalog.port 11051
+spark.sql.catalog..server.metering.port 11052
```
-:::note
-
-You also need to configure the data source. For details, refer to [Set up ScalarDB Analytics in the Spark configuration](./run-analytical-queries.mdx#set-up-scalardb-analytics-in-the-spark-configuration).
-
-:::
-
-:::note
+Replace the placeholders:
-If you specified different secret names in the previous step, be sure to replace the secret names in the configuration above.
+- ``: The name of the catalog. This must match a catalog created on the ScalarDB Analytics server.
+- ``: The host address of your ScalarDB Analytics catalog server.
-:::
-
-5. Add the library of ScalarDB Analytics to the launched cluster as a Maven dependency. For details on how to add the library, refer to the [Databricks cluster libraries documentation](https://docs.databricks.com/en/libraries/cluster-libraries.html).
+4. Add the library of ScalarDB Analytics to the launched cluster as a Maven dependency. For details on how to add the library, refer to the [Databricks cluster libraries documentation](https://docs.databricks.com/en/libraries/cluster-libraries.html).
-Run analytical queries via the Spark Driver
+Run analytical queries via the Spark driver
You can run your Spark application on the properly configured Databricks cluster with Databricks Notebook or Databricks Jobs to access the tables in ScalarDB Analytics. To run the Spark application, you can migrate your Pyspark, Scala, or Spark SQL application to Databricks Notebook, or use Databricks Jobs to run your Spark application. ScalarDB Analytics works with task types for Notebook, Python, JAR, and SQL.
@@ -185,7 +180,7 @@ Databricks supports JDBC to run SQL jobs on the cluster. You can use this featur
# Target directories
TARGET_DIRECTORIES=("/databricks/jars" "/databricks/hive_metastore_jars")
-JAR_PATH="
+JAR_PATH=""
# Copy the JAR file to the target directories
for TARGET_DIR in "${TARGET_DIRECTORIES[@]}"; do
diff --git a/docs/scalardb-analytics/design.mdx b/docs/scalardb-analytics/design.mdx
index e1f99d07..3324887c 100644
--- a/docs/scalardb-analytics/design.mdx
+++ b/docs/scalardb-analytics/design.mdx
@@ -86,294 +86,16 @@ ScalarDB Analytics supports a wide range of data types across different data sou
- `DURATION`
- `INTERVAL`
-### Catalog information mappings by data source
+These data types are used across all data sources and provide a unified type system for querying heterogeneous databases.
-When registering a data source to ScalarDB Analytics, the catalog information of the data source, that is, namespaces, tables, and columns, are resolved and registered to the universal data catalog. To resolve the catalog information of the data source, a particular object on the data sources side are mapped to the universal data catalog object. This mapping is consists of two parts: catalog-level mappings and data-type mappings. In the following sections, we describe how ScalarDB Analytics maps the catalog level and data type from each data source into the universal data catalog.
+### Data source integration
-#### Catalog-level mappings
+When registering a data source to ScalarDB Analytics, two types of mappings occur:
-The catalog-level mappings are the mappings of the namespace names, table names, and column names from the data sources to the universal data catalog. To see the catalog-level mappings in each data source, select a data source.
+1. **Catalog structure mapping**: The data source's catalog information (namespaces, tables, and columns) is resolved and mapped to the universal data catalog structure
+2. **Data type mapping**: Native data types from each data source are mapped to the universal data types listed above
-
-
- The catalog information of ScalarDB is automatically resolved by ScalarDB Analytics. The catalog-level objects are mapped as follows:
-
- - The ScalarDB namespace is mapped to the namespace. Therefore, the namespace of the ScalarDB data source is always single level, consisting of only the namespace name.
- - The ScalarDB table is mapped to the table.
- - The ScalarDB column is mapped to the column.
-
-
-
-
- The catalog information of PostgreSQL is automatically resolved by ScalarDB Analytics. The catalog-level objects are mapped as follows:
-
- - The PostgreSQL schema is mapped to the namespace. Therefore, the namespace of the PostgreSQL data source is always single level, consisting of only the schema name.
- - Only user-defined schemas are mapped to namespaces. The following system schemas are ignored:
- - `information_schema`
- - `pg_catalog`
- - The PostgreSQL table is mapped to the table.
- - The PostgreSQL column is mapped to the column.
-
-
-
- The catalog information of MySQL is automatically resolved by ScalarDB Analytics. The catalog-level objects are mapped as follows:
-
- - The MySQL database is mapped to the namespace. Therefore, the namespace of the MySQL data source is always single level, consisting of only the database name.
- - Only user-defined databases are mapped to namespaces. The following system databases are ignored:
- - `mysql`
- - `sys`
- - `information_schema`
- - `performance_schema`
- - The MySQL table is mapped to the table.
- - The MySQL column is mapped to the column.
-
-
-
- The catalog information of Oracle is automatically resolved by ScalarDB Analytics. The catalog-level objects are mapped as follows:
-
- - The Oracle schema is mapped to the namespace. Therefore, the namespace of the Oracle data source is always single level, consisting of only schema name.
- - Only user-defined schemas are mapped to namespaces. The following system schemas are ignored:
- - `ANONYMOUS`
- - `APPQOSSYS`
- - `AUDSYS`
- - `CTXSYS`
- - `DBSNMP`
- - `DGPDB_INT`
- - `DBSFWUSER`
- - `DVF`
- - `DVSYS`
- - `GGSYS`
- - `GSMADMIN_INTERNAL`
- - `GSMCATUSER`
- - `GSMROOTUSER`
- - `GSMUSER`
- - `LBACSYS`
- - `MDSYS`
- - `OJVMSYS`
- - `ORDDATA`
- - `ORDPLUGINS`
- - `ORDSYS`
- - `OUTLN`
- - `REMOTE_SCHEDULER_AGENT`
- - `SI_INFORMTN_SCHEMA`
- - `SYS`
- - `SYS$UMF`
- - `SYSBACKUP`
- - `SYSDG`
- - `SYSKM`
- - `SYSRAC`
- - `SYSTEM`
- - `WMSYS`
- - `XDB`
- - `DIP`
- - `MDDATA`
- - `ORACLE_OCM`
- - `XS$NULL`
-
-
-
- The catalog information of SQL Server is automatically resolved by ScalarDB Analytics. The catalog-level objects are mapped as follows:
-
- - The SQL Server database and schema are mapped to the namespace together. Therefore, the namespace of the SQL Server data source is always two-level, consisting of the database name and the schema name.
- - Only user-defined databases are mapped to namespaces. The following system databases are ignored:
- - `sys`
- - `guest`
- - `INFORMATION_SCHEMA`
- - `db_accessadmin`
- - `db_backupoperator`
- - `db_datareader`
- - `db_datawriter`
- - `db_ddladmin`
- - `db_denydatareader`
- - `db_denydatawriter`
- - `db_owner`
- - `db_securityadmin`
- - Only user-defined schemas are mapped to namespaces. The following system schemas are ignored:
- - `master`
- - `model`
- - `msdb`
- - `tempdb`
- - The SQL Server table is mapped to the table.
- - The SQL Server column is mapped to the column.
-
-
-
- Since DynamoDB is schema-less, you need to specify the catalog information explicitly when registering a DynamoDB data source by using the following format JSON:
-
- ```json
- {
- "namespaces": [
- {
- "name": "",
- "tables": [
- {
- "name": "",
- "columns": [
- {
- "name": "",
- "type": ""
- },
- ...
- ]
- },
- ...
- ]
- },
- ...
- ]
- }
- ```
-
- In the specified JSON, you can use any arbitrary namespace names, but the table names must match the table names in DynamoDB and column name and type must match field names and types in DynamoDB.
-
-
-
-
-#### Data-type mappings
-
-The native data types of the underlying data sources are mapped to the data types in ScalarDB Analytics. To see the data-type mappings in each data source, select a data source.
-
-
-
- | **ScalarDB Data Type** | **ScalarDB Analytics Data Type** |
- |:------------------------------|:---------------------------------|
- | `BOOLEAN` | `BOOLEAN` |
- | `INT` | `INT` |
- | `BIGINT` | `BIGINT` |
- | `FLOAT` | `FLOAT` |
- | `DOUBLE` | `DOUBLE` |
- | `TEXT` | `TEXT` |
- | `BLOB` | `BLOB` |
- | `DATE` | `DATE` |
- | `TIME` | `TIME` |
- | `TIMESTAMP` | `TIMESTAMP` |
- | `TIMESTAMPTZ` | `TIMESTAMPTZ` |
-
-
- | **PostgreSQL Data Type** | **ScalarDB Analytics Data Type** |
- |:------------------------------|:---------------------------------|
- | `integer` | `INT` |
- | `bigint` | `BIGINT` |
- | `real` | `FLOAT` |
- | `double precision` | `DOUBLE` |
- | `smallserial` | `SMALLINT` |
- | `serial` | `INT` |
- | `bigserial` | `BIGINT` |
- | `char` | `TEXT` |
- | `varchar` | `TEXT` |
- | `text` | `TEXT` |
- | `bpchar` | `TEXT` |
- | `boolean` | `BOOLEAN` |
- | `bytea` | `BLOB` |
- | `date` | `DATE` |
- | `time` | `TIME` |
- | `time with time zone` | `TIME` |
- | `time without time zone` | `TIME` |
- | `timestamp` | `TIMESTAMP` |
- | `timestamp with time zone` | `TIMESTAMPTZ` |
- | `timestamp without time zone` | `TIMESTAMP` |
-
-
- | **MySQL Data Type** | **ScalarDB Analytics Data Type** |
- |:-----------------------|:---------------------------------|
- | `bit` | `BOOLEAN` |
- | `bit(1)` | `BOOLEAN` |
- | `bit(x)` if *x >= 2* | `BLOB` |
- | `tinyint` | `SMALLINT` |
- | `tinyint(1)` | `BOOLEAN` |
- | `boolean` | `BOOLEAN` |
- | `smallint` | `SMALLINT` |
- | `smallint unsigned` | `INT` |
- | `mediumint` | `INT` |
- | `mediumint unsigned` | `INT` |
- | `int` | `INT` |
- | `int unsigned` | `BIGINT` |
- | `bigint` | `BIGINT` |
- | `float` | `FLOAT` |
- | `double` | `DOUBLE` |
- | `real` | `DOUBLE` |
- | `char` | `TEXT` |
- | `varchar` | `TEXT` |
- | `text` | `TEXT` |
- | `binary` | `BLOB` |
- | `varbinary` | `BLOB` |
- | `blob` | `BLOB` |
- | `date` | `DATE` |
- | `time` | `TIME` |
- | `datetime` | `TIMESTAMP` |
- | `timestamp` | `TIMESTAMPTZ` |
-
-
- | **Oracle Data Type** | **ScalarDB Analytics Data Type** |
- |:-----------------------------------|:---------------------------------|
- | `NUMBER` if *scale = 0* | `BIGINT` |
- | `NUMBER` if *scale > 0* | `DOUBLE` |
- | `FLOAT` if *precision ≤ 53* | `DOUBLE` |
- | `BINARY_FLOAT` | `FLOAT` |
- | `BINARY_DOUBLE` | `DOUBLE` |
- | `CHAR` | `TEXT` |
- | `NCHAR` | `TEXT` |
- | `VARCHAR2` | `TEXT` |
- | `NVARCHAR2` | `TEXT` |
- | `CLOB` | `TEXT` |
- | `NCLOB` | `TEXT` |
- | `BLOB` | `BLOB` |
- | `BOOLEAN` | `BOOLEAN` |
- | `DATE` | `DATE` |
- | `TIMESTAMP` | `TIMESTAMPTZ` |
- | `TIMESTAMP WITH TIME ZONE` | `TIMESTAMPTZ` |
- | `TIMESTAMP WITH LOCAL TIME ZONE` | `TIMESTAMP` |
- | `RAW` | `BLOB` |
-
-
- | **SQL Server Data Type** | **ScalarDB Analytics Data Type** |
- |:---------------------------|:---------------------------------|
- | `bit` | `BOOLEAN` |
- | `tinyint` | `SMALLINT` |
- | `smallint` | `SMALLINT` |
- | `int` | `INT` |
- | `bigint` | `BIGINT` |
- | `real` | `FLOAT` |
- | `float` | `DOUBLE` |
- | `float(n)` if *n ≤ 24* | `FLOAT` |
- | `float(n)` if *n ≥ 25* | `DOUBLE` |
- | `binary` | `BLOB` |
- | `varbinary` | `BLOB` |
- | `char` | `TEXT` |
- | `varchar` | `TEXT` |
- | `nchar` | `TEXT` |
- | `nvarchar` | `TEXT` |
- | `ntext` | `TEXT` |
- | `text` | `TEXT` |
- | `date` | `DATE` |
- | `time` | `TIME` |
- | `datetime` | `TIMESTAMP` |
- | `datetime2` | `TIMESTAMP` |
- | `smalldatetime` | `TIMESTAMP` |
- | `datetimeoffset` | `TIMESTAMPTZ` |
-
-
- | **DynamoDB Data Type** | **ScalarDB Analytics Data Type** |
- |:-------------------------|:---------------------------------|
- | `Number` | `BYTE` |
- | `Number` | `SMALLINT` |
- | `Number` | `INT` |
- | `Number` | `BIGINT` |
- | `Number` | `FLOAT` |
- | `Number` | `DOUBLE` |
- | `Number` | `DECIMAL` |
- | `String` | `TEXT` |
- | `Binary` | `BLOB` |
- | `Boolean` | `BOOLEAN` |
-
-:::warning
-
-It is important to ensure that the field values of `Number` types are parsable as a specified data type for ScalarDB Analytics. For example, if a column that corresponds to a `Number`-type field is specified as an `INT` type, its value must be an integer. If the value is not an integer, an error will occur when running a query.
-
-:::
-
-
-
+These mappings ensure compatibility and consistency across different database systems. For detailed information about how specific databases are mapped, see [Catalog metadata reference](administration.mdx#catalog-metadata-reference) in the administration guide.
## Query engine
diff --git a/docs/scalardb-analytics/run-analytical-queries.mdx b/docs/scalardb-analytics/run-analytical-queries.mdx
index 1ec47a46..69c4414e 100644
--- a/docs/scalardb-analytics/run-analytical-queries.mdx
+++ b/docs/scalardb-analytics/run-analytical-queries.mdx
@@ -4,8 +4,8 @@ tags:
displayed_sidebar: docsEnglish
---
-import Tabs from '@theme/Tabs';
-import TabItem from '@theme/TabItem';
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
# Run Analytical Queries Through ScalarDB Analytics
@@ -19,204 +19,74 @@ This section describes the prerequisites, setting up ScalarDB Analytics in the S
### Prerequisites
-ScalarDB Analytics works with Apache Spark 3.4 or later. If you don't have Spark installed yet, please download the Spark distribution from [Apache's website](https://spark.apache.org/downloads.html).
+- **ScalarDB Analytics catalog server**: A running instance that manages catalog metadata and connects to your data sources. The server must be set up with at least one data source registered. For setup and data source registration instructions, see [Set up and administer the ScalarDB Analytics catalog server](./administration.mdx).
+- **Apache Spark**: A compatible version of Apache Spark. For supported versions, see [Version compatibility](#version-compatibility). If you don't have Spark installed yet, please download the Spark distribution from [Apache's website](https://spark.apache.org/downloads.html).
:::note
-Apache Spark are built with either Scala 2.12 or Scala 2.13. ScalarDB Analytics supports both versions. You need to be sure which version you are using so that you can select the correct version of ScalarDB Analytics later. You can refer to [Version Compatibility](#version-compatibility) for more details.
+Apache Spark are built with either Scala 2.12 or Scala 2.13. ScalarDB Analytics supports both versions. You need to be sure which version you are using so that you can select the correct version of ScalarDB Analytics later. You can refer to [Version compatibility](#version-compatibility) for more details.
:::
### Set up ScalarDB Analytics in the Spark configuration
-The following sections describe all available configuration options for ScalarDB Analytics. These configurations control:
+ScalarDB Analytics requires specific Spark configurations to integrate with the catalog server.
-- How ScalarDB Analytics integrates with Spark
-- How data sources are connected and accessed
-- How license information is provided
+#### Required Spark configurations
-For example configurations in a practical scenario, see [the sample application configuration](https://github.com/scalar-labs/scalardb-samples/blob/main/scalardb-analytics-sample/config/scalardb-analytics-server.properties).
+To use ScalarDB Analytics with Spark, you need to configure:
-#### Spark plugin configurations
+1. **ScalarDB Analytics package**: Add the JAR dependency that matches your Spark and Scala versions
+2. **Metering listener**: Register the listener to track resource usage for billing
+3. **Catalog registration**: Register a Spark catalog that connects to your ScalarDB Analytics server
-| Configuration Key | Required | Description |
-|:-----------------|:---------|:------------|
-| `spark.jars.packages` | No | A comma-separated list of Maven coordinates for the required dependencies. User need to include the ScalarDB Analytics package you are using, otherwise, specify it as the command line argument when running the Spark application. For details about the Maven coordinates of ScalarDB Analytics, refer to [Add ScalarDB Analytics dependency](#add-the-scalardb-analytics-dependency). |
-| `spark.sql.extensions` | Yes | Must be set to `com.scalar.db.analytics.spark.extension.ScalarDbAnalyticsExtensions`. |
-| `spark.sql.catalog.` | Yes | Must be set to `com.scalar.db.analytics.spark.ScalarDbAnalyticsCatalog`. |
+When configuring Spark, you must specify a catalog name that matches the catalog created on your ScalarDB Analytics server. This ensures Spark can correctly access the data sources managed by that catalog.
-You can specify any name for ``. Be sure to use the same catalog name throughout your configuration.
-
-#### License configurations
-
-| Configuration Key | Required | Description |
-| :--------------------------------------------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------- |
-| `spark.sql.catalog..license.key` | Yes | JSON string of the license key for ScalarDB Analytics |
-| `spark.sql.catalog..license.cert_pem` | Yes | A string of PEM-encoded certificate of ScalarDB Analytics license. Either `cert_pem` or `cert_path` must be set. |
-| `spark.sql.catalog..license.cert_path` | Yes | A path to the PEM-encoded certificate of ScalarDB Analytics license. Either `cert_pem` or `cert_path` must be set. |
-
-#### Data source configurations
-
-ScalarDB Analytics supports multiple types of data sources. Each type requires specific configuration parameters:
-
-
-
-
-:::note
-
-ScalarDB Analytics supports ScalarDB as a data source. This table describes how to configure ScalarDB as a data source.
-
-:::
-
-| Configuration Key | Required | Description |
-| :---------------------------------------------------------------------------- | :------- | :---------------------------------------------- |
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `scalardb` |
-| `spark.sql.catalog..data_source..config_path` | Yes | The path to the configuration file for ScalarDB |
-
-:::tip
-
-You can use an arbitrary name for ``.
-
-:::
-
-
-
-
-| Configuration Key | Required | Description |
-| :------------------------------------------------------------------------- | :------- | :------------------------------------- |
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `mysql` |
-| `spark.sql.catalog..data_source..host` | Yes | The host name of the MySQL server |
-| `spark.sql.catalog..data_source..port` | Yes | The port number of the MySQL server |
-| `spark.sql.catalog..data_source..username` | Yes | The username of the MySQL server |
-| `spark.sql.catalog..data_source..password` | Yes | The password of the MySQL server |
-| `spark.sql.catalog..data_source..database` | No | The name of the database to connect to |
-
-:::tip
-
-You can use an arbitrary name for ``.
-
-:::
-
-
-
+#### Example configuration
-| Configuration Key | Required | Description |
-| :------------------------------------------------------------------------- | :------- | :--------------------------------------- |
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `postgresql` or `postgres` |
-| `spark.sql.catalog..data_source..host` | Yes | The host name of the PostgreSQL server |
-| `spark.sql.catalog..data_source..port` | Yes | The port number of the PostgreSQL server |
-| `spark.sql.catalog..data_source..username` | Yes | The username of the PostgreSQL server |
-| `spark.sql.catalog..data_source..password` | Yes | The password of the PostgreSQL server |
-| `spark.sql.catalog..data_source..database` | Yes | The name of the database to connect to |
+Here's a complete example configuration:
-:::tip
+```conf
+# 1. ScalarDB Analytics package
+spark.jars.packages com.scalar-labs:scalardb-analytics-spark-all-_:
-You can use an arbitrary name for ``.
+# 2. Metering listener
+spark.extraListeners com.scalar.db.analytics.spark.metering.ScalarDbAnalyticsListener
-:::
-
-
-
+# 3. Catalog registration
+spark.sql.catalog.myanalytics com.scalar.db.analytics.spark.catalog.ScalarDBAnalyticsCatalog
+spark.sql.catalog.myanalytics.server.host analytics-server.example.com
+spark.sql.catalog.myanalytics.server.catalog.port 11051
+spark.sql.catalog.myanalytics.server.metering.port 11052
+```
-| Configuration Key | Required | Description |
-| :----------------------------------------------------------------------------- | :------- | :------------------------------------ |
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `oracle` |
-| `spark.sql.catalog..data_source..host` | Yes | The host name of the Oracle server |
-| `spark.sql.catalog..data_source..port` | Yes | The port number of the Oracle server |
-| `spark.sql.catalog..data_source..username` | Yes | The username of the Oracle server |
-| `spark.sql.catalog..data_source..password` | Yes | The password of the Oracle server |
-| `spark.sql.catalog..data_source..service_name` | Yes | The service name of the Oracle server |
+Replace the placeholders:
-:::tip
+- ``: Your Spark version (e.g., `3.5` or `3.4`)
+- ``: Your Scala version (e.g., `2.13` or `2.12`)
+- ``: The ScalarDB Analytics version (e.g., `3.16.0`)
-You can use an arbitrary name for ``.
+In this example:
-:::
-
-
-
-
-| Configuration Key | Required | Description |
-| :------------------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------------------------- |
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `sqlserver` or `mssql` |
-| `spark.sql.catalog..data_source..host` | Yes | The host name of the SQL Server server |
-| `spark.sql.catalog..data_source..port` | Yes | The port number of the SQL Server server |
-| `spark.sql.catalog..data_source..username` | Yes | The username of the SQL Server server |
-| `spark.sql.catalog..data_source..password` | Yes | The password of the SQL Server server |
-| `spark.sql.catalog..data_source..database` | No | The name of the database to connect to |
-| `spark.sql.catalog..data_source..secure` | No | Whether to use a secure connection to the SQL Server server. Set to `true` to use a secure connection. |
+- The catalog name `myanalytics` must match a catalog that exists on your ScalarDB Analytics server
+- The ScalarDB Analytics server is running at `analytics-server.example.com`
+- Tables will be accessed using the format: `myanalytics...`
-:::tip
+:::important
-You can use an arbitrary name for ``.
+The catalog name in your Spark configuration must match the name of a catalog created on the ScalarDB Analytics server using the CLI. For example, if you created a catalog named `production` on the server, you must use `production` as the catalog name in your Spark configuration properties (e.g., `spark.sql.catalog.production`, `spark.sql.catalog.production.server.host`, etc.).
:::
-
-
-
-| Configuration Key | Required | Description |
-|:---------------------------------------------------------------------------|:------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `spark.sql.catalog..data_source..type` | Yes | Always set to `dynamodb` |
-| `spark.sql.catalog..data_source..region` | Either `region` or `endpoint` must be set | The AWS region of the DynamoDB instance |
-| `spark.sql.catalog..data_source..endpoint` | Either `region` or `endpoint` must be set | The AWS endpoint of the DynamoDB instance |
-| `spark.sql.catalog..data_source..schema` | Yes | A JSON object representing the schema of the catalog. For details on the format, see [Catalog-level mappings](./design.mdx#catalog-level-mappings). |
-
-
-:::tip
+:::note
-You can use an arbitrary name for ``.
+Data source configurations are managed by the catalog server. For information on configuring data sources in the catalog server, see [Set up and administer the ScalarDB Analytics catalog server](./administration.mdx#configure-data-sources).
:::
-
-
-
-#### Example configuration
-
-Below is an example configuration for ScalarDB Analytics that demonstrates how to set up a catalog named `scalardb` with multiple data sources:
-
-```conf
-# Spark plugin configurations
-spark.jars.packages com.scalar-labs:scalardb-analytics-spark-all-_:
-spark.sql.extensions com.scalar.db.analytics.spark.extension.ScalarDbAnalyticsExtensions
-spark.sql.catalog.scalardb com.scalar.db.analytics.spark.ScalarDbAnalyticsCatalog
-
-# License configurations
-spark.sql.catalog.scalardb.license.key
-spark.sql.catalog.scalardb.license.cert_pem
-
-# Data source configurations
-spark.sql.catalog.scalardb.data_source.scalardb.type scalardb
-spark.sql.catalog.scalardb.data_source.scalardb.config_path /path/to/scalardb.properties
-
-spark.sql.catalog.scalardb.data_source.mysql_source.type mysql
-spark.sql.catalog.scalardb.data_source.mysql_source.host localhost
-spark.sql.catalog.scalardb.data_source.mysql_source.port 3306
-spark.sql.catalog.scalardb.data_source.mysql_source.username root
-spark.sql.catalog.scalardb.data_source.mysql_source.password password
-spark.sql.catalog.scalardb.data_source.mysql_source.database mydb
-```
-
-The following describes what you should change the content in the angle brackets to:
-
-- ``: The license key for ScalarDB Analytics
-- ``: The PEM-encoded certificate of ScalarDB Analytics license
-- ``: The major and minor version of Spark you are using (such as 3.4)
-- ``: The major and minor version of Scala that matches your Spark installation (such as 2.12 or 2.13)
-- ``: The version of ScalarDB Analytics
-
-### Add the ScalarDB Analytics dependency
-
-ScalarDB Analytics is hosted in the Maven Central Repository. The name of the package is `scalardb-analytics-spark-all-_:`, where:
-
-- ``: The major and minor version of Spark you are using (such as 3.4)
-- ``: The major and minor version of Scala that matches your Spark installation (such as 2.12 or 2.13)
-- ``: The version of ScalarDB Analytics
-
-For details about version compatibility, refer to [Version Compatibility](#version-compatibility).
+### Build configuration for Spark applications
-You can add this dependency to your project by configuring the build settings of your project. For example, if you are using Gradle, you can add the following to your `build.gradle` file:
+When developing Spark applications that use ScalarDB Analytics, you can add the dependency to your build configuration. For example, with Gradle:
```groovy
dependencies {
@@ -226,7 +96,7 @@ dependencies {
:::note
-If you want bundle your application in a single fat JAR file by using plugins like Gradle Shadow plugin or Maven Shade plugin, you need to exclude ScalarDB Analytics from the fat JAR file by choosing the appropriate configuration, such as `provided` or `shadow`, depending on the plugin you are using.
+If you bundle your application in a fat JAR using plugins like Gradle Shadow or Maven Shade, exclude ScalarDB Analytics from the fat JAR by using configurations such as `provided` or `shadow`.
:::
@@ -246,10 +116,10 @@ Depending on your environment, you may not be able to use all the methods mentio
:::
-With all these methods, you can refer to tables in ScalarDB Analytics using the same table identifier format. For details about how ScalarDB Analytics maps catalog information from data sources, refer to [Catalog information mappings by data source](./design.mdx#catalog-information-mappings-by-data-source).
+With all these methods, you can refer to tables in ScalarDB Analytics using the same table identifier format. For details about how ScalarDB Analytics maps catalog information from data sources, refer to [Catalog metadata reference](./administration.mdx#catalog-metadata-reference).
-
+
You can use a commonly used `SparkSession` class for ScalarDB Analytics. Additionally, you can use any type of cluster deployment that Spark supports, such as YARN, Kubernetes, standalone, or local mode.
@@ -263,7 +133,7 @@ dependencies {
}
```
-Below is an example of a Spark Driver application:
+Below is an example of a Spark driver application:
```java
import org.apache.spark.sql.SparkSession;
@@ -300,7 +170,7 @@ You can also use other CLI tools that Spark provides, such as `spark-sql` and `s
-You can use [Spark Connect](https://spark.apache.org/spark-connect/) to interact with ScalarDB Analytics. By using Spark Connect, you can access a remote Spark cluster and read data in the same way as a Spark Driver application. The following briefly describes how to use Spark Connect.
+You can use [Spark Connect](https://spark.apache.org/spark-connect/) to interact with ScalarDB Analytics. By using Spark Connect, you can access a remote Spark cluster and read data in the same way as a Spark driver application. The following briefly describes how to use Spark Connect.
First, you need to start a Spark Connect server in the remote Spark cluster by running the following command:
@@ -367,13 +237,9 @@ ScalarDB Analytics manages its own catalog, containing data sources, namespaces,
For details about how information in the raw data sources is mapped to the ScalarDB Analytics catalog, refer to [Catalog information mappings by data source](./design.mdx#catalog-information-mappings-by-data-source).
-### Catalog level mapping
-
-Each catalog level object in the ScalarDB Analytics catalog is mapped to a Spark catalog. The following table shows how the catalog levels are mapped:
-
-#### Data source tables
+### Catalog structure mapping
-Tables from data sources in the ScalarDB Analytics catalog are mapped to Spark tables. The following format is used to represent the identity of the Spark tables that correspond to ScalarDB Analytics tables:
+ScalarDB Analytics maps catalog structure from data sources to Spark catalogs. Tables from data sources in the ScalarDB Analytics catalog are mapped to Spark tables using the following format:
```console
...
@@ -388,66 +254,25 @@ The following describes what you should change the content in the angle brackets
For example, if you have a ScalarDB catalog named `my_catalog` that contains a data source named `my_data_source` and a schema named `my_schema`, you can refer to the table named `my_table` in that schema as `my_catalog.my_data_source.my_schema.my_table`.
-#### Views
-
-Views in ScalarDB Analytics are provided as tables in the Spark catalog, not views. The following format is used to represent the identity of the Spark tables that correspond to ScalarDB Analytics views:
-
-```console
-.view..
-```
-
-The following describes what you should change the content in the angle brackets to:
-
-- ``: The name of the catalog.
-- ``: The names of the view namespaces. If the view namespace names are multi-level, they are concatenated with a dot (`.`) as the separator.
-- ``: The name of the view.
-
-For example, if you have a ScalarDB catalog named `my_catalog` and a view namespace named `my_view_namespace`, you can refer to the view named `my_view` in that namespace as `my_catalog.view.my_view_namespace.my_view`.
-
-:::note
-
-`view` is prefixed to avoid conflicts with the data source table identifier.
-
-:::
-
-##### WAL-interpreted views
-
-As explained in [ScalarDB Analytics Design](./design.mdx), ScalarDB Analytics provides a functionality called WAL-interpreted views, which is a special type of views. These views are automatically created for tables of ScalarDB data sources to provide a user-friendly view of the data by interpreting WAL-metadata in the tables.
-
-Since the data source name and the namespace names of the original ScalarDB tables are used as the view namespace names for WAL-interpreted views, if you have a ScalarDB table named `my_table` in a namespace named `my_namespace` of a data source named `my_data_source`, you can refer to the WAL-interpreted view of the table as `my_catalog.view.my_data_source.my_namespace.my_table`.
-
### Data-type mapping
ScalarDB Analytics maps data types in its catalog to Spark data types. The following table shows how the data types are mapped:
-| ScalarDB Data Type | Spark Data Type |
-| :----------------- | :----------------- |
-| `BYTE` | `Byte` |
-| `SMALLINT` | `Short` |
-| `INT` | `Integer` |
-| `BIGINT` | `Long` |
-| `FLOAT` | `Float` |
-| `DOUBLE` | `Double` |
-| `DECIMAL` | `Decimal` |
-| `TEXT` | `String` |
-| `BLOB` | `Binary` |
-| `BOOLEAN` | `Boolean` |
-| `DATE` | `Date` |
-| `TIME` | `TimestampNTZ` |
-| `TIMESTAMP` | `TimestampNTZ` |
-| `TIMESTAMPTZ` | `Timestamp` |
-| `DURATION` | `CalendarInterval` |
-| `INTERVAL` | `CalendarInterval` |
-
-## Version compatibility
-
-Since Spark and Scala may be incompatible among different minor versions, ScalarDB Analytics offers different artifacts for various Spark and Scala versions, named in the format `scalardb-analytics-spark-all-_`. Make sure that you select the artifact matching the Spark and Scala versions you're using. For example, if you're using Spark 3.5 with Scala 2.13, you must specify `scalardb-analytics-spark-all-3.5_2.13`.
-
-Regarding the Java version, ScalarDB Analytics supports Java 8 or later.
-
-The following is a list of Spark and Scalar versions supported by each version of ScalarDB Analytics.
-
-| ScalarDB Analytics Version | ScalarDB Version | Spark Versions Supported | Scala Versions Supported | Minimum Java Version |
-|:---------------------------|:-----------------|:-------------------------|:-------------------------|:---------------------|
-| 3.16 | 3.16 | 3.5, 3.4 | 2.13, 2.12 | 8 |
-| 3.15 | 3.15 | 3.5, 3.4 | 2.13, 2.12 | 8 |
+| ScalarDB Analytics Data Type | Spark Data Type |
+| :--------------------------- | :----------------- |
+| `BYTE` | `Byte` |
+| `SMALLINT` | `Short` |
+| `INT` | `Integer` |
+| `BIGINT` | `Long` |
+| `FLOAT` | `Float` |
+| `DOUBLE` | `Double` |
+| `DECIMAL` | `Decimal` |
+| `TEXT` | `String` |
+| `BLOB` | `Binary` |
+| `BOOLEAN` | `Boolean` |
+| `DATE` | `Date` |
+| `TIME` | `TimestampNTZ` |
+| `TIMESTAMP` | `TimestampNTZ` |
+| `TIMESTAMPTZ` | `Timestamp` |
+| `DURATION` | `CalendarInterval` |
+| `INTERVAL` | `CalendarInterval` |
diff --git a/sidebars.js b/sidebars.js
index c20f5dae..3d803ff5 100644
--- a/sidebars.js
+++ b/sidebars.js
@@ -495,11 +495,6 @@ const sidebars = {
label: 'Analytics',
collapsible: true,
items: [
- {
- type: 'doc',
- id: 'scalardb-analytics/README',
- label: 'Overview',
- },
{
type: 'doc',
id: 'scalardb-analytics-postgresql/scalardb-fdw',