@Override public Table load(final MapRDBTableCache.Key key) throws Exception { // getTable is already calling tableCache.get in correct user UGI context, so should be fine here. // key.Left is Path. key.Right is indexDesc. Table table = (key.indexDesc == null ? MapRDBImpl.getTable(key.path) : MapRDBImpl.getIndexTable(key.indexDesc)); logger.debug("time {} opened the table for tablePath {} tableHandle {} index {} userName {}", System.nanoTime(), key.path == null ? "null" : key.path, table == null ? "null" : table, key.indexDesc == null ? "null" : key.indexDesc.getIndexName(), key.ugi.getUserName() == null ? "null" : key.ugi.getUserName()); return table; } });
switch (functionName) { case "equal": cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.NOT_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.LESS, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.LESS_OR_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.GREATER, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.GREATER_OR_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition().notExists(fieldPath); break;
Table createOrGetTable(String tableName, int recordNum) { if (admin.tableExists(tableName)) { return MapRDBImpl.getTable(tableName); // admin.deleteTable(tableName); } else { TableDescriptor desc = new TableDescriptorImpl(new Path(tableName)); int splits = (recordNum / SPLIT_SIZE) - (((recordNum % SPLIT_SIZE) > 1)? 0 : 1); String[] splitsStr = new String[splits]; StringBuilder strBuilder = new StringBuilder("Splits:"); for (int i = 0; i < splits; ++i) { splitsStr[i] = String.format("%d", (i+1)*SPLIT_SIZE); strBuilder.append(splitsStr[i] + ", "); } System.out.print(strBuilder.toString()); return admin.createTable(desc, splitsStr); } }
+ " name = 'Sprint'"); final Document queryResult = MapRDBImpl.newDocument(); SingleRowListener listener = new SingleRowListener() { @Override
public Table run() throws Exception { if (logger.isTraceEnabled()) { logger.trace("Getting MaprDB Table handle for proxy user: " + UserGroupInformation.getCurrentUser()); } if (tableCachingEnabled) { Table table = tableCache.get(new MapRDBTableCache.Key(tablePath, indexDesc)); logger.trace("time {} get the tablePath {} tableHandle {} index {} userName {} currentUser {}", System.nanoTime(), tablePath == null ? "null" : tablePath, table == null ? "null" : table, indexDesc == null ? "null" : indexDesc.getIndexName(), userName == null ? "null" : userName, UserGroupInformation.getCurrentUser() == null ? "null" : UserGroupInformation.getCurrentUser()); return table; } else { return indexDesc == null ? MapRDBImpl.getTable(tablePath) : MapRDBImpl.getIndexTable(indexDesc); } } });
public JsonSubScanSpec(String tableName, IndexDesc indexDesc, String regionServer, QueryCondition scanRangeCondition, QueryCondition userCondition, byte[] startRow, byte[] stopRow, String userName) { super(tableName, indexDesc, regionServer, startRow, stopRow, null, null, userName); condition = MapRDBImpl.newCondition().and(); if (userCondition != null && !userCondition.isEmpty()) { condition.condition(userCondition); } if (scanRangeCondition != null && !scanRangeCondition.isEmpty()) { condition.condition(scanRangeCondition); } condition.close().build(); }
table = (indexDesc == null ? MapRDBImpl.getTable(tablePath) : MapRDBImpl.getIndexTable(indexDesc));
queryCond = MapRDBImpl.newCondition() .sizeOf(fieldName, STRING_TO_RELOP.get(relOp), size) .build(); queryCond = MapRDBImpl.newCondition(); if (functionName.equals("ojai_typeof")) { queryCond.typeOf(fieldName, typeValue); final String regex = getStringArg(call.args.get(1)); if (functionName.equals("ojai_matches")) { queryCond = MapRDBImpl.newCondition() .matches(fieldName, regex); } else { queryCond = MapRDBImpl.newCondition() .notMatches(fieldName, regex);
@Override public Table load(final MapRDBTableCache.Key key) throws Exception { // getTable is already calling tableCache.get in correct user UGI context, so should be fine here. // key.Left is Path. key.Right is indexDesc. Table table = (key.indexDesc == null ? MapRDBImpl.getTable(key.path) : MapRDBImpl.getIndexTable(key.indexDesc)); logger.debug("time {} opened the table for tablePath {} tableHandle {} index {} userName {}", System.nanoTime(), key.path == null ? "null" : key.path, table == null ? "null" : table, key.indexDesc == null ? "null" : key.indexDesc.getIndexName(), key.ugi.getUserName() == null ? "null" : key.ugi.getUserName()); return table; } });
public void mergeScanSpec(String functionName, JsonScanSpec scanSpec) { if (this.condition != null && scanSpec.getCondition() != null) { QueryCondition newCond = MapRDBImpl.newCondition(); switch (functionName) { case "booleanAnd": newCond.and(); break; case "booleanOr": newCond.or(); break; default: assert(false); } newCond.condition(this.condition) .condition(scanSpec.getCondition()) .close() .build(); this.condition = newCond; } else if (scanSpec.getCondition() != null){ this.condition = scanSpec.getCondition(); } }
public Table run() throws Exception { if (logger.isTraceEnabled()) { logger.trace("Getting MaprDB Table handle for proxy user: " + UserGroupInformation.getCurrentUser()); } if (tableCachingEnabled) { Table table = tableCache.get(new MapRDBTableCache.Key(tablePath, indexDesc)); logger.trace("time {} get the tablePath {} tableHandle {} index {} userName {} currentUser {}", System.nanoTime(), tablePath == null ? "null" : tablePath, table == null ? "null" : table, indexDesc == null ? "null" : indexDesc.getIndexName(), userName == null ? "null" : userName, UserGroupInformation.getCurrentUser() == null ? "null" : UserGroupInformation.getCurrentUser()); return table; } else { return indexDesc == null ? MapRDBImpl.getTable(tablePath) : MapRDBImpl.getIndexTable(indexDesc); } } });
switch (functionName) { case "equal": cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.NOT_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.LESS, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.LESS_OR_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.GREATER, fieldValue); break; cond = MapRDBImpl.newCondition(); setIsCondition(cond, fieldPath, Op.GREATER_OR_EQUAL, fieldValue); break; cond = MapRDBImpl.newCondition().notExists(fieldPath); break;
table = (indexDesc == null ? MapRDBImpl.getTable(tablePath) : MapRDBImpl.getIndexTable(indexDesc));
public JsonSubScanSpec(String tableName, IndexDesc indexDesc, String regionServer, QueryCondition scanRangeCondition, QueryCondition userCondition, byte[] startRow, byte[] stopRow, String userName) { super(tableName, indexDesc, regionServer, startRow, stopRow, null, null, userName); condition = MapRDBImpl.newCondition().and(); if (userCondition != null && !userCondition.isEmpty()) { condition.condition(userCondition); } if (scanRangeCondition != null && !scanRangeCondition.isEmpty()) { condition.condition(scanRangeCondition); } condition.close().build(); }
queryCond = MapRDBImpl.newCondition() .sizeOf(fieldName, STRING_TO_RELOP.get(relOp), size) .build(); queryCond = MapRDBImpl.newCondition(); if (functionName.equals("ojai_typeof")) { queryCond.typeOf(fieldName, typeValue); final String regex = getStringArg(call.args.get(1)); if (functionName.equals("ojai_matches")) { queryCond = MapRDBImpl.newCondition() .matches(fieldName, regex); } else { queryCond = MapRDBImpl.newCondition() .notMatches(fieldName, regex);
public void mergeScanSpec(String functionName, JsonScanSpec scanSpec) { if (this.condition != null && scanSpec.getCondition() != null) { QueryCondition newCond = MapRDBImpl.newCondition(); switch (functionName) { case "booleanAnd": newCond.and(); break; case "booleanOr": newCond.or(); break; default: assert(false); } newCond.condition(this.condition) .condition(scanSpec.getCondition()) .close() .build(); this.condition = newCond; } else if (scanSpec.getCondition() != null){ this.condition = scanSpec.getCondition(); } }