public final class SQLGenerator extends Object
| Constructor and Description |
|---|
SQLGenerator(DatabaseProduct dbProduct,
org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
String |
addForUpdateClause(String selectStatement)
Given a
selectStatement, decorated it with FOR UPDATE or semantically equivalent
construct. |
String |
addLimitClause(int numRows,
String noSelectsqlQuery)
Suppose you have a query "select a,b from T" and you want to limit the result set
to the first 5 rows.
|
List<String> |
createInsertValuesStmt(String tblColumns,
List<String> rows)
Genereates "Insert into T(a,b,c) values(1,2,'f'),(3,4,'c')" for appropriate DB
|
DatabaseProduct |
getDbProduct() |
public SQLGenerator(DatabaseProduct dbProduct, org.apache.hadoop.conf.Configuration conf)
public List<String> createInsertValuesStmt(String tblColumns, List<String> rows)
tblColumns - e.g. "T(a,b,c)"rows - e.g. list of Strings like 3,4,'d'public String addForUpdateClause(String selectStatement) throws org.apache.hadoop.hive.metastore.api.MetaException
selectStatement, decorated it with FOR UPDATE or semantically equivalent
construct. If the DB doesn't support, return original select.org.apache.hadoop.hive.metastore.api.MetaExceptionpublic String addLimitClause(int numRows, String noSelectsqlQuery) throws org.apache.hadoop.hive.metastore.api.MetaException
noSelectsqlQuery to be "a,b from T" and this method will return the
appropriately modified row limiting query.
Note that if noSelectsqlQuery contains a join, you must make sure that
all columns are unique for Oracle.
org.apache.hadoop.hive.metastore.api.MetaExceptionpublic DatabaseProduct getDbProduct()
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.