Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust/frontend/src/catalog/database_catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl DatabaseCatalog {
self.schema_by_name.get_mut(schema)
}

pub fn id(&self) -> u32 {
pub fn id(&self) -> u64 {
self.id
}
}
10 changes: 5 additions & 5 deletions rust/frontend/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ use risingwave_common::error::ErrorCode;
use thiserror::Error;

pub(crate) mod catalog_service;
mod column_catalog;
pub(crate) mod column_catalog;
mod database_catalog;
mod schema_catalog;
mod table_catalog;

pub(crate) type DatabaseId = u32;
pub(crate) type SchemaId = u32;
pub(crate) type TableId = u32;
pub(crate) type ColumnId = u32;
pub(crate) type DatabaseId = u64;
pub(crate) type SchemaId = u64;
pub(crate) type TableId = u64;
pub(crate) type ColumnId = u64;

#[derive(Error, Debug)]
pub enum CatalogError {
Expand Down
10 changes: 5 additions & 5 deletions rust/frontend/src/catalog/table_catalog.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::atomic::{AtomicU64, Ordering};

use risingwave_common::array::RwError;
use risingwave_common::error::Result;
Expand All @@ -9,7 +9,7 @@ use crate::catalog::{ColumnId, TableId};

pub struct TableCatalog {
table_id: TableId,
next_column_id: AtomicU32,
next_column_id: AtomicU64,
column_by_name: Vec<(String, ColumnCatalog)>,
primary_keys: Vec<ColumnId>,
}
Expand All @@ -18,7 +18,7 @@ impl TableCatalog {
pub fn new(table_id: TableId) -> Self {
Self {
table_id,
next_column_id: AtomicU32::new(0),
next_column_id: AtomicU64::new(0),
column_by_name: vec![],
primary_keys: vec![],
}
Expand Down Expand Up @@ -52,7 +52,7 @@ impl TableCatalog {
self.table_id
}

pub fn get_pks(&self) -> Vec<u32> {
pub fn get_pks(&self) -> Vec<u64> {
self.primary_keys.clone()
}
}
Expand All @@ -61,7 +61,7 @@ impl TryFrom<&Table> for TableCatalog {
type Error = RwError;

fn try_from(tb: &Table) -> Result<Self> {
let mut table_catalog = Self::new(tb.get_table_ref_id()?.table_id as u32);
let mut table_catalog = Self::new(tb.get_table_ref_id()?.table_id as u64);
for col in &tb.column_descs {
table_catalog.add_column(
&col.name,
Expand Down
14 changes: 11 additions & 3 deletions rust/frontend/src/optimizer/plan_node/batch_seq_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ use std::fmt;
use risingwave_common::catalog::Schema;

use super::{IntoPlanRef, PlanRef, ToDistributedBatch};
use crate::optimizer::plan_node::LogicalScan;
use crate::optimizer::property::{WithDistribution, WithOrder, WithSchema};

#[derive(Debug, Clone)]
pub struct BatchSeqScan {
// TODO(catalog)
logical: LogicalScan,
}
impl WithSchema for BatchSeqScan {
fn schema(&self) -> &Schema {
todo!()
self.logical.schema()
}
}

impl BatchSeqScan {
pub fn new(logical: LogicalScan) -> Self {
Self { logical }
}
}

Expand All @@ -24,6 +32,6 @@ impl WithOrder for BatchSeqScan {}
impl WithDistribution for BatchSeqScan {}
impl ToDistributedBatch for BatchSeqScan {
fn to_distributed(&self) -> PlanRef {
todo!()
self.clone().into_plan_ref()
}
}
11 changes: 8 additions & 3 deletions rust/frontend/src/optimizer/plan_node/logical_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ use std::fmt;
use risingwave_common::catalog::Schema;

use super::{ColPrunable, IntoPlanRef, PlanRef, ToBatch, ToStream};
use crate::catalog::{ColumnId, TableId};
use crate::optimizer::plan_node::BatchSeqScan;
use crate::optimizer::property::{WithDistribution, WithOrder, WithSchema};

#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct LogicalScan {
// TODO(catalog)
table_id: TableId,
columns: Vec<ColumnId>,
schema: Schema,
}
impl WithSchema for LogicalScan {
fn schema(&self) -> &Schema {
todo!()
&self.schema
}
}
impl_plan_tree_node_for_leaf! {LogicalScan}
Expand All @@ -26,7 +31,7 @@ impl fmt::Display for LogicalScan {
impl ColPrunable for LogicalScan {}
impl ToBatch for LogicalScan {
fn to_batch(&self) -> PlanRef {
todo!()
BatchSeqScan::new(self.clone()).into_plan_ref()
}
}
impl ToStream for LogicalScan {
Expand Down