mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
IMPALA-13869: Support for 'hive.sql.query' property for Hive JDBC tables
This patch adds support for the hive.sql.query table property in Hive JDBC tables accessed through Impala. Impala has support for Hive JDBC tables using the hive.sql.table property, which limits users to simple table access. However, many use cases demand the ability to expose complex joins, filters, aggregations, or derived columns as external views. Hive.sql.query leads to a custom SQL query that returns a virtual table(subquery) instead of pointing to a physical table. These use cases cannot be achieved with just the hive.sql.table property. This change allows Impala to: • Interact with views or complex queries defined on external systems without needing schema-level access to base tables. • Expose materialized logic (such as filters, joins, or transformations) via Hive to Impala consumers in a secure, abstracted way. • Better align with data virtualization use cases where physical data location and structure should be hidden from the querying engine. This patch also lays the groundwork for future enhancements such as predicate pushdown and performance optimizations for Hive JDBC tables backed by queries. Testing: End-to-end tests are included in test_ext_data_sources.py. Change-Id: I039fcc1e008233a3eeed8d09554195fdb8c8706b Reviewed-on: http://gerrit.cloudera.org:8080/22865 Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
committed by
Impala Public Jenkins
parent
a12e49e38d
commit
7f77176970
@@ -233,6 +233,376 @@ select * from country_keystore_mysql where name IN ('India', 'USA');
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
2,'Russia',false,20,200,2000,20000,2.200000047683716,2.22,2024-02-01,'RU',2024-02-01 11:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
2,'Russia',false,20,200,2000,20000,2.200000047683716,2.22,2024-02-01,'RU',2024-02-01 11:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, date_col from country_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India',2024-01-01
|
||||
2,'Russia',2024-02-01
|
||||
3,'USA',2024-03-01
|
||||
---- TYPES
|
||||
INT, STRING, DATE
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, date_col from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India',2024-01-01
|
||||
2,'Russia',2024-02-01
|
||||
3,'USA',2024-03-01
|
||||
---- TYPES
|
||||
INT, STRING, DATE
|
||||
====
|
||||
---- QUERY
|
||||
select count(*) from country_mysql_query;
|
||||
---- RESULTS
|
||||
3
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
select count(*) from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
3
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
select distinct name from country_mysql_query;
|
||||
---- RESULTS
|
||||
'India'
|
||||
'Russia'
|
||||
'USA'
|
||||
---- TYPES
|
||||
STRING
|
||||
====
|
||||
---- QUERY
|
||||
select distinct name from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
'India'
|
||||
'Russia'
|
||||
'USA'
|
||||
---- TYPES
|
||||
STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Check for null values
|
||||
select * from country_mysql_query where string_col IS NULL;
|
||||
---- RESULTS
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_mysql_query where string_col IS NULL;
|
||||
---- RESULTS
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
# Order by integer column
|
||||
select id, name, int_col from country_mysql_query order by int_col DESC;
|
||||
---- RESULTS
|
||||
3,'USA',3000
|
||||
2,'Russia',2000
|
||||
1,'India',1000
|
||||
---- TYPES
|
||||
INT, STRING, INT
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, int_col from country_keystore_mysql_query order by int_col DESC;
|
||||
---- RESULTS
|
||||
3,'USA',3000
|
||||
2,'Russia',2000
|
||||
1,'India',1000
|
||||
---- TYPES
|
||||
INT, STRING, INT
|
||||
====
|
||||
---- QUERY
|
||||
# Select using case statement
|
||||
select id, name, case when bool_col then 'Active' else 'Inactive' end as status from country_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India','Active'
|
||||
2,'Russia','Inactive'
|
||||
3,'USA','Active'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, case when bool_col then 'Active' else 'Inactive' end as status from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
1,'India','Active'
|
||||
2,'Russia','Inactive'
|
||||
3,'USA','Active'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Check for minimum date
|
||||
select min(date_col) from country_mysql_query;
|
||||
---- RESULTS
|
||||
2024-01-01
|
||||
---- TYPES
|
||||
DATE
|
||||
====
|
||||
---- QUERY
|
||||
select min(date_col) from country_keystore_mysql_query;
|
||||
---- RESULTS
|
||||
2024-01-01
|
||||
---- TYPES
|
||||
DATE
|
||||
====
|
||||
---- QUERY
|
||||
# Join with a self table alias
|
||||
select a.id, a.name, b.name from country_mysql_query a join country_mysql_query b on a.id <> b.id;
|
||||
---- RESULTS
|
||||
1,'India','Russia'
|
||||
1,'India','USA'
|
||||
2,'Russia','India'
|
||||
2,'Russia','USA'
|
||||
3,'USA','India'
|
||||
3,'USA','Russia'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.name from country_keystore_mysql_query a join country_keystore_mysql_query b on
|
||||
a.id <> b.id;
|
||||
---- RESULTS
|
||||
1,'India','Russia'
|
||||
1,'India','USA'
|
||||
2,'Russia','India'
|
||||
2,'Russia','USA'
|
||||
3,'USA','India'
|
||||
3,'USA','Russia'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Left join with another table
|
||||
select a.id, a.name, b.string_col from country_mysql_query a left join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql a left join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql a left join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql_query a left join country_mysql b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql_query a left join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql_query a left join country_mysql b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql_query a left join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Right join with another table
|
||||
select a.id, a.name, b.string_col from country_mysql_query a right join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql_query a right join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql a right join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql a right join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql a right join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql a right join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Full outer join
|
||||
select a.id, a.name, b.string_col from country_mysql_query a full outer join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql_query a full outer join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql a full outer join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_mysql a full outer join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql a full outer join country_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_mysql a full outer join country_keystore_mysql_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Using IN clause
|
||||
select * from country_mysql_query where name IN ('India', 'USA');
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_mysql_query where name IN ('India', 'USA');
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from quoted_col;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
|
||||
@@ -233,6 +233,376 @@ select * from country_keystore_postgres where name IN ('India', 'USA');
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
2,'Russia',false,20,200,2000,20000,2.200000047683716,2.22,2024-02-01,'RU',2024-02-01 11:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
2,'Russia',false,20,200,2000,20000,2.200000047683716,2.22,2024-02-01,'RU',2024-02-01 11:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, date_col from country_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India',2024-01-01
|
||||
2,'Russia',2024-02-01
|
||||
3,'USA',2024-03-01
|
||||
---- TYPES
|
||||
INT, STRING, DATE
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, date_col from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India',2024-01-01
|
||||
2,'Russia',2024-02-01
|
||||
3,'USA',2024-03-01
|
||||
---- TYPES
|
||||
INT, STRING, DATE
|
||||
====
|
||||
---- QUERY
|
||||
select count(*) from country_postgres_query;
|
||||
---- RESULTS
|
||||
3
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
select count(*) from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
3
|
||||
---- TYPES
|
||||
BIGINT
|
||||
====
|
||||
---- QUERY
|
||||
select distinct name from country_postgres_query;
|
||||
---- RESULTS
|
||||
'India'
|
||||
'Russia'
|
||||
'USA'
|
||||
---- TYPES
|
||||
STRING
|
||||
====
|
||||
---- QUERY
|
||||
select distinct name from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
'India'
|
||||
'Russia'
|
||||
'USA'
|
||||
---- TYPES
|
||||
STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Check for null values
|
||||
select * from country_postgres_query where string_col IS NULL;
|
||||
---- RESULTS
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_postgres_query where string_col IS NULL;
|
||||
---- RESULTS
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
# Order by integer column
|
||||
select id, name, int_col from country_postgres_query order by int_col DESC;
|
||||
---- RESULTS
|
||||
3,'USA',3000
|
||||
2,'Russia',2000
|
||||
1,'India',1000
|
||||
---- TYPES
|
||||
INT, STRING, INT
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, int_col from country_keystore_postgres_query order by int_col DESC;
|
||||
---- RESULTS
|
||||
3,'USA',3000
|
||||
2,'Russia',2000
|
||||
1,'India',1000
|
||||
---- TYPES
|
||||
INT, STRING, INT
|
||||
====
|
||||
---- QUERY
|
||||
# Select using case statement
|
||||
select id, name, case when bool_col then 'Active' else 'Inactive' end as status from country_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India','Active'
|
||||
2,'Russia','Inactive'
|
||||
3,'USA','Active'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select id, name, case when bool_col then 'Active' else 'Inactive' end as status from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
1,'India','Active'
|
||||
2,'Russia','Inactive'
|
||||
3,'USA','Active'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Check for minimum date
|
||||
select min(date_col) from country_postgres_query;
|
||||
---- RESULTS
|
||||
2024-01-01
|
||||
---- TYPES
|
||||
DATE
|
||||
====
|
||||
---- QUERY
|
||||
select min(date_col) from country_keystore_postgres_query;
|
||||
---- RESULTS
|
||||
2024-01-01
|
||||
---- TYPES
|
||||
DATE
|
||||
====
|
||||
---- QUERY
|
||||
# Join with a self table alias
|
||||
select a.id, a.name, b.name from country_postgres_query a join country_postgres_query b on a.id <> b.id;
|
||||
---- RESULTS
|
||||
1,'India','Russia'
|
||||
1,'India','USA'
|
||||
2,'Russia','India'
|
||||
2,'Russia','USA'
|
||||
3,'USA','India'
|
||||
3,'USA','Russia'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.name from country_keystore_postgres_query a join country_keystore_postgres_query b on
|
||||
a.id <> b.id;
|
||||
---- RESULTS
|
||||
1,'India','Russia'
|
||||
1,'India','USA'
|
||||
2,'Russia','India'
|
||||
2,'Russia','USA'
|
||||
3,'USA','India'
|
||||
3,'USA','Russia'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Left join with another table
|
||||
select a.id, a.name, b.string_col from country_postgres_query a left join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres a left join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres a left join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres_query a left join country_postgres b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres_query a left join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres_query a left join country_postgres b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres_query a left join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Right join with another table
|
||||
select a.id, a.name, b.string_col from country_postgres_query a right join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres_query a right join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres a right join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres a right join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres a right join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres a right join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Full outer join
|
||||
select a.id, a.name, b.string_col from country_postgres_query a full outer join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres_query a full outer join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres a full outer join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_postgres a full outer join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres a full outer join country_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
select a.id, a.name, b.string_col from country_keystore_postgres a full outer join country_keystore_postgres_query b on
|
||||
a.id = b.id;
|
||||
---- RESULTS
|
||||
1,'India','IN'
|
||||
2,'Russia','RU'
|
||||
3,'USA','US'
|
||||
---- TYPES
|
||||
INT, STRING, STRING
|
||||
====
|
||||
---- QUERY
|
||||
# Using IN clause
|
||||
select * from country_postgres_query where name IN ('India', 'USA');
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from country_keystore_postgres_query where name IN ('India', 'USA');
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
3,'USA',true,30,300,3000,30000,3.299999952316284,3.33,2024-03-01,'US',2024-03-01 12:00:00
|
||||
---- TYPES
|
||||
INT, STRING, BOOLEAN, SMALLINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DATE, STRING, TIMESTAMP
|
||||
====
|
||||
---- QUERY
|
||||
select * from quoted_col;
|
||||
---- RESULTS
|
||||
1,'India',true,10,100,1000,10000,1.100000023841858,1.11,2024-01-01,'IN',2024-01-01 10:00:00
|
||||
|
||||
@@ -598,12 +598,6 @@ select * from jdbc_test order by id limit 5;
|
||||
INT, BOOLEAN, INT
|
||||
====
|
||||
---- QUERY
|
||||
# Alter JDBC table to unset the required JDBC configuration "table".
|
||||
ALTER TABLE jdbc_test UNSET TBLPROPERTIES ("table");
|
||||
---- CATCH
|
||||
row_regex:.*AnalysisException: Unsetting the 'table' table property is not supported for JDBC DataSource table
|
||||
====
|
||||
---- QUERY
|
||||
# Alter table to drop a column.
|
||||
ALTER TABLE jdbc_test DROP COLUMN int_col;
|
||||
---- RESULTS
|
||||
|
||||
Reference in New Issue
Block a user