Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

JBoss Data Virtualization: Integrating with Impala on Cloudera

February 8, 2018
Mike Echevarria
Related topics:
Artificial intelligenceDeveloper Tools
Related products:
Developer ToolsRed Hat JBoss Enterprise Application Platform

Share:

    Cloudera Impala is a tool to rapidly query Hadoop data in HBase or HDFS using SQL syntax.  You can use Red Hat JBoss Data Virtualization to query that same data via Impala to take advantage of its optimization. You can also combine that data with other data sources in real time.  The goal of this guide is to import data from a Cloudera Impala instance, manipulate it, and then expose that data as a data service.  This guide includes access to a repository with example scripts, creating a custom base and view model, exposing it as a data service, and finally consuming that data via REST. This is a peer article to Unlock Your Cloudera Data with Red Hat JBoss Data Virtualization.

    Integrating with Impala on Cloudera

      1. Setup
      2. Check the Source Model
      3. Create the View Model
      4. Add a custom property to the view
      5. Deploy the VDB
      6. Consume the data service via REST

    Setup

    • Download Cloudera all in one vm for the Virtualization platform you have installed. This example was done on KVM.
    • You will need to populate your Impala instance. This example works off data from the Getting Started with Hadoop Tutorial.
    • We are going to be importing data from the Orders table. Go to the Impala interface in Cloudera HUE and verify that the example data was loaded successfully:

    • Install JBoss Data Virtualization (JDV). Make sure the odata role is checked while going through the installation wizard.
    • Install JBoss Developer Studio (JBDS). After installation, under the Software/Update tab, install JBoss Data Virtualization Development. If you do not see that option, check the Enable Early Access checkbox in the lower right.
    • Details around installing JDV and JBDS are available on Red Hat's JDV Development Workshop page.
    • You need to create a Cloudera data source outside of the teiid designer in order to connect to hive. This project brings the libraries from the Impala JDBC Connector 2.5.42 for Cloudera Enterprise.
    • Clone the jdv-cloudera repo to get some helper scripts with creating data sources on the JDV server:
    git clone https://github.com/mechevarria/jdv-cloudera
    • Run the setup-ds.sh script with the add all option to create and/or remove the module, driver, and data source. You need to set the path to your Jboss home directory in the cli.sh script. You will also need to tweak the cli/add-ds.cli for your specific impala connection information. If successful, you will see the following output:
    {"outcome" => "Success"}
    • To verify the data source is correct, test the data source connection in the Jboss admin console:

    Connect Impala to JDV

    • We are going to create a new project in JBoss Developer Studio.  After opening the JBDS, you can follow these steps and screenshots to get started creating the project.
    • file -> new -> teiid model project
    • (See Screenshot)server panel -> start the jdv server. Make sure the admin and jdbc connection (teiidUser) are set with the proper user/pass from the install:

    • In the designer we are going to use the proprietary Cloudera Impala driver instead of the built in translator.  We are going to follow the same steps for importing a data source but create a custom connection just for Impala:
    • file -> import -> JDBC Database >> source model
    • Select New Connection Profile.
    • Select Generic JDBC and then next:

    • Select the New Driver Definition button.
    • Under the JAR List tab, add all of the jars from the directory:

    • Under the properties tab update the Driver Class to be com.cloudera.impala.jdbc41.Driver and the connection url to be jdbc:impala://localhost:21050

    • After selecting ok and returning to the connection profile, change localhost to the hostname or IP address of the impala server. In my case it was cloudera-vm.
    • Set the username and password. For the quickstart vm both values are cloudera.
    • Select Next and then select the orders table for import:

    • Set Model Name to OrderDS.xmi and set the JNDI Name to java:/OrderDS
    • Selecting Finish will create the source model.

    Check the Source Model

      • Right-click and select modeling -> preview data. The SQL Results pane will show the data:

    Create the View Model

    • Now that we have a base model imported, we are going to create a view model on top of that base model.  View models are where data composition occurs, and we are going to compose a custom field in this view model.
    • Select file -> new -> teiid metadata model
    • Name: OrderView, model type: View Model. Select transform from existing model and next.
    • Select the OrderDS model and select finish:

    Add a custom property to the view

    • We are going to transform the order date column from a long value in milliseconds into a timestamp that can be filtered by a client application.
    • Double click the T in the OrderView modeling diagram and then select the Reconcile SQL Transformation button:

    • Select the plus button Then select order_date.
    • Select the <new button and then rename the field to order_data_formatted
    • Select ok.
    • In the Transformation Editor replace the value OrderDS.orders.order_date with:
      TIMESTAMPADD(SQL_TSI_SECOND, cast((OrderDS.orders.order_date / 1000) AS integer), {ts'1970-01-01 23:59:59.0'})
    • For reference, these are the available Date/Time Functions.
    • Select the Save and Validate button.
    • Save the updated View model.
    • The complete transformation query should be:
    SELECT
    OrderDS.orders.order_id,
    OrderDS.orders.order_date,
    OrderDS.orders.order_customer_id,
    OrderDS.orders.order_status,
    TIMESTAMPADD(SQL_TSI_SECOND, cast((OrderDS.orders.order_date / 1000) AS integer), {ts'1970-01-01 23:59:59.0'}) AS order_date_formatted
    FROM
    OrderDS.orders

    Deploy the VDB

    • Now that we have created our models we need to move them from our studio workspace and deploy them on the JBoss Data Virtualization server. A virtual database or vdb is what is ultimately deployed to a running JBoss Data Virtualization server.  We need to add our models to a vdb just tables to an actual database.
    • file -> new -> teiid vdb
    • Name the vdb ImpalaVDB.
    • Select the OrderView to add and finish. This will automatically bring the OrderDS as well:

    • To deploy, select the Deploy button.

    Consume the data service via REST

    • Now that our data service is active we want to access that data.
    • For this example, Postman was used to test.  You can use your browser as well but you need to add a parameter to the url of $format=json
    • An example url for a local server is:
      http://localhost:8080/odata4/ImpalaVDB/OrderView/orders?$count=true
    • You will need to set basic auth params (user/pass) for the teiidUser.
    • Under the Authorization tab select Basic Auth and then enter the credentials on the right.
    • To filter the records, select Params next to the Send button and a param named $filter and its value to order_date_formatted gt 2014-07-25T00:00:00.000Z
    • This will filter results with a timestamp greater than 2014-07-25. More details on OData parameters and usage can be found on OData.org.

    • The power of Red Hat JBoss Data Virtualization in enterprise integration is not just exposing data as a service, but in combining multiple sources and doing transformations (like the timestamp). Hopefully this article was helpful and thanks for reading!
    Last updated: November 9, 2023

    Recent Posts

    • Unleashing multimodal magic with RamaLama

    • Integrate Red Hat AI Inference Server & LangChain in agentic workflows

    • Streamline multi-cloud operations with Ansible and ServiceNow

    • Automate dynamic application security testing with RapiDAST

    • Assessing AI for OpenShift operations: Advanced configurations

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue