mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-27 10:20:38 +00:00
Merge branch 'main' into snapshot-1
This commit is contained in:
@@ -89,7 +89,7 @@ pub fn patch_batch_timezone(
|
||||
let patched_columns: Vec<ArrayRef> = expected_schema
|
||||
.fields()
|
||||
.iter()
|
||||
.zip(columns.into_iter())
|
||||
.zip(columns)
|
||||
.map(|(expected_field, column)| {
|
||||
let expected_type = expected_field.data_type();
|
||||
let actual_type = column.data_type();
|
||||
|
||||
@@ -139,7 +139,7 @@ impl ParallelizeScan {
|
||||
}
|
||||
|
||||
// Sort ranges by number of rows in descending order.
|
||||
ranges.sort_by(|a, b| b.num_rows.cmp(&a.num_rows));
|
||||
ranges.sort_by_key(|b| std::cmp::Reverse(b.num_rows));
|
||||
let mut partition_ranges = vec![vec![]; expected_partition_num];
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
|
||||
@@ -375,10 +375,10 @@ impl TreeNodeVisitor<'_> for ScanHintVisitor {
|
||||
LogicalPlan::Filter(_) => {
|
||||
self.vector_search.on_filter_exit();
|
||||
}
|
||||
LogicalPlan::Subquery(_) | LogicalPlan::SubqueryAlias(_) => {
|
||||
if is_branching_for_vector(_node) {
|
||||
self.vector_search.on_branching_exit();
|
||||
}
|
||||
LogicalPlan::Subquery(_) | LogicalPlan::SubqueryAlias(_)
|
||||
if is_branching_for_vector(_node) =>
|
||||
{
|
||||
self.vector_search.on_branching_exit();
|
||||
}
|
||||
_ if _node.inputs().len() > 1 => {
|
||||
self.vector_search.on_branching_exit();
|
||||
|
||||
@@ -531,8 +531,7 @@ impl PromPlanner {
|
||||
.use_tsid
|
||||
.then_some(DfExpr::Column(Column::from_name(
|
||||
DATA_SCHEMA_TSID_COLUMN_NAME,
|
||||
)))
|
||||
.into_iter(),
|
||||
))),
|
||||
)
|
||||
.chain(Some(self.create_time_index_column_expr()?));
|
||||
|
||||
@@ -1459,8 +1458,7 @@ impl PromPlanner {
|
||||
.use_tsid
|
||||
.then_some(DfExpr::Column(Column::new_unqualified(
|
||||
DATA_SCHEMA_TSID_COLUMN_NAME,
|
||||
)))
|
||||
.into_iter(),
|
||||
))),
|
||||
)
|
||||
.chain(Some(self.create_time_index_column_expr()?))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1974,15 +1972,10 @@ impl PromPlanner {
|
||||
.iter()
|
||||
.map(|tag| DfExpr::Column(Column::from_name(tag))),
|
||||
)
|
||||
.chain(
|
||||
self.ctx
|
||||
.use_tsid
|
||||
.then_some(DfExpr::Column(Column::new(
|
||||
Some(table_ref.clone()),
|
||||
DATA_SCHEMA_TSID_COLUMN_NAME.to_string(),
|
||||
)))
|
||||
.into_iter(),
|
||||
)
|
||||
.chain(self.ctx.use_tsid.then_some(DfExpr::Column(Column::new(
|
||||
Some(table_ref.clone()),
|
||||
DATA_SCHEMA_TSID_COLUMN_NAME.to_string(),
|
||||
))))
|
||||
.chain(Some(DfExpr::Alias(Alias {
|
||||
expr: Box::new(DfExpr::Cast(Cast {
|
||||
expr: Box::new(self.create_time_index_column_expr()?),
|
||||
@@ -2020,8 +2013,7 @@ impl PromPlanner {
|
||||
.use_tsid
|
||||
.then_some(DfExpr::Column(Column::from_name(
|
||||
DATA_SCHEMA_TSID_COLUMN_NAME,
|
||||
)))
|
||||
.into_iter(),
|
||||
))),
|
||||
)
|
||||
.chain(Some(self.create_time_index_column_expr()?))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -215,10 +215,10 @@ pub async fn show_databases(
|
||||
fn replace_column_in_expr(expr: &mut sqlparser::ast::Expr, from_column: &str, to_column: &str) {
|
||||
let _ = visit_expressions_mut(expr, |e| {
|
||||
match e {
|
||||
sqlparser::ast::Expr::Identifier(ident) => {
|
||||
if ident.value.eq_ignore_ascii_case(from_column) {
|
||||
ident.value = to_column.to_string();
|
||||
}
|
||||
sqlparser::ast::Expr::Identifier(ident)
|
||||
if ident.value.eq_ignore_ascii_case(from_column) =>
|
||||
{
|
||||
ident.value = to_column.to_string();
|
||||
}
|
||||
sqlparser::ast::Expr::CompoundIdentifier(idents) => {
|
||||
if let Some(last) = idents.last_mut()
|
||||
@@ -748,23 +748,17 @@ pub fn show_variable(stmt: ShowVariables, query_ctx: QueryContextRef) -> Result<
|
||||
.pg_intervalstyle_format();
|
||||
style.to_string()
|
||||
}
|
||||
"MAX_EXECUTION_TIME" => {
|
||||
if query_ctx.channel() == Channel::Mysql {
|
||||
"MAX_EXECUTION_TIME"
|
||||
if query_ctx.channel() == Channel::Mysql => {
|
||||
query_ctx.query_timeout_as_millis().to_string()
|
||||
} else {
|
||||
return UnsupportedVariableSnafu { name: variable }.fail();
|
||||
}
|
||||
}
|
||||
"STATEMENT_TIMEOUT" => {
|
||||
"STATEMENT_TIMEOUT"
|
||||
// Add time units to postgres query timeout display.
|
||||
if query_ctx.channel() == Channel::Postgres {
|
||||
if query_ctx.channel() == Channel::Postgres => {
|
||||
let mut timeout = query_ctx.query_timeout_as_millis().to_string();
|
||||
timeout.push_str("ms");
|
||||
timeout
|
||||
} else {
|
||||
return UnsupportedVariableSnafu { name: variable }.fail();
|
||||
}
|
||||
}
|
||||
_ => return UnsupportedVariableSnafu { name: variable }.fail(),
|
||||
};
|
||||
let schema = Arc::new(Schema::new(vec![ColumnSchema::new(
|
||||
|
||||
@@ -1198,7 +1198,7 @@ fn split_overlapping_ranges(ranges: &[PartitionRange]) -> BTreeMap<TimeRange, Ve
|
||||
for (range, parts) in forward_iter.chain(backward_iter) {
|
||||
untouched = untouched.iter().flat_map(|r| r.difference(range)).collect();
|
||||
let act = split_range_by(range, parts, &key, idx);
|
||||
actions.extend(act.into_iter());
|
||||
actions.extend(act);
|
||||
}
|
||||
|
||||
for action in actions {
|
||||
|
||||
Reference in New Issue
Block a user