Big data technologies like Hadoop are providing enterprises a cost-effective way to store and analyze data. Enterprises are looking at using Hadoop to augment their traditional data warehouse. Compared to traditional data warehouse solutions, Hadoop can scale using commodity hardware and can be used to store both structured as well as unstructured data. Traditional data warehouses based on relational database technologies have been around for a long time and have mature sets of tools for querying and analysis. Business users use SQL as the query language to perform ad-hoc queries against these warehouses. Also, reporting tools like Cognos, Business Objects, MicroStrategy rely on SQL heavily. The real value of Hadoop is realized when users can access and perform ad-hoc queries data directly on Hadoop using tools that support SQL.
Querying a Hadoop data store means knowing MapReduce programming or writing Pig and Hive scripts. Hadoop at its core consists of HDFS storage and MapReduce Engine. Since MapReduce programs are typically written in Java, they are difficult to write, and they are not at all easy to use from a business user’s perspective. The ability to use SQL to analyze data stored in Hadoop will help in making Hadoop go mainstream. This will also enable business users to reuse their existing SQL knowledge to analyze the data store in Hadoop. Various initiatives are underway both in the open source as well as in various companies to solve the problem of enabling SQL on Hadoop. The following are some of the most common ones.
Hive: Facebook developed Hive as a way of bringing a SQL-like interface for querying Hadoop. A Hive Warehouse needs to be created first that provides a schema on top of the data stored in HDFS. Using Hive QL (Hive Query language) we can use SQL-like syntax to query data stored in Hadoop HDFS. The SQL Support for Hive is very limited at this point. It does not offer support for full ANSI SQL. In the case of joins Hive supports ANSI Join syntax only. It only supports equi-joins at this point. Hive also does not support correlated sub queries which are commonly used in most traditional warehouse queries. Hive is not designed for low latency queries. Hive actually launches MapReduce jobs in the background. So even for small Hive tables, the query will take several minutes. It is really designed to run queries against massive amounts of data, where the query will return results in a few hours. Hive is not suited for real-time querying and analysis
Impala: Cloudera’s Impala provides a fast real-time query capability for your data stored in Hadoop using SQL. Impala is based on Google’s Dremel paper. Currently, Impala supports a subset of Ansi-92 SQL. There are still some issues on the join table sizes with Impala. If the join results do not fit into the amount of memory available in the Hadoop cluster, the join would fail. Your queries are limited by the amount of memory you have. Impala currently supports hash Joins. Cloudera does provide some recommendations on memory size for data nodes based on their beta customer experience Impala also provides connection using JDBC and ODBC as well as a command-line tool. Cloudera provides some interesting performance data on their site for Impala.
BigSQL: BigSQL is an enterprise-class SQL query engine from IBM and is available on IBM’s Hadoop distribution BigInsights version 2.1. BigSQL provides full ANSI SQL support as well as support for correlated subqueries. There is no memory size limitation for join tables. BigSQL runs on top of a Hive Warehouse or Hbase. BigSQL also provides an option for using adaptive MapReduce to improve the performance of MapReduce Jobs. Adaptive MapReduce comes from IBM’s experience in high performance computing clusters. BigSQL supports standard as well as ANSI join, cross join and non-equi join syntax. It also provides a much wider support for data types compared to Hive. Any BI and visualization tool that uses JDBC/ODBC drivers can use BigSQL to connect to a BigInsights Hadoop cluster. BigSQL also comes with a command line query tool called JSqsh, which is similar to Oracle SQL*Plus or MySQL command line tools. IBM has announced their free download for BigInsights Quickstart VM that comes bundled with BigSQL.
Google BigQuery: Google launched BigQuery based on their Dremel tool to enable real-time querying of their data using SQL Queries. BigQuery provides both synchronous and asynchronous running of queries. However, BigQuery is available only if data is loaded into Google’s cloud storage. Google provides a set of RESTFUL APIs to access the queries as well. It supports joins, but there is a table size limitation for the joining tables. BigQuery is a powerful querying tool if you are using Google Cloud to store your data.
HAWQ: Greenplum announced their HAWQ query engine that runs on top of their Pivotal HD (Greenplum’s Hadoop Distribution) and can run execute SQL queries against Hadoop. With HAWQ users can query data stored in Hbase, Hive or HDFS. HAWQ uses the same query optimizer that is used by Greenplum DB. HAWQ uses dynamic pipelining which is the combination of a bunch of different Greenplum technologies that have been built for the parallel relational database. The dynamic pipelining is a job scheduler for queries (different than job tracker and Name node used by Hadoop). This would be a good option for customers who already use Greenplum DB as their warehouse. They can run the same queries against the Greenplum warehouse as well as the Pivotal HD Hadoop cluster. HAWQ is a proprietary solution from Greenplum.
What is coming next?
Other open source initiatives are in place to address the issue of providing real-time query features on Hadoop.
Apache Drill: This is a new open-source initiative based on Google’s Dremel paper. The aim is to provide near real-time query capabilities on Hadoop similar to Google BigQuery.
Stinger: The Stinger Initiative is an Apache project managed by HortonWorks and Microsoft. The aim is to leverage Hadoop 2.0 and Yarn to help improve the performance and SQL capabilities of Hive. With Stinger, Hive queries will be 100X faster than the current queries. Hive will also support sub queries and better alignment with ANSI SQL.
Key things to consider when looking for SQL capabilities on Hadoop:
- Deploying a Hadoop distribution that is open source or has open-source support will be important. Hadoop has been an open-source initiative and there are many contributors who are adding and building capabilities into the platform. Companies like IBM and EMC Greenplum are now adding enterprise-class features into it and enabling integration with other enterprise data stores.
- These query tools are designed to be used by a small group of users. All the SQL-type query tools run MapReduce jobs in the background. MapReduce inherently scales up very well but does not scale down. Enable a limited set of business users to run SQL queries against Hadoop using these tools.
- Enterprise-class SQL features are available thru IBM BigSQL and GreenPlum HAWQ. These two query engines are both relatively new. They are also proprietary solutions tied to their own Hadoop distributions. Both of them do aim to support full ANSI SQL and enable enterprises to port and reuse existing queries. If you have an existing warehouse running on DB2, Teradata, etc. that you want to augment and reuse queries quickly, a BigSQL running on a BigInsights Hadoop cluster would be a logical choice.
- All the query engines have limitations and are not as robust and mature as the standard SQL query tools that are available on traditional warehouses. To expect business users to quickly use these tools is still a stretch and will need help from technical experts who understand Hadoop.