Impala Select Statement – How to Fetch Records using Hue
It is possible to fetch the data from one or more tables in a database in Impala. For that, we use Impala Select Statement. So, in this article, we will discuss, how we can fetch data with Impala Select Statement. Also, we will cover its syntax, usage as well as Example to understand it well.
So, let’s start How Impala Select Statement.
How to use Impala Select Statement?
Basically, to performs queries, retrieving data from one or more tables and producing result sets consisting of rows and columns, we use Impala Select Statement. In addition, it also typically ends with a SELECT statement, to define data to copy from one table to another.
To be more specific, to fetch the data from one or more tables in a database, we use Impala Select Statement. Also, returns data in the form of tables.
i. Impala SELECT queries support
- SQL data types: BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, TIMESTAMP, STRING.
- Before the SELECT keyword, there is an optional WITH clause. By using this we can define a subquery whose name or column names can be referenced from later in the main query.Â
- DISTINCT clause per query.Â
- Subqueries in a FROM clause.
- WHERE, GROUP BY, HAVING clauses.
- ORDER BY.Â
ii. Cancellation
It is possible to cancel it. That implies it Can be canceled. Basically, we use Ctrl-C from the impala-shell interpreter, in order to cancel this statement. Hence the Cancel button from the Watch page in Hue, Actions > Cancel from the Queries list in Cloudera Manager.
Also, Cancel from the list of in-flight queries (for a particular node) on the Queries tab in the Impala web UI (port 25000).
iii. Syntax of Impala Select Statements
Here, is the syntax of Impala – Select Statement, below;
SELECT column1, column2, columnN from table_name;
So, column1, column2…are the fields of a table whose values we want to fetch. So, we can use the following syntax if we want to fetch all the fields available in the field −
SELECT * FROM table_name;
iv. Example of Impala Select Statement
Let’s take one example of Impala Select statement suppose we have a table named Employees in Impala. Here,  is the data −
id | name | age | address | salary |
1 | shubham | 32 | delhi | 20000 |
2 | monika | 25 | mumbai | 15000 |
3 | kajal | 27 | alirajpur | 40000 |
4 | revti | 25 | indore | 35000 |
5 | shreyash | 23 | pune | 30000 |
6 | mehul | 22 | heydrabad | 32000 |
So, using select statement, we can fetch the id, name, and age of all the records of the Employees table.
[quickstart.cloudera:21000] > select id, name, age from Employees
Also, Impala fetches id, name, the age of all the records from the specified table and displays them, on executing the above query.
Query: select id,name,age from Employees
id | name | age |
1 | shubham | 32 |
2 | monika | 25 |
3 | kajal | 27 |
4 | revti | 25 |
5 | shreyash | 23 |
6 | mehul | 22 |
Fetched 6 row(s) in 0.66s
Moreover, using the select query, we can also fetch all the records from the Employees table.
[quickstart.cloudera:21000] > select name, age from Employees; Query: select * from Employees
Basically, Impala fetches and displays all the records from the specified table, on executing the above query.
id | name | age | address | salary |
1 | shubham | 32 | delhi | 20000 |
2 | monika | 25 | mumbai | 15000 |
3 | kajal | 27 | alirajpur | 40000 |
4 | revti | 25 | indore | 35000 |
5 | shreyash | 23 | pune | 30000 |
6 | mehul | 22 | heydrabad | 32000 |
Fetched 6 row(s) in 0.66s
Fetching the Records using Hue
There are several steps you have to follow while fetching the records using Hue. Such as:
- At first, Â type the select Statement in Impala Query editor. Further, click on the execute button.
- Afterward, Â we can see the list of the records of the specified table, just after executing the query, once you scroll down and select the Results tab.
So, this was all about Impala Select Statements. Hope you like our explanation.
Conclusion – Impala Select Statement
As a result, we have seen the whole concept of Impala – Select Statement. Still, if any doubt occurs in how to create impala database, feel free to ask in the comment section.
Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google