public class TxnUtils extends Object
Constructor and Description |
---|
TxnUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
buildQueryWithINClause(HiveConf conf,
List<String> queries,
StringBuilder prefix,
StringBuilder suffix,
List<Long> inList,
String inColumn,
boolean addParens,
boolean notIn)
Build a query (or queries if one query is too big) with specified "prefix" and "suffix",
while populating the IN list into multiple OR clauses, e.g.
|
static ValidTxnList |
createValidCompactTxnList(GetOpenTxnsInfoResponse txns)
Transform a
GetOpenTxnsInfoResponse to a
ValidTxnList . |
static ValidTxnList |
createValidReadTxnList(GetOpenTxnsResponse txns,
long currentTxn)
Transform a
GetOpenTxnsResponse to a
ValidTxnList . |
static TxnStore |
getTxnStore(HiveConf conf)
Get an instance of the TxnStore that is appropriate for this store
|
static boolean |
isAcidTable(Table table)
Checks if a table is a valid ACID table.
|
public static ValidTxnList createValidReadTxnList(GetOpenTxnsResponse txns, long currentTxn)
GetOpenTxnsResponse
to a
ValidTxnList
. This assumes that the caller intends to
read the files, and thus treats both open and aborted transactions as invalid.txns
- txn list from the metastorecurrentTxn
- Current transaction that the user has open. If this is greater than 0 it
will be removed from the exceptions list so that the user sees his own
transaction as valid.public static ValidTxnList createValidCompactTxnList(GetOpenTxnsInfoResponse txns)
GetOpenTxnsInfoResponse
to a
ValidTxnList
. This assumes that the caller intends to
compact the files, and thus treats only open transactions as invalid. Additionally any
txnId > highestOpenTxnId is also invalid. This is to avoid creating something like
delta_17_120 where txnId 80, for example, is still open.txns
- txn list from the metastorepublic static TxnStore getTxnStore(HiveConf conf)
conf
- configurationpublic static boolean isAcidTable(Table table)
table
- tablepublic static void buildQueryWithINClause(HiveConf conf, List<String> queries, StringBuilder prefix, StringBuilder suffix, List<Long> inList, String inColumn, boolean addParens, boolean notIn)
queries
- array of complete query stringsprefix
- part of the query that comes before IN listsuffix
- part of the query that comes after IN listinList
- the list containing IN list valuesinColumn
- column name of IN list operatoraddParens
- add a pair of parenthesis outside the IN lists
e.g. ( id in (1,2,3) OR id in (4,5,6) )notIn
- clause to be broken up is NOT INCopyright © 2021 The Apache Software Foundation. All rights reserved.