feat: opentsdb support (#274)

* feat: opentsdb support

* fix: tests

* fix: resolve CR comments

* fix: resolve CR comments

* fix: resolve CR comments

* fix: resolve CR comments

* refactor: remove feature flags for opentsdb and pg

* fix: resolve CR comments

* fix: resolve CR comments

Co-authored-by: luofucong <luofucong@greptime.com>
This commit is contained in:
LFC
2022-09-26 15:47:43 +08:00
committed by GitHub
parent 0fa68ab7a5
commit ca732d45f9
43 changed files with 2300 additions and 376 deletions

View File

@@ -196,12 +196,13 @@ impl ErrorExt for Error {
| BuildTableInfo { .. }
| BuildRegionDescriptor { .. }
| TableExists { .. }
| ColumnExists { .. }
| ProjectedColumnNotFound { .. }
| MissingTimestampIndex { .. }
| UnsupportedDefaultConstraint { .. }
| TableNotFound { .. } => StatusCode::InvalidArguments,
ColumnExists { .. } => StatusCode::TableColumnExists,
TableInfoNotFound { .. } => StatusCode::Unexpected,
ScanTableManifest { .. } | UpdateTableManifest { .. } => StatusCode::StorageUnavailable,

View File

@@ -8,7 +8,7 @@ use async_trait::async_trait;
use common_error::mock::MockError;
use common_telemetry::logging;
use datatypes::prelude::{Value, VectorBuilder, VectorRef};
use datatypes::schema::ColumnSchema;
use datatypes::schema::{ColumnSchema, Schema};
use storage::metadata::{RegionMetaImpl, RegionMetadata};
use storage::write_batch::{Mutation, WriteBatch};
use store_api::storage::{
@@ -75,14 +75,31 @@ impl Snapshot for MockSnapshot {
async fn scan(
&self,
_ctx: &ReadContext,
_request: ScanRequest,
request: ScanRequest,
) -> Result<ScanResponse<MockChunkReader>> {
let memtable = {
let memtable = self.region.memtable.read().unwrap();
memtable.clone()
};
let schema = self.schema();
let projection_schema = if let Some(projection) = request.projection {
let mut columns = Vec::with_capacity(projection.len());
for idx in projection {
columns.push(
schema
.column_schema_by_name(schema.column_name_by_index(idx))
.unwrap()
.clone(),
);
}
Arc::new(Schema::new(columns))
} else {
schema.clone()
};
let reader = MockChunkReader {
schema: self.schema().clone(),
schema: projection_schema,
memtable,
read: false,
};