本文整理汇总了Java中org.apache.phoenix.util.QueryUtil.constructUpsertStatement方法的典型用法代码示例。如果您正苦于以下问题:Java QueryUtil.constructUpsertStatement方法的具体用法?Java QueryUtil.constructUpsertStatement怎么用?Java QueryUtil.constructUpsertStatement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.phoenix.util.QueryUtil
的用法示例。
在下文中一共展示了QueryUtil.constructUpsertStatement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.apache.phoenix.util.QueryUtil; //导入方法依赖的package包/类
private void initialize(Configuration config, Properties properties) throws SQLException {
this.config = config;
tableName = config.get(PhoenixStorageHandlerConstants.PHOENIX_TABLE_NAME);
// Disable WAL
String walConfigName = tableName.toLowerCase() + PhoenixStorageHandlerConstants.DISABLE_WAL;
boolean disableWal = config.getBoolean(walConfigName, false);
if (disableWal) {
if (LOG.isDebugEnabled()) {
LOG.debug("<<<<<<<<<< " + walConfigName + " is true. batch.mode will be set true. >>>>>>>>>>");
}
properties.setProperty(PhoenixStorageHandlerConstants.BATCH_MODE, "true");
}
this.conn = PhoenixConnectionUtil.getInputConnection(config, properties);
if (disableWal) {
metaDataClient = new MetaDataClient((PhoenixConnection)conn);
if (!PhoenixUtil.isDisabledWal(metaDataClient, tableName)) {
// execute alter tablel statement if disable_wal is not true.
try {
PhoenixUtil.alterTableForWalDisable(conn, tableName, true);
} catch (ConcurrentTableMutationException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("<<<<<<<<<< another mapper or task processing wal disable >>>>>>>>>>");
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("<<<<<<<<<< " + tableName + "s wal disabled. >>>>>>>>>>");
}
// restore original value of disable_wal at the end.
restoreWalMode = true;
}
}
this.batchSize = PhoenixConfigurationUtil.getBatchSize(config);
if (LOG.isDebugEnabled()) {
LOG.debug("<<<<<<<<<< batch-size : " + batchSize + " >>>>>>>>>>");
}
String upsertQuery = QueryUtil.constructUpsertStatement(tableName, PhoenixUtil.getColumnInfoList(conn, tableName));
if (LOG.isDebugEnabled()) {
LOG.debug("<<<<<<<<<< upsert-query : " + upsertQuery + " >>>>>>>>>>");
}
this.pstmt = this.conn.prepareStatement(upsertQuery);
}