Skip to content

Commit 087c873

Browse files
authored
chore(query): Virtual column support external table (#18981)
1 parent d24a071 commit 087c873

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/query/ee/src/storages/fuse/operations/virtual_columns.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ pub async fn do_refresh_virtual_column(
107107
});
108108

109109
if !fuse_table.support_virtual_columns() {
110-
return Err(ErrorCode::VirtualColumnError(
111-
"table don't support virtual column".to_string(),
112-
));
110+
return Err(ErrorCode::VirtualColumnError(format!(
111+
"Table don't support virtual column, storage_format: {} read_only: {}",
112+
fuse_table.get_storage_format(),
113+
fuse_table.is_read_only()
114+
)));
113115
}
114116
let virtual_column_builder = VirtualColumnBuilder::try_create(ctx.clone(), source_schema)?;
115117

src/query/storages/fuse/src/fuse_table.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,7 @@ impl Table for FuseTable {
12731273
}
12741274

12751275
fn support_virtual_columns(&self) -> bool {
1276-
if matches!(self.storage_format, FuseStorageFormat::Parquet)
1277-
&& matches!(self.table_type, FuseTableType::Standard)
1278-
{
1276+
if matches!(self.storage_format, FuseStorageFormat::Parquet) && !self.is_read_only() {
12791277
// ignore persistent system tables {
12801278
if let Ok(database_name) = self.table_info.database_name() {
12811279
if database_name == "persistent_system" {

src/query/storages/fuse/src/fuse_type.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
use std::fmt::Display;
16+
use std::fmt::Formatter;
1517
use std::str::FromStr;
1618

1719
use databend_common_exception::ErrorCode;
@@ -50,6 +52,15 @@ pub enum FuseStorageFormat {
5052
Native,
5153
}
5254

55+
impl Display for FuseStorageFormat {
56+
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
57+
match self {
58+
FuseStorageFormat::Parquet => write!(f, "Parquet"),
59+
FuseStorageFormat::Native => write!(f, "Native"),
60+
}
61+
}
62+
}
63+
5364
impl FromStr for FuseStorageFormat {
5465
type Err = ErrorCode;
5566

0 commit comments

Comments
 (0)