Red Hat Training

A Red Hat training course is available for Red Hat JBoss Data Virtualization

13.24. OLAP Translator

13.24.1. OLAP Translator

The OLAP translator exposes stored procedures for calling analysis services backed by an OLAP server using MDX query language.
The OLAP translator is implemented by the org.teiid.translator.olap.OlapExecutionFactory class and known by the translator type name olap.
This translator exposes a stored procedure, invokeMDX, that returns a result set containing tuple array values for a given MDX query. invokeMDX will commonly be used with the ARRAYTABLE table function ( Section 3.6.9, “Nested Tables: ARRAYTABLE”) to extract the results.
Since the Cube metadata exposed by the OLAP servers and relational database metadata are so different, there is no single way to map the metadata from one to other. It is best to query OLAP system using its own native MDX language through. MDX queries my be defined statically or built dynamically in the JBoss Data Virtualization abstraction layers.

Note

The resource adapter for this translator is provided by configuring the data source in the JBoss EAP instance. Two sample datasource files are provided for accessing OLAP servers. One is Mondrian specific when the Mondrian server is deployed in the same JBoss EAP instance as JBoss Data Virtualization (mondrian.xml). To access any other OLAP servers using XMLA interface, the data source for them can be created using the example template in olap-xmla.xml. These example files can be found in the EAP_HOME/docs/teiid/datasources/ directory. See the Red Hat JBoss Data Virtualization Administration and Configuration Guide for more configuration information.

13.24.2. OLAP Translator: Usage

The OLAP translator exposes one low level procedure for accessing OLAP services: invokeMDX.
invokeMdx returns a result set of the tuples as array values.
Procedure invokeMdx(mdx in STRING, params VARIADIC OBJECT) returns table (tuple object)
The mdx parameter is a MDX query to be executed on the OLAP server.
The results of the query will be returned such that each row on the row axis will be packed into an array value that will first contain each hierarchy member name on the row axis then each measure value from the column axis.

Note

Consider using data roles to prevent arbitrary MDX from being submitted to the invokeMDX procedure. See Section 7.1, “Data Roles”.

13.24.3. OLAP Translator: Native Queries

OLAP source procedures may be created using the teiid_rel:native-query extension. See Section 13.7, “Parameterizable Native Queries”.

Note

The parameter value substitution directly inserts boolean, and number values, and treats all other values as string literals.
The procedure will invoke the native query similar to an invokeMdx call with the benefits that the query is predetermined and that result column types are known, rather than requiring the use of ARRAYTABLE ( Section 3.6.9, “Nested Tables: ARRAYTABLE”) or similar functionality.

13.24.4. OLAP Translator: Native Procedure

The invokeMdx procedure is the native procedure for the OLAP translator. It may be disabled or have its name changed via the common native translator properties like any other source. A call to a native procedure without any parameters will not attempt to parse the MDX query for parameterization. If parameters are used, the value substitution directly inserts boolean, and number values, and treats all other values as string literals.