GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.19k stars 299 forks source link

Alter column option #4395

Open killme2008 opened 1 month ago

killme2008 commented 1 month ago

What problem does the new feature solve?

since v0.9, GreptimeDB supports full-text index for string columns with the extra fulltext option:

CREATE TABLE `logs` (
  `message` STRING FULLTEXT,
  `time` TIMESTAMP TIME INDEX,
) WITH (
  append_mode = 'true'
);

But if you can't enable an existing string column fulltext option by alter.

What does the feature do?

It already has the modify statement to change the column type:

ALTER TABLE monitor MODIFY COLUMN load_15 STRING;

Supports alter column options just like:

ALTER TABLE monitor SET COLUMN load_15 fulltext WITH(analyzer = 'Chinese', case_sensitive = 'false');

Implementation challenges

No response

irenjj commented 1 month ago

maybe we should first add a new enum member for Kind in greptime-proto for expr_factory to use.

killme2008 commented 1 month ago

maybe we should first add a new enum member for Kind in greptime-proto for expr_factory to use.

Yes. A first step.

WenyXu commented 2 weeks ago

I think ALTER COLUMN(or MODIFY COLUMN) should be better, considering we might have unset operation. @irenjj @killme2008

ALTER TABLE monitor ALTER COLUMN load_15 SET fulltext WITH (analyzer = 'Chinese', case_sensitive = 'false');
ALTER TABLE monitor ALTER COLUMN load_15 UNSET fulltext;

Instead of

ALTER TABLE monitor UNSET COLUMN load_15 fulltext;
irenjj commented 2 weeks ago

I think ALTER COLUMN(or MODIFY COLUMN) should be better, considering we might have unset operation. @irenjj @killme2008

ALTER TABLE monitor ALTER COLUMN load_15 SET fulltext WITH (analyzer = 'Chinese', case_sensitive = 'false');
ALTER TABLE monitor ALTER COLUMN load_15 UNSET fulltext;

Instead of

ALTER TABLE monitor UNSET COLUMN load_15 fulltext;

I agree.

killme2008 commented 2 weeks ago

Don't add new syntax, keep using modify column [set | unset].