Impala Comments – 2 Types of Comments with Examples

In Impala, when we need to specify what each query or a group of queries are, we use Several Impala Comments. So, in this article, we will introduce various Impala Comments.

There are two types of Impala Comments. Such as Single line and Multiline. We will also learn about them in detail here. Moreover, we will see some examples, to understand it well.

What is Impala Comments?

Basically, we can say, Impala Comments are same as comments in SQL. Moreover, we might require adding comments to specify what each query or a group of queries are while lots of queries are written in a file. So, further adding comments to the query file will help you achieve your objective.

However, there are two types of comments in programming languages, such as:

  1. Single-line Comments
  2. Multiline Comments

Stay updated with latest technology trends
Join DataFlair on Telegram!!

i. Single-line comments or  – – Sequence (two dashes)

In Impala, every single line that is followed by “—” is considered as a comment. For example:
– – Hello welcome to DataFlair

In other words, all text from a – – sequence to the end of the line is considered a comment and ignored. Moreover, This type of comment can occur on a single line by itself. Also, or part of a statement.

ii. Multiline comments or /* this is a comment */

In Impala, Multiline comments are all the lines between /* and */. For example:

/*
Hi this is an example
Of multiline comments in Impala
*/

In other words, All text from a /* sequence to the next */ sequence is considered a comment and ignored. Basically, we can stretch it over multiple lines. It can occur on one or more lines by itself, in the middle of a statement. Also, before or after a statement.

Example of Comments in Impala

For example:

-- This line is a comment about a table.
create table ...;
/*
This is a multi-line comment about a query.
*/
select ...;
select * from t /* This is an embedded comment about a query. */ where ...;
select * from t -- This is a trailing comment within a multi-line command.
where ...;

Conclusion

As a result, we have seen, several types of Impala Comments. However, if any doubt occurs, feel free to ask in the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.