JindoTable uses a native engine to accelerate queries on ORC or Parquet files in Spark, Hive, or Presto. This topic explains how to enable native query acceleration to improve the performance of Spark, Hive, and Presto.
Prerequisites
You must have an E-MapReduce cluster with your ORC or Parquet files stored in JindoFS or OSS. For more information, see Create a cluster.
Limitations
-
Binary type files cannot be accelerated.
-
Partitioned tables are not supported if the values of their partition key columns are stored in the data files.
-
E-MapReduce clusters of version EMR-5.X and later are not supported.
-
Using
spark.read.schema(userDefinedSchema)is not supported. -
Date types are supported only within the range of 1400-01-01 to 9999-12-31.
-
Tables that contain column names differing only in case (for example,
NAMEandname) are not supported. Column names are treated case-insensitively during native query acceleration. -
The supported engines and storage formats for Spark, Hive, and Presto are as follows.
Engine
ORC
Parquet
Spark2
Supported
Supported
Spark3
Supported
Supported
Presto
Supported
Supported
Hive2
Not supported
Supported
Hive3
Not supported
Supported
-
The supported engines and storage file systems for Spark, Hive, and Presto are as follows.
Engine
OSS
JindoFS
HDFS
Spark2
Supported
Supported
Supported
Presto
Supported
Supported
Supported
Hive2
Supported
Supported
Not supported
Hive3
Supported
Supported
Not supported
Improve Spark performance
-
Enable JindoTable ORC or Parquet acceleration.
Note-
Native query acceleration uses off-heap memory. We recommend adding the
--conf spark.executor.memoryOverhead=4gconfiguration to your Spark job to allocate additional resources for acceleration. -
To read ORC or Parquet files in Spark, you must use the DataFrame API or Spark SQL.
-
Global settings
-
Go to the cluster details page.
-
Log on to the E-MapReduce console.
-
In the top navigation bar, select a region and resource group as needed.
-
Click the Clusters tab.
-
On the Clusters page, find the cluster and click Details in the Actions column.
-
-
Modify the configuration.
-
In the left-side navigation pane, choose .
-
On the Spark service page, click the Configure tab.
-
In the search box, locate the spark.sql.extensions parameter and set its value to io.delta.sql.DeltaSparkSessionExtension,com.aliyun.emr.sql.JindoTableExtension.
-
-
Save the configuration.
-
Click Save.
-
In the Confirm dialog box, enter a Execution Reason and click OK.
-
-
Restart the ThriftServer.
-
In the upper-right corner, choose .
-
In the Cluster Activities dialog box, enter a Execution Reason and click OK.
-
In the Confirm dialog box, click OK.
-
-
-
Job-level settings
When you run spark-shell or spark-sql, add the following Spark startup parameter:
--conf spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension,com.aliyun.emr.sql.JindoTableExtensionFor more information about jobs, see Configure a Spark Shell job or Configure a Spark SQL job.
-
-
Verify that acceleration is enabled.
-
Log on to the Spark History Server UI.
-
On the SQL page of the Spark UI, view the execution job.
If
JindoDataSourceV2Scanappears, acceleration is enabled. If not, check the configurations in Step 1. On the Details for Query 10 page, the Directed Acyclic Graph (DAG) shows the execution plan. For example, JindoDataSourceV2Scan can scan 15.6 GB of data (about 14 billion rows), which is then filtered to 2.7 billion rows. A final HashAggregate operation outputs 4,722 rows, and the total query takes 2.3 minutes.
-
Improve Presto performance
Presto queries have high concurrency, and native query acceleration uses off-heap memory. Therefore, you must allocate more than 10 GB of memory for query acceleration.
Presto has a built-in catalog for JindoTable native acceleration named hive-acc. You can use the hive-acc catalog to enable native query acceleration.
Example:
presto --server emr-header-1:9090 --catalog hive-acc --schema default
Native query acceleration for Presto does not currently support reading complex data types such as Map, Struct, or Array.
Improve Hive performance
If strict job stability is required, we recommend not enabling native query acceleration.
You can improve Hive performance in one of the following ways:
-
Use the console
In the console, go to the Configure page of the Hive service. Locate the hive.jindotable.native.enabled custom parameter and set its value to true. Save the configuration and restart the service to apply the change. This method applies to both Hive on MR and Hive on Tez.
-
Use the CLI
In the CLI, set
hive.jindotable.native.enabledtotrueto enable native query acceleration. Because E-MapReduce V3.35.0 and later include the JindoTable Parquet acceleration plug-in, you can set this parameter directly.set hive.jindotable.native.enabled=true;
Native query acceleration for Hive does not currently support reading complex data types such as Map, Struct, or Array.