Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/scalardb-analytics/_README.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
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.

<WarningLicenseKeyContact product="ScalarDB Analytics with Spark" />

## Further reading

This section provides links to various ScalarDB Analytics–related documentation.

### Getting started

* [Getting Started with ScalarDB Analytics](./quickstart.mdx) - A quick tutorial to set up ScalarDB Analytics and run federated queries

### Key documentation

* [Overview](./overview.mdx) - Understand ScalarDB Analytics architecture and features
* [Deploy ScalarDB Analytics](./deployment.mdx) - Deploy on Amazon EMR, Databricks, and other platforms
* [Run Analytical Queries](./run-analytical-queries.mdx) - Execute queries across multiple databases
* [Administration Guide](./administration.mdx) - Manage catalogs and data sources
* [Configuration Reference](./configuration.mdx) - Configure Spark and data sources

### Technical details

* [Design Document](./design.mdx) - Deep dive into the technical architecture
* [Version Compatibility](./run-analytical-queries.mdx#version-compatibility) - Supported Spark and Scala versions
290 changes: 284 additions & 6 deletions docs/scalardb-analytics/design.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,294 @@ ScalarDB Analytics supports a wide range of data types across different data sou
- `DURATION`
- `INTERVAL`

These data types are used across all data sources and provide a unified type system for querying heterogeneous databases.
### Catalog information mappings by data source

### Data source integration
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.

When registering a data source to ScalarDB Analytics, two types of mappings occur:
#### Catalog-level mappings

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-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.

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.
<Tabs groupId="data-source" queryString>
<TabItem value="scalardb" label="ScalarDB" default>
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.

</TabItem>

<TabItem value="postgresql" label="PostgreSQL" default>
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.

</TabItem>
<TabItem value="mysql" label="MySQL">
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.

</TabItem>
<TabItem value="oracle" label="Oracle">
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`

</TabItem>
<TabItem value="sql-server" label="SQL Server">
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.

</TabItem>
<TabItem value="dynamodb" label="DynamoDB">
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": "<NAMESPACE_NAME>",
"tables": [
{
"name": "<TABLE_NAME>",
"columns": [
{
"name": "<COLUMN_NAME>",
"type": "<COLUMN_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.

</TabItem>
</Tabs>

#### 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.

<Tabs groupId="data-source" queryString>
<TabItem value="scalardb" label="ScalarDB" default>
| **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` |
</TabItem>
<TabItem value="postgresql" label="PostgreSQL" default>
| **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` |
</TabItem>
<TabItem value="mysql" label="MySQL">
| **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` |
</TabItem>
<TabItem value="oracle" label="Oracle">
| **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` |
</TabItem>
<TabItem value="sql-server" label="SQL Server">
| **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` |
</TabItem>
<TabItem value="dynamodb" label="DynamoDB">
| **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.

:::

</TabItem>
</Tabs>

## Query engine

Expand Down
Loading