當前位置: 首頁>>代碼示例>>Java>>正文


Java QueryUtil.constructUpsertStatement方法代碼示例

本文整理匯總了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);
}
 
開發者ID:mini666,項目名稱:hive-phoenix-handler,代碼行數:53,代碼來源:PhoenixRecordWriter.java


注:本文中的org.apache.phoenix.util.QueryUtil.constructUpsertStatement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。