Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support materialized view schema change #3739

Closed
wants to merge 95 commits into from

Conversation

HangyuanLiu
Copy link
Contributor

@HangyuanLiu HangyuanLiu commented Jun 1, 2020

Support materialized view schema change history data
1、bitmap
2、hll
3、count

liuhangyuan1 and others added 30 commits March 26, 2019 18:39
@HangyuanLiu HangyuanLiu reopened this Jun 10, 2020
@HangyuanLiu HangyuanLiu changed the title [WIP] Support materialized view schema change Support materialized view schema change Jun 10, 2020
# Conflicts:
#	be/src/olap/schema_change.cpp
#	be/src/olap/schema_change.h
#	fe/src/main/java/org/apache/doris/task/AlterReplicaTask.java
@HangyuanLiu HangyuanLiu self-assigned this Jun 11, 2020
@HangyuanLiu HangyuanLiu added area/materialized-view Issues or PRs related to materialized view kind/feature Categorizes issue or PR as related to a new feature. labels Jun 11, 2020
struct TAlterMaterializedViewParam {
1: required string column_name
2: required string origin_column_name
3: optional string mv_expr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using TExpr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The materialized view is a calculation of an expression.But we construct materialized view in olap/schema_change.cpp. we can't use expr and exec in olap layer now.So I used some hard coding to deal with this problem.May be we can refactor this part of the code until the uniform expression evaluates the logic.

switch (ref_column.type()) {
case OLAP_FIELD_TYPE_TINYINT:
if (*(int8_t *) src < 0) {
LOG(WARNING) << "The input: " << *(int8_t *) src
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about return Status with this error message?
And do not print log here, it may lead to lots of log, and this error info should return to user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good suggestion,but it involves a lot of modification points, I will add this feature optimization in the next PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about return Status with this error message?
And do not print log here, it may lead to lots of log, and this error info should return to user.

+1

switch (ref_column.type()) {
case OLAP_FIELD_TYPE_TINYINT:
if (*(int8_t *) src < 0) {
LOG(WARNING) << "The input: " << *(int8_t *) src
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about return Status with this error message?
And do not print log here, it may lead to lots of log, and this error info should return to user.

+1

EmmyMiao87 pushed a commit that referenced this pull request Jul 16, 2020
…#3739] (#3873)

+ Building the materialized view function for schema_change here based on defineExpr.
+ This is a trick because the current storage layer does not support expression evaluation.
+ count distinct materialized view will set mv_expr with to_bitmap or hll_hash.
+ count materialized view will set mv_expr with count.
+ Support to regenerate historical data when a new materialized view is created in BE。
    + Support to_bitmap function
    + Support hll_hash function
    + Support count(field) function
For #3344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/materialized-view Issues or PRs related to materialized view kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants