┌─────────────────────┐ │ HoraeDBClient │ └─────────────────────┘ │ ▼ ┌─────────────────────┐ │ QueryClient │───┐ └─────────────────────┘ │ │ │Async to retry │ │ ┌────────────┘ │ │ │ │ ┌─────────────────────┐ │ ┌─────────────────────┐ ┌─────────────────────┐ └─▶│ RouterClient │◀─┴──▶│ RouterCache │◀─────▶│ RouterFor │ └─────────────────────┘ └─────────────────────┘ └─────────────────────┘ ▲ │ │ │ ▼ │ ┌─────────────────────┐ │ │ RpcClient │◀──────────────────────────────────────────────┘ └─────────────────────┘ ▲ │ ▼ ┌─────────────────────┐ │ Default GRPC impl │ └─────────────────────┘ ▲ │ ┌───────────────────┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ ▼ ▼ ▼ ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ │ HoraeDB Node1 │ │ HoraeDB Node2 │ │ ... │ └─────────────────────┘ └─────────────────────┘ └─────────────────────┘
/** * According to the conditions, query data from the database. * * @param req the query request * @param ctx the invoke context * @return query result */ CompletableFuture<Result<SqlQueryOk, Err>> sqlQuery(SqlQueryRequest req, Context ctx);
name | desc |
---|---|
SqlQueryRequest req | Query request, including tables and sql fields, tables is a suggested field, if filled in, there will be more efficient routing, if not filled, the sql statement will be automatically parsed for routing (need to introduce the horaedb-sql module) |
Context ctx | Call context, to achieve some special requirements, the content in ctx will be written into the headers metadata of gRPC |
CompletableFuture<Result<SqlQueryOk, Err>>
Result<SqlQueryOk, Err>
SqlQueryOk
Row
List<Row>
, or process it through stream.Row
: row.getColumn("cpu_util").value().getDouble()
Err