本文整理汇总了C++中ArrayDesc类的典型用法代码示例。如果您正苦于以下问题:C++ ArrayDesc类的具体用法?C++ ArrayDesc怎么用?C++ ArrayDesc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayDesc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inferArrayAccess
/**
* Request a lock for all arrays that will be accessed by this operator.
* Calls requestLock with the write lock over the target array (array inserted into)
* @param query the query context
*/
void inferArrayAccess(std::shared_ptr<Query>& query)
{
LogicalOperator::inferArrayAccess(query);
SCIDB_ASSERT(_parameters.size() > 0);
SCIDB_ASSERT(_parameters[0]->getParamType() == PARAM_ARRAY_REF);
const string& arrayNameOrg = ((std::shared_ptr<OperatorParamReference>&)_parameters[0])->getObjectName();
SCIDB_ASSERT(ArrayDesc::isNameUnversioned(arrayNameOrg));
std::string arrayName;
std::string namespaceName;
query->getNamespaceArrayNames(arrayNameOrg, namespaceName, arrayName);
ArrayDesc srcDesc;
SCIDB_ASSERT(!srcDesc.isTransient());
scidb::namespaces::Communicator::getArrayDesc(
namespaceName, arrayName, SystemCatalog::ANY_VERSION, srcDesc);
const SystemCatalog::LockDesc::LockMode lockMode =
srcDesc.isTransient() ? SystemCatalog::LockDesc::XCL : SystemCatalog::LockDesc::WR;
std::shared_ptr<SystemCatalog::LockDesc> lock(
make_shared<SystemCatalog::LockDesc>(
namespaceName,
arrayName,
query->getQueryID(),
Cluster::getInstance()->getLocalInstanceId(),
SystemCatalog::LockDesc::COORD,
lockMode));
std::shared_ptr<SystemCatalog::LockDesc> resLock = query->requestLock(lock);
SCIDB_ASSERT(resLock);
SCIDB_ASSERT(resLock->getLockMode() >= SystemCatalog::LockDesc::WR);
}
示例2: SinglePassArray
InputArray::InputArray(ArrayDesc const& array,
string const& format,
boost::shared_ptr<Query>& query,
bool emptyMode,
bool enforceDataIntegrity,
int64_t maxCnvErrors,
string const& shadowArrayName,
bool parallel)
: SinglePassArray(array),
_chunkLoader(ChunkLoader::create(format)),
_currChunkIndex(0),
strVal(TypeLibrary::getType(TID_STRING)),
emptyTagAttrID(array.getEmptyBitmapAttribute() != NULL
? array.getEmptyBitmapAttribute()->getId()
: INVALID_ATTRIBUTE_ID),
nLoadedCells(0),
nLoadedChunks(0),
nErrors(0),
maxErrors(maxCnvErrors),
state(emptyMode ? S_Empty : S_Normal),
nAttrs(array.getAttributes(true).size()),
parallelLoad(parallel),
_enforceDataIntegrity(enforceDataIntegrity)
{
SCIDB_ASSERT(query);
_query=query;
myInstanceID = query->getInstanceID();
SCIDB_ASSERT(_chunkLoader); // else inferSchema() messed up
_chunkLoader->bind(this, query);
if (!shadowArrayName.empty()) {
shadowArray.reset(new MemArray(generateShadowArraySchema(array, shadowArrayName), query));
}
}
示例3: inferSchema
/**
* Perform operator-specific checks of input and return the shape of the output. Currently,
* the output array must exist.
* @param schemas the shapes of the input arrays
* @param query the query context
*/
ArrayDesc inferSchema(std::vector< ArrayDesc> schemas, std::shared_ptr< Query> query)
{
SCIDB_ASSERT(schemas.size() == 1);
SCIDB_ASSERT(_parameters.size() == 1);
string arrayNameOrg =
((std::shared_ptr<OperatorParamReference>&)_parameters[0])->getObjectName();
SCIDB_ASSERT(ArrayDesc::isNameUnversioned(arrayNameOrg));
//Ensure attributes names uniqueness.
std::string arrayName;
std::string namespaceName;
query->getNamespaceArrayNames(arrayNameOrg, namespaceName, arrayName);
ArrayDesc dstDesc;
ArrayDesc const& srcDesc = schemas[0];
ArrayID arrayId = query->getCatalogVersion(namespaceName, arrayName);
bool fArrayDesc = scidb::namespaces::Communicator::getArrayDesc(
namespaceName, arrayName, arrayId, dstDesc, false);
if (!fArrayDesc) {
throw USER_EXCEPTION(SCIDB_SE_INFER_SCHEMA, SCIDB_LE_ARRAY_DOESNT_EXIST) << arrayName;
}
ArrayDesc::checkConformity(srcDesc, dstDesc,
ArrayDesc::IGNORE_PSCHEME |
ArrayDesc::IGNORE_OVERLAP |
ArrayDesc::IGNORE_INTERVAL); // allows auto-repart()
SCIDB_ASSERT(dstDesc.getId() == dstDesc.getUAId());
SCIDB_ASSERT(dstDesc.getName() == arrayName);
SCIDB_ASSERT(dstDesc.getUAId() > 0);
return dstDesc;
}
示例4: DelegateArray
ConcatArray::ConcatArray(ArrayDesc const& array, boost::shared_ptr<Array> const& left, boost::shared_ptr<Array> const& right)
: DelegateArray(array, left),
leftArray(left->getArrayDesc().getAttributes().size() == array.getAttributes().size() ? left : boost::shared_ptr<Array>(new NonEmptyableArray(left))),
rightArray(right->getArrayDesc().getAttributes().size() == array.getAttributes().size() ? right : boost::shared_ptr<Array>(new NonEmptyableArray(right))),
dims(desc.getDimensions())
{
Dimensions const& leftDimensions = left->getArrayDesc().getDimensions();
Dimensions const& rightDimensions = right->getArrayDesc().getDimensions();
lastLeft = leftDimensions[CONCAT_DIM].getEndMax();
firstRight = rightDimensions[CONCAT_DIM].getStartMin();
concatChunkInterval = leftDimensions[CONCAT_DIM].getChunkInterval() + leftDimensions[CONCAT_DIM].getChunkOverlap();
size_t nDims = leftDimensions.size();
if (leftDimensions[CONCAT_DIM].getChunkOverlap() != 0
|| leftDimensions[CONCAT_DIM].getLength() % leftDimensions[CONCAT_DIM].getChunkInterval() != 0)
{
simpleAppend = false;
}
else
{
simpleAppend = true;
for (size_t i = 0; i < nDims; i++) {
if (leftDimensions[i].getChunkInterval() != rightDimensions[i].getChunkInterval()
|| leftDimensions[i].getChunkOverlap() != rightDimensions[i].getChunkOverlap())
{
simpleAppend = false;
break;
}
}
}
}
示例5: StreamArray
RemoteArray::RemoteArray(const ArrayDesc& arrayDesc, QueryID queryId, InstanceID instanceID)
: StreamArray(arrayDesc), _queryId(queryId), _instanceID(instanceID),
_received(arrayDesc.getAttributes().size()),
_messages(arrayDesc.getAttributes().size()),
_requested(arrayDesc.getAttributes().size())
{
}
示例6: DelegateArray
SplitArray::SplitArray(ArrayDesc const& desc,
const boost::shared_array<char>& src,
Coordinates const& from,
Coordinates const& till,
shared_ptr<Query>const& query)
: DelegateArray(desc, shared_ptr<Array>(), true),
_startingChunk(from),
_from(from),
_till(till),
_size(from.size()),
_src(src),
_empty(false)
{
assert(query);
_query = query;
desc.getChunkPositionFor(_startingChunk);
Dimensions const& dims = desc.getDimensions();
for (size_t i = 0, n = dims.size(); i < n; i++) {
_size[i] = _till[i] - _from[i] + 1;
if (_size[i] == 0) {
_empty = true;
}
if (_till[i] > dims[i].getEndMax()) {
_till[i] = dims[i].getEndMax();
}
}
}
示例7: fillUsedPlugins
void fillUsedPlugins(const ArrayDesc& desc, vector<string>& plugins) const
{
for (size_t i = 0; i < desc.getAttributes().size(); i++) {
const string& libName = TypeLibrary::getTypeLibraries().getObjectLibrary(desc.getAttributes()[i].getType());
if (libName != "scidb")
plugins.push_back(libName);
}
}
示例8: MultiStreamArray
RemoteMergedArray::RemoteMergedArray(const ArrayDesc& arrayDesc, QueryID queryId, Statistics& statistics):
MultiStreamArray(Query::getQueryByID(queryId)->getInstancesCount(), arrayDesc),
_queryId(queryId),
_received(arrayDesc.getAttributes().size(), vector<Semaphore>(getStreamsCount())),
_messages(arrayDesc.getAttributes().size(), vector< boost::shared_ptr<MessageDesc> >(getStreamsCount())),
_nextPositions(arrayDesc.getAttributes().size(), vector<Coordinates>(getStreamsCount())),
_hasPositions(arrayDesc.getAttributes().size(), vector<bool>(getStreamsCount(), false))
{
boost::shared_ptr<Query> query = Query::getQueryByID(queryId);
_localArray = query->getCurrentResultArray();
}
示例9: desc
TupleArray::TupleArray(ArrayDesc const& schema, vector< boost::shared_ptr<Tuple> > const& data, Coordinate offset)
: desc(schema),
start(schema.getDimensions()[0].getStart() + offset),
end(start + offset + schema.getDimensions()[0].getLength() - 1),
tuples(data), chunkSize(schema.getDimensions()[0].getChunkInterval())
{
desc.cutOverlap();
if (Coordinate(start + tuples.size()) <= end) {
end = start + tuples.size() - 1;
}
}
示例10: dstAttrs
ArrayDesc InputArray::generateShadowArraySchema(ArrayDesc const& targetArray, string const& shadowArrayName)
{
Attributes const& srcAttrs = targetArray.getAttributes(true);
size_t nAttrs = srcAttrs.size();
Attributes dstAttrs(nAttrs+2);
for (size_t i = 0; i < nAttrs; i++) {
dstAttrs[i] = AttributeDesc(i, srcAttrs[i].getName(), TID_STRING, AttributeDesc::IS_NULLABLE, 0);
}
dstAttrs[nAttrs] = AttributeDesc(nAttrs, "row_offset", TID_INT64, 0, 0);
dstAttrs[nAttrs+1] = AttributeDesc(nAttrs+1, DEFAULT_EMPTY_TAG_ATTRIBUTE_NAME,
TID_INDICATOR, AttributeDesc::IS_EMPTY_INDICATOR, 0);
return ArrayDesc(shadowArrayName, dstAttrs, targetArray.getDimensions());
}
示例11: SYSTEM_EXCEPTION
ScanRLEArray::ScanRLEArray(ArrayDesc const& arr, std::string path) :
RLEArray(arr), _dirPath(path), _maxChunkNo(0), logger(log4cxx::Logger::getLogger("scidb.query.ops.ScanRQArray"))
{
filesystem::path full_path = filesystem::system_complete(filesystem::path(_dirPath));
if (!filesystem::exists(full_path))
{
throw SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_CANT_OPEN_PATH) << _dirPath;
}
if (!filesystem::is_directory(full_path))
{
throw SYSTEM_EXCEPTION(SCIDB_SE_INTERNAL, SCIDB_LE_DIRECTORY_EXPECTED) << _dirPath;
}
_maxChunkNo = arr.getNumberOfChunks() / arr.getAttributes().size();
}
示例12: USER_EXCEPTION
TupleArray::TupleArray(ArrayDesc const& schema, vector< boost::shared_ptr<ConstArrayIterator> > const& arrayIterators, size_t shift, size_t step)
: desc(schema),
start(schema.getDimensions()[0].getStart()),
end(schema.getDimensions()[0].getEndMax()),
chunkSize(schema.getDimensions()[0].getChunkInterval())
{
if (schema.getDimensions().size() != 1)
throw USER_EXCEPTION(SCIDB_SE_EXECUTION, SCIDB_LE_MULTIDIMENSIONAL_ARRAY_NOT_ALLOWED);
append(arrayIterators, shift, step);
if (start == MIN_COORDINATE || end == MAX_COORDINATE) {
start = 0;
end = tuples.size()-1;
} else if (Coordinate(start + tuples.size()) <= end) {
end = start + tuples.size() - 1;
}
}
示例13: createWindowDesc
//param desc --> the input array schema
inline ArrayDesc createWindowDesc(ArrayDesc const& desc)
{
//get dimensions for output array
Dimensions const& dims = desc.getDimensions();
Dimensions aggrDims(dims.size());
for (size_t i = 0; i < dims.size(); i++)
{
DimensionDesc const& srcDim = dims[i];
aggrDims[i] = DimensionDesc(srcDim.getBaseName(),
srcDim.getNamesAndAliases(),
srcDim.getStartMin(),
srcDim.getCurrStart(),
srcDim.getCurrEnd(),
srcDim.getEndMax(),
srcDim.getChunkInterval(),
0);
}
ArrayDesc output(desc.getName(), Attributes(), aggrDims);
//get the aggregates, check if they make sense, make attributes for output array
//_parameters[0~dims.size()*2-1] --> window boundaries, already get in inferSchema
for (size_t i = dims.size()*2; i < _parameters.size(); i++)
{
boost::shared_ptr<scidb::OperatorParam> param = _parameters[i];
if ( param->getParamType() != PARAM_AGGREGATE_CALL) {
throw USER_QUERY_EXCEPTION(SCIDB_SE_INFER_SCHEMA,
SCIDB_LE_OP_WINDOW_ERROR5,
_parameters[i]->getParsingContext());
}
addAggregatedAttribute( (shared_ptr<OperatorParamAggregateCall> &) param, desc, output, true);
}
if ( desc.getEmptyBitmapAttribute()) //?
{
AttributeDesc const* eAttr = desc.getEmptyBitmapAttribute();
output.addAttribute(AttributeDesc(output.getAttributes().size(),
eAttr->getName(),
eAttr->getType(),
eAttr->getFlags(),
eAttr->getDefaultCompressionMethod()));
}
return output;
}
示例14:
const ArrayDesc& LogicalQueryPlanNode::inferTypes(std::shared_ptr< Query> query)
{
std::vector<ArrayDesc> inputSchemas;
ArrayDesc outputSchema;
for (size_t i=0, end=_childNodes.size(); i<end; i++)
{
inputSchemas.push_back(_childNodes[i]->inferTypes(query));
}
outputSchema = _logicalOperator->inferSchema(inputSchemas, query);
//FIXME: May be cover inferSchema method with another one and assign alias there?
if (!_logicalOperator->getAliasName().empty())
{
outputSchema.addAlias(_logicalOperator->getAliasName());
}
_logicalOperator->setSchema(outputSchema);
LOG4CXX_DEBUG(logger, "Inferred schema for operator " <<
_logicalOperator->getLogicalName() << ": " << outputSchema);
return _logicalOperator->getSchema();
}
示例15: parser
FITSInputArray::FITSInputArray(ArrayDesc const& array, string const& filePath, uint32_t hdu, std::shared_ptr<Query>& query)
: parser(filePath),
hdu(hdu),
desc(array),
dims(array.getDimensions()),
nDims(dims.size()),
nAttrs(array.getAttributes(true).size()),
values(nAttrs),
chunks(nAttrs),
chunkIterators(nAttrs),
chunkIndex(0),
chunkPos(nDims),
query(query)
{
initValueHolders();
// Most initialization steps are only done later, when the first
// chunk is requested by an iterator. See getChunkByIndex()
}