use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph-toolchain by apache.
the class IndexLabelAPI method append.
public IndexLabel append(IndexLabel indexLabel) {
if (this.client.apiVersionLt("0.50")) {
throw new NotSupportException("action append on index label");
}
String id = indexLabel.name();
Map<String, Object> params = ImmutableMap.of("action", "append");
Object il = this.checkCreateOrUpdate(indexLabel);
RestResult result = this.client.put(this.path(), id, il, params);
return result.readObject(IndexLabel.class);
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph-toolchain by apache.
the class IndexLabelAPI method eliminate.
public IndexLabel eliminate(IndexLabel indexLabel) {
if (this.client.apiVersionLt("0.50")) {
throw new NotSupportException("action eliminate on index label");
}
String id = indexLabel.name();
Map<String, Object> params = ImmutableMap.of("action", "eliminate");
Object il = this.checkCreateOrUpdate(indexLabel);
RestResult result = this.client.put(this.path(), id, il, params);
return result.readObject(IndexLabel.class);
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.
the class RocksDBTable method queryByCond.
protected BackendColumnIterator queryByCond(Session session, ConditionQuery query) {
if (query.containsScanRelation()) {
E.checkArgument(query.relations().size() == 1, "Invalid scan with multi conditions: %s", query);
Relation scan = query.relations().iterator().next();
Shard shard = (Shard) scan.value();
return this.queryByRange(session, shard, query.page());
}
throw new NotSupportException("query: %s", query);
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.
the class CassandraTable method relation2Cql.
protected Clause relation2Cql(Relation relation) {
String key = relation.serialKey().toString();
Object value = relation.serialValue();
switch(relation.relation()) {
case EQ:
return QueryBuilder.eq(key, value);
case GT:
return QueryBuilder.gt(key, value);
case GTE:
return QueryBuilder.gte(key, value);
case LT:
return QueryBuilder.lt(key, value);
case LTE:
return QueryBuilder.lte(key, value);
case IN:
return Clauses.in(key, (List<?>) value);
case CONTAINS_VALUE:
return QueryBuilder.contains(key, value);
case CONTAINS_KEY:
return QueryBuilder.containsKey(key, value);
case SCAN:
String[] col = pkColumnName().stream().map(pk -> formatKey(pk)).toArray(String[]::new);
Shard shard = (Shard) value;
Object start = QueryBuilder.raw(shard.start());
Object end = QueryBuilder.raw(shard.end());
return Clauses.and(QueryBuilder.gte(QueryBuilder.token(col), start), QueryBuilder.lt(QueryBuilder.token(col), end));
// return QueryBuilder.like(key, value);
case NEQ:
default:
throw new NotSupportException("relation '%s'", relation);
}
}
use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.
the class InMemoryDBTable method queryNumber.
@Override
public Number queryNumber(BackendSession session, Query query) {
Aggregate aggregate = query.aggregateNotNull();
if (aggregate.func() != AggregateFunc.COUNT) {
throw new NotSupportException(aggregate.toString());
}
assert aggregate.func() == AggregateFunc.COUNT;
Iterator<BackendEntry> results = this.query(session, query);
long total = 0L;
while (results.hasNext()) {
total += this.sizeOfBackendEntry(results.next());
}
return total;
}
Aggregations