Skip to content

Commit

Permalink
feat(nimtable): nimtable hide iceberg row (#18410)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzl25 committed Sep 20, 2024
1 parent fb71f75 commit b558778
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/frontend/src/handler/create_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use risingwave_common::array::arrow::IcebergArrowConvert;
use risingwave_common::bail_not_implemented;
use risingwave_common::catalog::{
debug_assert_column_ids_distinct, ColumnCatalog, ColumnDesc, ColumnId, Schema, TableId,
INITIAL_SOURCE_VERSION_ID, KAFKA_TIMESTAMP_COLUMN_NAME,
INITIAL_SOURCE_VERSION_ID, KAFKA_TIMESTAMP_COLUMN_NAME, ROWID_PREFIX,
};
use risingwave_common::license::Feature;
use risingwave_common::secret::LocalSecretManager;
Expand Down Expand Up @@ -1366,7 +1366,9 @@ pub async fn extract_iceberg_columns(
);
ColumnCatalog {
column_desc,
is_hidden: false,
// hide the _row_id column for nimtable
// This column is auto generated when users define a table without primary key
is_hidden: field.name() == ROWID_PREFIX,
}
})
.collect();
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/handler/create_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use pgwire::pg_response::{PgResponse, StatementType};
use risingwave_common::bail_not_implemented;
use risingwave_common::catalog::{
CdcTableDesc, ColumnCatalog, ColumnDesc, Engine, TableId, TableVersionId, DEFAULT_SCHEMA_NAME,
INITIAL_TABLE_VERSION_ID,
INITIAL_TABLE_VERSION_ID, ROWID_PREFIX,
};
use risingwave_common::license::Feature;
use risingwave_common::util::iter_util::ZipEqFast;
Expand Down Expand Up @@ -1395,9 +1395,9 @@ pub async fn handle_create_table(

// There is a table without primary key. We will use _row_id as primary key
let sink_from = if pks.is_empty() {
pks = vec!["_row_id".to_string()];
pks = vec![ROWID_PREFIX.to_string()];
let [stmt]: [_; 1] =
Parser::parse_sql(&format!("select _row_id, * from {}", table_name))
Parser::parse_sql(&format!("select {}, * from {}", ROWID_PREFIX, table_name))
.context("unable to parse query")?
.try_into()
.unwrap();
Expand Down

0 comments on commit b558778

Please sign in to comment.