Skip to content

Conversation

@seawinde
Copy link
Contributor

@seawinde seawinde commented Aug 6, 2024

Proposed changes

pr: #38115
commitId: 2b29288

pr: #38008
commitId: c6b924d

pr: #37929
commitId: d44fcdc

seawinde and others added 4 commits August 6, 2024 14:06
…sert and insert overwrite dml (apache#38115)

Support querying rewrite by materialized view when DML such as insert
and insert overwrite , into outfile etc.
this is default enable, you can disable it by `set
enable_dml_materialized_view_rewrite = false`
and the `enable_materialized_view_rewrite` is only control DQL.

It would not rewrite by materialized view when query sql use external
table.
If you want rewrite by materialized view when use external table in DML,
you should `set
enable_dml_materialized_view_rewrite_when_base_table_unawareness =
true;`
this is default false.
…iew (apache#38008)

Support to use cast when create sync materialized view
Such as sync mv def is as following:

you can use cast(FLOOR(MINUTE(`time`) / 15) as decimal(9, 0)) in mv
def which is not allowed before.

CREATE MATERIALIZED VIEW sync_mv
AS
SELECT 
  decision,
  code, 
  app_name, 
  event_id, 
  event_type, 
  date_trunc(time, 'minute'), 
  DATE_FORMAT(
    `time`, '%Y-%m-%d'
  ), 
  cast(FLOOR(MINUTE(time) / 15) as decimal(9, 0)),
  count(id) as cnt
from 
  test 
group by 
  code, 
  app_name, 
  event_id, 
  event_type, 
  date_trunc(time, 'minute'), 
  decision, 
  DATE_FORMAT(time, '%Y-%m-%d'), 
  cast(FLOOR(MINUTE(`time`) / 15) as decimal(9, 0));
…#37929)

Support variants rewrite by materialized view

Such as the mv def is as following:

CREATE MATERIALIZED VIEW test1 BUILD IMMEDIATE REFRESH AUTO ON MANUAL
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1') 
as
   SELECT
   id,
   type,
   actor,
   payload,
   payload['pull_request']
   FROM github_events1;

the query following can rewrite successfully and the data is right

  SELECT
  id,
  type,
  floor(cast(actor['id'] as int) + 100.5),
  actor['display_login'],
  payload['pull_request']['id']
  FROM github_events1;
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@seawinde
Copy link
Contributor Author

seawinde commented Aug 6, 2024

run buildall

1 similar comment
@seawinde
Copy link
Contributor Author

seawinde commented Aug 6, 2024

run buildall

@seawinde seawinde force-pushed the rebase_some_pr_from_master_to_branch21 branch from 27df2d7 to c536771 Compare August 6, 2024 15:37
@seawinde
Copy link
Contributor Author

seawinde commented Aug 6, 2024

run buildall

@yiguolei yiguolei merged commit 2b1aa05 into apache:branch-2.1 Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants