Hologres external tables
This topic explains how to create a Hologres external table, including how to specify a Hologres data source, grant access using a RAM role or service-linked role, map a target table, and configure JDBC driver settings in the CREATE TABLE statement.
Overview
Hologres is a real-time interactive analytical data warehouse that is compatible with the PostgreSQL protocol and seamlessly integrated with MaxCompute. You can create a Hologres external table in MaxCompute to query a Hologres data source by using the PostgreSQL JDBC driver and Hologres RAM role authentication. This approach eliminates redundant storage, avoids data imports and exports, and delivers fast query results.
Limitations
Data manipulation (DML)
MaxCompute does not support
UPDATEorDELETEoperations on Hologres external tables.Hologres external tables do not support the
INSERT OVERWRITEstatement.To overwrite data in a Hologres table with data from MaxCompute, run an
INSERT OVERWRITEstatement in Hologres. This statement reads from an external table that maps to a MaxCompute table. For more information, see INSERT OVERWRITE.
Risk of data duplication
Writing large volumes of data to a Hologres external table uses parallel processes. In rare cases, one of these processes might rewrite data, causing data duplication.
Partitions
Partitioned tables in Hologres and MaxCompute do not map directly to each other. Hologres external tables do not support partitions. However, in direct-read mode, partition pruning is still possible. This occurs when you query a Hologres external table that maps to a Hologres partitioned parent table, and your query filters on the partition column of an underlying partitioned child table.
Hologres external tables do not support the
clusterattribute.Hologres external tables do not support mapping to a Hologres Dynamic Table.
Hologres external tables do not support direct reads of tables with row-level permissions enabled.
For a list of compatible data types, see Supported data types.
Permissions
Hologres external tables support two authorization methods:
RAM role-based authorization
Whether you use an Alibaba Cloud account (primary account), a RAM user, or a RAM role, you specify the role for accessing Hologres data in the
odps.properties.rolearnparameter. Create a RAM role, grant it permissions to access the Hologres database, and then set the role's ARN in theodps.properties.rolearnparameter.For detailed steps to create a role and grant permissions, see RAM role-based authorization for Hologres.
Service-linked role authorization (identity passthrough)
A service-linked role passes the accessor's identity to Hologres for authorization.
The accessor (Alibaba Cloud account, RAM user, or RAM role) must have permissions to access the Hologres database.
For detailed steps to create a service-linked role, see Service-linked role for Hologres (Identity Passthrough).
Create a Hologres external table
You can create a Hologres external table using one of the following two authorization modes: RAM role authorization mode and service-linked role authorization mode.
Usage notes
Guidelines for creating external tables
If you enable an IP whitelist for external access on your Hologres instance, upgrade your instance to the required version:
For the RAM role authorization mode, upgrade Hologres to V3.2 or later.
For the service-linked role authorization mode, upgrade Hologres to V2.0.28 or later.
After the upgrade, Hologres can trust the IP addresses of MaxCompute nodes based on the MaxCompute service identity or a service-linked role. You no longer need to add the IP addresses of MaxCompute elastic nodes to the IP whitelist for your Hologres instance.
You can map both parent tables and child tables in Hologres to an external table in MaxCompute. However, you can only read from, but not write to, an external table that is mapped to a parent table.
When you write data to a Hologres external table, the INSERT ON CONFLICT (UPSERT) mechanism is not supported. If the Hologres source table has a primary key, ensure that the data you write does not cause a primary key conflict with existing data in the source table.
Table names and column names are case-insensitive. You cannot enforce case sensitivity when you create or query tables and columns.
Schema compatibility
If the schema of the Hologres source table does not match the schema of the external table:
Mismatched column count: If the source table has fewer columns than the external table defined in the DDL statement, Hologres reports an error such as
column "xxx" does not existwhen you read data. If the source table has more columns than the external table, the extra columns are ignored.Mismatched column types: MaxCompute does not support reading STRING data from the Hologres source table into an INT column. Casting INT data to a STRING type is supported but not recommended.
Syntax
When you create an external table, you must specify the StorageHandler, provide authorization through either a RAM role or a service-linked role, and define the JDBC connection URL in the DDL statement to access the Hologres data source.
RAM role authorization
For a complete code sample, see Create a Hologres external table (RAM role authorization mode).
CREATE EXTERNAL TABLE [IF NOT EXISTS] <table_name>(
<col1_name> <data_type>,
<col2_name> <data_type>,
......
)
stored BY 'com.aliyun.odps.jdbc.JdbcStorageHandler'
WITH serdeproperties (
'odps.properties.rolearn'='<role_arn>')
location 'jdbc:postgresql://<endpoint>:<port>/<database>?
ApplicationName=MaxCompute&[currentSchema=<schema>&]
[useSSL={true|false}&]table=<holo_table_name>/'
tblproperties (
'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver',
'odps.federation.jdbc.target.db.type'='holo',
-- If the column names in Hologres and MaxCompute are different, you must add the odps.federation.jdbc.colmapping parameter to map the columns. You can omit this parameter if the column names are identical.
['odps.federation.jdbc.colmapping'='<table_column1>:<source_column1>,
<table_column2>:<source_column2>,...']
);Service-linked role authorization
For a complete code sample, see Create a Hologres external table (service-linked role authorization mode).
The service-linked role authorization mode allows a RAM user to access authorized tables in both MaxCompute and Hologres without requiring manual authorization. This mode also supports the Hologres IP whitelist feature, which simplifies access.
-- Create an external table
CREATE EXTERNAL TABLE [IF NOT EXISTS] <table_name>(
<col1_name> <data_type>,
<col2_name> <data_type>,
......
)
STORED BY 'com.aliyun.odps.jdbc.JdbcStorageHandler'
LOCATION 'jdbc:postgresql://<endpoint>:<port>/<database>?
ApplicationName=MaxCompute&[currentSchema=<schema>&]
[useSSL={true|false}&]table=<holo_table_name>/'
tblproperties (
'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver',
'odps.federation.jdbc.target.db.type'='holo',
-- If the column names in Hologres and MaxCompute are different, you must add the odps.federation.jdbc.colmapping parameter to map the columns. You can omit this parameter if the column names are identical.
['odps.federation.jdbc.colmapping'='<table_column1>:<source_column1>,
<table_column2>:<source_column2>,...']
);Parameters
Examples
Step 1: Prepare Hologres data
You can skip this step if you already have a Hologres database, a table, and test data.
Create a Hologres database
Log on to the Hologres management console. In the upper-left corner, select a region.
In the navigation pane on the left, click Instances.
If you do not have an instance, you must first purchase a Hologres instance.
On the Instances page, click the name of the target instance.
On the instance details page, click Connect to Instance.
Click the Metadata Management tab.
Click Create Database, enter the Database Name in the dialog box that appears, and leave the other parameters at their default settings.
Create a Hologres table
On the instance details page, click Connect to Instance.
Click the SQL Editor tab.
Run the following statements:
CREATE TABLE IF NOT EXISTS holo ( id INT PRIMARY KEY, name TEXT ); INSERT INTO holo (id, name) VALUES (1, 'kate'), (2, 'mary'), (3, 'bob'), (4, 'tom'), (5, 'lulu'), (6, 'mark'), (7, 'haward'), (8, 'lilei'), (9, 'hanmeimei'), (10, 'lily'), (11, 'lucy'); SELECT * FROM holo ORDER BY id;
Step 2: Create a Hologres external table
RAM role authorization
In this mode, you integrate a RAM role with Hologres data access permissions into the external table's definition. You can then grant permissions on this external table to other MaxCompute users. When a user accesses the external table, the system uses this integrated RAM role to access the mapped Hologres table.
Hologres does not support cross-account RAM roles. Therefore, both the RAM role and the MaxCompute project that accesses the Hologres external table must belong to the same Alibaba Cloud account.
Prerequisites
You have a MaxCompute project in which to create the Hologres external table.
For more information about how to create a MaxCompute project, see Create a MaxCompute project.
You have created and authorized a RAM role. For more information, see RAM role authorization for Hologres.
Create the external table
Log on to the MaxCompute client and switch to the target MaxCompute project.
Run the following command to create a Hologres external table.
The following example uses the Hologres instance information prepared in Step 1: Prepare Hologres data:
Hologres database name:
holo_external_testHologres database schema:
publicHologres table name:
holoHologres classic network endpoint:
hgprecn-cn-oew210ut****-cn-hangzhou-internal.hologres.aliyuncs.com:80
CREATE EXTERNAL TABLE IF NOT EXISTS my_table_holo_jdbc ( user_id bigint, user_name string ) stored BY 'com.aliyun.odps.jdbc.JdbcStorageHandler' WITH serdeproperties ( 'odps.properties.rolearn'='acs:ram::139699392458****:role/<role name>') location 'jdbc:postgresql://hgprecn-cn-oew210ut****-cn-<region>-internal.hologres.aliyuncs.com:80 /<holo database name>?ApplicationName=MaxCompute ¤tSchema=public&table=<table name>/' tblproperties ( 'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver', 'odps.federation.jdbc.target.db.type'='holo', -- If the column names of the Hologres source table and the Hologres external table are different, -- you must add the odps.federation.jdbc.colmapping parameter to map the columns. -- You can omit this parameter if the column names are identical. 'odps.federation.jdbc.colmapping'='user_id:id,user_name:name' );Run the following commands to query the Hologres source table using the newly created external table.
-- The following properties are required to access the Hologres external table. SET odps.sql.split.hive.bridge=true; SET odps.sql.hive.compatible=true; SET odps.table.api.enable.holo.table=true; --Enables direct read access over JDBC. -- Query data from the Hologres external table. SELECT * FROM my_table_holo_jdbc limit 10; -- The command returns the following result. +------------+------------+ | user_id | user_name | +------------+------------+ | 9 | hanmeimei | | 4 | tom | | 7 | haward | | 2 | mary | | 5 | lulu | | 8 | lilei | | 10 | lily | | 1 | kate | | 6 | mark | | 11 | lucy | +------------+------------+Use the Hologres external table to exchange data with Hologres and perform federated analysis.
Write data processed in MaxCompute to Hologres using the external table for accelerated analytics and online services. The following code provides an example.
-- The following properties are required to access the Hologres external table. SET odps.sql.split.hive.bridge=true; SET odps.sql.hive.compatible=true; SET odps.table.api.enable.holo.table=true; --Enables direct read access over JDBC. -- Insert data into the Hologres external table. INSERT INTO my_table_holo_jdbc VALUES (12,'alice'); -- Query data from the Hologres external table. SELECT * FROM my_table_holo_jdbc; -- The command returns the following result. +------------+------------+ | user_id | user_name | +------------+------------+ | 9 | hanmeimei | | 4 | tom | | 7 | haward | | 2 | mary | | 5 | lulu | | 12 | alice | | 8 | lilei | | 10 | lily | | 1 | kate | | 11 | lucy | | 6 | mark | | 3 | bob | +------------+------------+Store frequently updated dimension tables in Hologres to support real-time updates. MaxCompute accesses the dimension table using an external table and joins it with a fact table in MaxCompute for federated analysis. The following code provides an example.
-- The following properties are required to access the Hologres external table. SET odps.sql.split.hive.bridge=true; SET odps.sql.hive.compatible=true; -- Create a MaxCompute internal table. CREATE TABLE holo_test AS SELECT * FROM my_table_holo_jdbc; -- Join the MaxCompute internal table with the Hologres external table for analysis. SELECT * FROM my_table_holo_jdbc t1 INNER JOIN holo_test t2 ON t1.user_id=t2.user_id; -- The command returns the following result. +------------+------------+------------+------------+ | user_id | user_name |user_id2 | user_name2 | +------------+------------+------------+------------+ | 9 | hanmeimei | 9 | hanmeimei | | 4 | tom | 4 | tom | | 7 | haward | 7 | haward | | 2 | mary | 2 | mary | | 5 | lulu | 5 | lulu | | 12 | alice | 12 | alice | | 8 | lilei | 8 | lilei | | 10 | lily | 10 | lily | | 1 | kate | 1 | kate | | 11 | lucy | 11 | lucy | | 6 | mark | 6 | mark | | 3 | bob | 3 | bob | +------------+------------+------------+------------+
Service-linked role authorization
In this mode, you must create a service-linked role to access Hologres data. To prevent unauthorized access, this mode forwards the user's identity to Hologres for authentication. Therefore, the user must have permissions on both the external table and the underlying Hologres table.
Prerequisites
You have a MaxCompute project in which to create the Hologres external table.
For more information about how to create a MaxCompute project, see Create a MaxCompute project.
An account with the same name as your MaxCompute account must exist in Hologres. This account needs read permissions on the corresponding table.
Only Hologres V1.3 and later support creating Hologres external tables in MaxCompute by using the service-linked role authorization mode. Currently, this mode supports only reading from, not writing to, Hologres external tables.
Create the external table
Log on to the MaxCompute client and switch to the target MaxCompute project.
Run the following command to create a Hologres external table.
The following example uses the Hologres instance information prepared in Step 1: Prepare Hologres data:
Hologres database name:
holo_external_testHologres database schema:
publicHologres table name:
holoHologres classic network endpoint:
hgprecn-cn-oew210ut****-cn-hangzhou-internal.hologres.aliyuncs.com:80
CREATE EXTERNAL TABLE IF NOT EXISTS holo_mc_external_dbl ( user_id int, user_name string ) STORED BY 'com.aliyun.odps.jdbc.JdbcStorageHandler' location 'jdbc:postgresql://hgpostcn-cn-****-cn-<region>-internal.hologres.aliyuncs.com:80 /<holo database name>?ApplicationName=MaxCompute ¤tSchema=public&table=<table name>/' TBLPROPERTIES ( 'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver', 'odps.federation.jdbc.target.db.type'='holo', -- If the column names of the Hologres source table and the Hologres external table are different, -- you must add the odps.federation.jdbc.colmapping parameter to map the columns. -- You can omit this parameter if the column names are identical. 'odps.federation.jdbc.colmapping'='user_id:id,user_name:name' );Query the external table.
SELECT * FROM holo_mc_external_dbl; -- The command returns the following result. +------------+------------+ | user_id | user_name | +------------+------------+ | 9 | hanmeimei | | 4 | tom | | 7 | haward | | 2 | mary | | 5 | lulu | | 12 | alice | | 8 | lilei | | 10 | lily | | 1 | kate | | 11 | lucy | | 6 | mark | | 3 | bob | +------------+------------+
Enable direct read for Hologres external tables
By default, MaxCompute reads data from Hologres external tables through a JDBC connection. To improve performance, you can enable direct read mode, which allows MaxCompute to access the Hologres storage layer directly. This mode offers several benefits:
Improved read stability.
Significantly reduces read latency and accelerates data queries.
Integrates with predicate pushdown to push query filter conditions to Hologres, reducing the amount of data scanned and lowering costs.
Drastically reduces connections to the Hologres frontend (FE), minimizing performance overhead on the Hologres instance. Most queries require only a single connection.
Limitations
Direct read mode has the following limitations. If these conditions are not met, a query automatically falls back to JDBC mode.
Version requirements
Your Hologres instance must be V1.3.34 or later. Direct read mode is not supported in earlier versions.
Table type restrictions
Direct read mode is not supported for Hologres cold storage tables.
Direct read mode is not supported for Hologres row-oriented tables.
Data type mapping limitations
In direct read mode, mapping a Timestamp With Time Zone type in Hologres to a TIMESTAMP type in MaxCompute can cause minor time discrepancies:
Time value discrepancy
For timestamps before
1900-12-31 15:54:15, the time returned by MaxCompute is ahead by 5 minutes and 44 seconds.For timestamps between
1900-12-31 15:54:16and1969-12-31 23:59:58, the time returned by MaxCompute is ahead by 1 second.For timestamps after
1969-12-31 23:59:59, the times in Hologres and MaxCompute are identical.
Time zone offset
For example, if the MaxCompute time zone is UTC+8 and a Timestamp With Time Zone column in Hologres is
2000-01-01 00:00:00, MaxCompute returns2000-01-01 08:00:00.For example, if the MaxCompute time zone is UTC+8 and a Timestamp With Time Zone column in Hologres is
1969-01-01 00:00:00, MaxCompute returns1969-01-01 08:00:01.
Same-region restriction
Due to network connectivity constraints, MaxCompute can access only Hologres instances in the same region. Cross-region access fails with the following error:
FAILED: ODPS-0010000:System internal error - fuxi job failed, caused by: Pangu request failed with error code 3.If your Hologres instance uses a primary/secondary architecture, you can specify only the primary instance in the connection URL, not a secondary instance.
Additional limitation for Foreign Server mode: You must enable the schema-level syntax switch for the MaxCompute project.
Enable direct read mode
To enable direct read mode for your session, add the following command before your SQL query in MaxCompute:
SET odps.table.api.enable.holo.table=true;You can also enable direct read mode at the project level.
-- You can enable direct read and disable JDBC fallback at the project level.
-- Enable direct read at the project level:
setproject odps.table.api.enable.holo.table=true; -- Set to true to enable, false to disable.
-- Disable the default fallback to JDBC:
setproject odps.table.api.allow.fallback.jdbc=false; -- Set to true to allow fallback, false to prevent it.Verify direct read mode
You can verify that a query used direct read mode by checking the logs in Logview. For more information, see Use Logview 2.0 to view job running information.
On the Summary tab in Logview, find the external holo tables field. The format is:
<project_name>.<table_name>:<access_mode>[<(fallback_reason)>]Parameters:
Parameter | Description |
project_name | The name of the project. |
table_name | The name of the table. |
access_mode | The access mode for the external table. Valid values:
|
When a job using direct read mode encounters a limitation, it automatically reverts to JDBC mode. Under heavy workloads, this fallback can consume significant resources from the Hologres connection pool. Because data transfer in JDBC mode is less efficient than in direct read mode, resources are released more slowly. This increases the load on your Hologres instance.
Frequent fallbacks can impact other business-critical services that rely on the same Hologres instance. To prevent this, you can disable the automatic fallback mechanism by adding the set odps.table.api.allow.fallback.jdbc=false; parameter to your jobs. This setting causes jobs to fail instead of silently falling back, preventing unexpected performance degradation.
Predicate pushdown for Hologres external tables
When MaxCompute accesses a Hologres external table, it can push down query filter conditions to Hologres for execution. This process, called predicate pushdown (PPD), filters data at the source to reduce data transfer and improve query performance. The following scenarios and usage instructions describe how to implement predicate pushdown for Hologres external tables.
When MaxCompute queries a Hologres external table, it first parses the WHERE conditions in the query to identify filter expressions that can be pushed down, and then applies the corresponding optimizations based on the read mode.
JDBC mode:
MaxCompute adds conditions that can be pushed down to the SQL statement sent to Hologres. Hologres performs the filtering and returns the data. For more information, see Hologres JDBC PPD (JDBC reads).
Direct storage read mode:
The following sections describe the optimization process for physical partition tables and logical partition tables. Both types use the same approach, progressively narrowing the scan from partitions to files, then to data blocks within files. Optimizations at each layer take effect when their applicability conditions are met and can be combined. Pruning based on statistics can only exclude data that is certain not to match; it cannot replace complete row-level evaluation of the filter conditions.
For physical partition tables, partition conditions are used to prune partitioned child tables that do not match. For more information, see Physical partition pruning in Hologres.
For logical partition tables, the following optimizations are described in read order: Hologres Snapshot PPD (direct reads) on the Hologres side, Segment Key file pruning on the MaxCompute side (coming soon), and Column-level filtering of ORC row groups. Optimizations at each layer take effect when their applicability conditions are met. MaxCompute evaluates the remaining filter conditions after reading the data.
Execution flow for predicate pushdown and data pruning

Hologres Snapshot PPD (direct reads)
Scenario description
In Hologres direct read scenarios, when querying a logical partition table, MaxCompute converts the filter expression into a SQL
WHEREclause, which is passed to the Hologres server throughholo_create_table_snapshot()as itsfilterparameter. This allows Hologres to filter files on the server side when creating the snapshot, preventing non-matching files from being returned to MaxCompute and reducing data transfer.Usage notes
Scenario
Description
Key parameter
predicate_pushdown_modeoff: Disables predicate pushdown. All data is read. This option can be used for debugging and comparison in development environments.
on: Enables predicate pushdown. Only a filtered snapshot is created. This setting is recommended for production environments.
debug: Creates two snapshots to compare performance. This option can be used for performance testing and troubleshooting.
Supported types
INT, BIGINT, STRING, DATE, TIMESTAMP, BINARY
Limitations
UDFs and built-in functions are not supported.
CAST expressions that rely on implicit type conversion are not supported.
The jsonb type is not supported.
Hologres primary key tables are not supported.
Applicable scenarios
The Hologres instance must support PPD. This requires one of the following versions:
>=3.1.36
>=3.2.18
>=4.0.7
Usage examples
Prepare data in Hologres.
Create a Hologres external table. Do not specify a partition field. Instead, define the partition field as a regular column.
In direct read mode, specify pushdown parameters when querying partition data from the external table to implement partition pruning.
Physical partition pruning in Hologres
Scenario description
Create an external table based on the parent table of a Hologres physical partition table. Define the partition key as a regular column, not as a partition column. Filter on the partition key in queries to prune partitions.
Usage examples
Prepare data in Hologres.
Create a Hologres external table based on the partitioned parent table. Define the partition key as a regular column, not as a partition column.
In direct read mode, query conditions can be specified directly to implement partition pruning.
Column-level filtering of ORC row groups
Scenario description
MaxCompute performs file-level filtering by building a SearchArgument for each ORC file and passing it to the ORC Reader. The reader then uses column statistics (min, max, and count) from each stripe and row group to determine whether the entire row group can be skipped.
This optimization applies to large datasets. In ORC files, every 10,000 rows form a row group. If the dataset is too small, the filtering benefit is limited.
Usage notes
Scenario
Description
Key parameter
odps.external.holo.use.predicate.pushdowntrue: Enables filtering.
false: Disables filtering (default).
Supported types
BOOLEAN, INT, BIGINT, FLOAT, DOUBLE, DECIMAL, STRING, DATE, TIMESTAMP
Usage examples
Prepare the data. Create a test table in the Hologres instance.
Create a Hologres external table in MaxCompute.
Query data from the external table.
To confirm that filtering was successful, check for the following in the stdout details of the instance in Logview:
Check TableScan1 for
IOCountandIOLatencyPercentiles.In TableScan1, check whether
ReadRowCountis less thanRequestedRowCount.
Hologres JDBC PPD (JDBC reads)
Scenario description
JDBC reads add conditions that can be pushed down to the SQL statement for execution by Hologres. When Hologres direct read is disabled (
odps.table.api.enable.holo.table=false), queries are executed over a JDBC connection. In this case, PPD works by appending the WHERE clause to the JDBC SQL statement sent to Hologres, which then performs filtering at the SQL layer. This mechanism differs from PPD in direct read scenarios:Direct read PPD: Filters files at the snapshot level.
JDBC PPD: Filters rows at the SQL query level.
Usage notes
Scenario
Description
Key parameter
odps.external.hive.scan.ppd.enabledaccepts the following values:true: Enables predicate pushdown.
false: Disables predicate pushdown.
Supported types
INT, BIGINT, DOUBLE, FLOAT, STRING, DATE, TIMESTAMP, TIMESTAMP_NTZ
Limitations
UDFs and built-in functions are not supported.
CAST expressions are not supported.
The jsonb type is not supported.
Hologres primary key tables are not supported.
Applicable scenarios
When the Hologres instance does not support PPD.
As a fallback solution for Hologres direct read scenarios.
Usage examples
Prepare the data. Create a test table in the Hologres instance and insert data into it.
Create a Hologres external table in MaxCompute.
Query data from the external table.
Hologres data import and export
Supported data types
DECIMAL type limitations:
For a Hologres external table created in MaxCompute, the
DECIMALdata type is fixed todecimal(38,18)and cannot be modified. If the source table has fewer decimal places, you can define the column as theSTRINGtype in the MaxCompute external table and use theCASTfunction to explicitly cast the data when it is used.Complex type limitations:
Hologres external tables created in MaxCompute do not support complex data types such as
MapandStruct. TheArraytype is supported with limitations, as detailed in the table that follows.Other incompatible types:
Hologres data types such as
MONEYare not supported because they lack a corresponding type in MaxCompute.
The following table lists the data type mappings between Hologres and MaxCompute.
Hologres data type | MaxCompute data type | JDBC read | JDBC write | Direct read (odps.table.api.enable.holo.table=true) | Description |
INTEGER (alias: INT or INT4) | INT | A 32-bit signed integer. | |||
TEXT | STRING, VARCHAR | A string type with a current length limit of 8 MB. | |||
SMALLINT | SMALLINT | A 16-bit signed integer. | |||
INT2 | SMALLINT | A 16-bit signed integer. | |||
BIGINT (alias: INT8) | BIGINT | A 64-bit signed integer. | |||
BYTEA | BINARY | A binary data type. This mapping has a length limit of 8 MB, while the native | |||
REAL (alias: FLOAT4) | FLOAT | A 32-bit binary floating-point number. | |||
DOUBLE PRECISION (alias: FLOAT8) | DOUBLE | A 64-bit binary floating-point number. | |||
BOOLEAN (alias: BOOL) | BOOLEAN | A Boolean value ( | |||
TIMESTAMP | TIMESTAMP_NTZ | The Hologres It maps to the | |||
TIMESTAMP WITH TIME ZONE (alias: TIMESTAMPTZ) | TIMESTAMP | The Hologres The system handles precision conversion, but the time zone information is lost. | |||
DECIMAL (alias: NUMERIC) | DECIMAL(precision,scale) | A base-10 exact numeric type.
The | |||
CHAR(n) | CHAR(n) | In MaxCompute, In Hologres, | |||
VARCHAR(n) | VARCHAR(n) | MaxCompute's In Hologres, the maximum size of | |||
DATE | DATE | Date type. The format is | |||
INT4[] | ARRAY<INT> | Hologres arrays map to the corresponding MaxCompute | |||
INT8[] | ARRAY<BIGINT> | ||||
FLOAT4[] | ARRAY<FLOAT> | ||||
FLOAT8[] | ARRAY<DOUBLE> | ||||
BOOLEAN[] | ARRAY<BOOLEAN> | ||||
TEXT[] | ARRAY<STRING> | ||||
JSONB | JSON | Hologres | |||
JSON | STRING | In JDBC mode, the Hologres | |||
SERIAL (auto-increment) | INT | MaxCompute reads Hologres | |||
RoaringBitmap | Not supported | MaxCompute has no corresponding type. | |||
RoaringBitmap64 | Not supported | MaxCompute has no corresponding type. | |||
BIT(n) | Not supported | MaxCompute has no corresponding type. | |||
VARBIT(n) | Not supported | MaxCompute has no corresponding type. | |||
INTERVAL | Not supported | MaxCompute has no corresponding type. | |||
TIMETZ | Not supported | MaxCompute has no corresponding type. | |||
TIME | Not supported | MaxCompute has no corresponding type. | |||
INET | Not supported | MaxCompute has no corresponding type. | |||
MONEY | Not supported | MaxCompute has no corresponding type. | |||
OID | Not supported | MaxCompute has no corresponding type. | |||
UUID | Not supported | MaxCompute has no corresponding type. |
FAQ
ODPS-0130071 error in direct read mode
Problem
When you read data from Hologres in direct read mode, the job fails with an error similar to
ODPS-0130071 Failed to split to equal size...max count: 7777:ODPS-0130071:[0,0] Semantic analysis exception - physical plan generation failed: storage/table/src/input_splits_builder.cpp(195): StorageException: Failed to split to equal size, total size: 2143570729934, min size: 268435456, max size: 272629760, max count: 7777, split size: 275629513, split count: 7777Cause
MaxCompute's default data splitting strategy for mappers divides the input data volume by a
split.sizeof 256 MB. This can cause the number of concurrent mappers to exceed the maximum of 7,777.NoteThis limit prevents jobs from creating too many mappers, protecting the stability of Hologres files and network connections.
Solution
To resolve this error, set the following parameters.
SET odps.external.holo.mapper.instances=10000; -- Increases the concurrency limit to a value no greater than 10,000. SET odps.sql.mapper.split.size=512; -- Adjusts the mapper split size to a value no greater than 512 MB.
Slow SQL jobs on Hologres external tables
Problem
Performance is slow when you use an SDK to query data in a MaxCompute external table.
Solution
Queries on external tables are slow because external tables support only full table scans. For better performance, use a MaxCompute internal table instead.
Error with keyword column names
Problem
If a column name in your Hologres table is a keyword, queries fail with the following errors:
ODPS-0123131:User defined function exception - SQLException in nextKeyValueCaused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near ","Solution
Add the
odps.federation.jdbc.colmappingparameter to map the columns between the Hologres source table and the Hologres external table.For example, if the Hologres source table has a column named
"offset", which is a keyword, add the'odps.federation.jdbc.colmapping'='offset:"offset"'parameter when you create the Hologres external table.
Why, when I use the service-linked role authorization mode to read an external table, is the error reported password authentication failed for user "mcslr$STS.******", and how do I resolve it?
Problem
When a RAM user or a user who assumes a RAM role reads a Hologres external table in service-linked role authorization mode, the job fails with the
password authentication failed for user "mcslr$STS.******"error.Caused by: java.lang.RuntimeException: java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: pooler: c0a981a2413b5: password authentication failed for user "*******$V2#****#TMP.3KvMuCpXhuMbeZsbpaE****m738WfEw73rze ohJUeXxhsKza1khCxdKSJQAU5CFac*****qDCA#STS.NZFkZ3TbJNmAjS2TKLdUHHdiW#**.*.*.***" at org.apache.hadoop.mapreduce.lib.db.DBInputFormat.setConf(DBInputFormat.java:171) at com.aliyun.odps.jdbc.wrapper.InputFormatWrapper.checkAndInitDbInputFormat(InputFormatWrapper.java:48) ... 45 more Caused by: java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR: pooler: c0a981a2413b5: password authentication failed for user "*******$V2#****#TMP.3KvMuCpXhuMbeZsbpaE****m738WfEw73rzeohJUeXxhsKza1khCxdKSJQAU 5CFac*****qDCA#STS.NZFkZ3TbJNmAjS2TKLdUHHdiW#**.*.*.***" at org.apache.hadoop.mapreduce.lib.db.DBInputFormat.createConnection(DBInputFormat.java:205) at com.aliyun.odps.jdbc.impl.JdbcDBInputFormat.superCreateConnection(JdbcDBInputFormat.java:69) at com.aliyun.odps.jdbc.impl.JdbcDBInputFormat.createConnection(JdbcDBInputFormat.java:56) at org.apache.hadoop.mapreduce.lib.db.DBInputFormat.setConf(DBInputFormat.java:164)This error occurs because the service-linked role authorization mode was not applied successfully.
Solution
Add the
set odps.external.holo.enable.slr = force;parameter before the SQL statement to enforce the service-linked role authorization mode.
PPD error in direct read modeHolo-side PPD disabled --> The Holo snapshot PPD mode is enabled, but FAILED to push down the filter into Holo
Error message
Holo-side PPD disabled --> The Holo snapshot PPD mode is enabled, but FAILED to push down the filter into Holo, errorMsg[storage/table/src/holo/snapshot.cpp(319): StorageException: Create/Get snapshot failed for table: test_multi_type_ppd partition: Query:select holo_create_table_snapshot('public.test_multi_type_ppd', 259200, filter=>$$c_id = 3$$) with error ERROR: internal error: Failed to build fragment dag desc: node type 65 is not supportedSolution
Ensure that your Hologres internal table meets the requirements in Usage notes.
Troubleshooting fallback to JDBC mode
On the Summary tab in Logview, if the external holo tables section displays "Fallback", it indicates that the query did not run in direct read mode and fell back to JDBC mode. The following table lists common causes and solutions.
Error details | Root cause | Solution |
Column name <col> Odps type <X> Holo type <Y>. Examples:
| Column type mapping error | The column types of the Hologres external table do not match the source table. To enable direct read mode, modify the data types in the external table according to the data type mapping. |
Odps table schema invalid | This is a general error. For details, see the Error Logs in Logview. |
If the issue persists, join the MaxCompute developer community on DingTalk for support by clicking the application link or searching for group ID |
Holo connection error | Hologres instance connection error | This error can be caused by incorrect permissions or an abnormal Hologres instance status. Verify that the current user has the required permissions to access the Hologres database. Also, check whether the Hologres instance is in a serviceable state. |
Select hg_version error/Hologres version check error/Fetch hg_version data error | Incorrect Hologres instance version | Upgrade the Hologres instance to V1.3.34 or later. For more information about how to upgrade an instance, see Upgrade an instance. |
Related documents
For common issues with Hologres foreign tables, see Lakehouse and Foreign Table FAQ.
To create a cross-account Hologres foreign table, see Create a cross-account Hologres foreign table.