felixwluo commented on PR #44884: URL: https://github.com/apache/doris/pull/44884#issuecomment-2511590910
> ### What problem does this PR solve? > Issue Number: close #xxx > > reproduction: > > ``` > create database test; > > use test; > > CREATE TABLE tb1 ( > `id` bigint NOT NULL COMMENT '', > `map_infos` map < int, > varchar(65533) > NULL COMMENT '' > ) ENGINE = OLAP UNIQUE KEY(`id`) COMMENT 'test' DISTRIBUTED BY HASH(`id`) BUCKETS 2 PROPERTIES ( > "replication_allocation" = "tag.location.default: 1", > "min_load_replica_num" = "-1", > "is_being_synced" = "false", > "storage_medium" = "hdd", > "storage_format" = "V2", > "inverted_index_storage_format" = "V1", > "enable_unique_key_merge_on_write" = "true", > "light_schema_change" = "true", > "disable_auto_compaction" = "false", > "enable_single_replica_compaction" = "false", > "group_commit_interval_ms" = "10000", > "group_commit_data_bytes" = "134217728", > "enable_mow_light_delete" = "false" > ); > > insert into > tb1 > select > id, > map_agg(a, b) > from > ( > select > 123 id, > 3 a, > '5' b > union > all > select > 123 id, > 6 a, > '8' b > ) aa > group by > id; > > CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 10 MINUTE DUPLICATE KEY(info_id) DISTRIBUTED BY HASH(`info_id`) BUCKETS 2 PROPERTIES ( > "replication_allocation" = "tag.location.default: 1", > "min_load_replica_num" = "-1", > "is_being_synced" = "false", > "colocate_with" = "dwd_info_group", > "storage_medium" = "hdd", > "storage_format" = "V2", > "inverted_index_storage_format" = "V1", > "light_schema_change" = "true", > "disable_auto_compaction" = "false", > "enable_single_replica_compaction" = "false", > "group_commit_interval_ms" = "10000", > "group_commit_data_bytes" = "134217728", > "enable_nondeterministic_function" = "true" > ) AS > select > /*+ SET_VAR(enable_force_spill = true) */ > cast(a.id as bigint) info_id, > map_infos > from > tb1 a; > > CREATE MATERIALIZED VIEW mv2 BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 10 MINUTE DUPLICATE KEY(info_id) DISTRIBUTED BY HASH(`info_id`) BUCKETS 2 PROPERTIES ( > "replication_allocation" = "tag.location.default: 1", > "min_load_replica_num" = "-1", > "is_being_synced" = "false", > "colocate_with" = "dwd_info_group", > "storage_medium" = "hdd", > "storage_format" = "V2", > "inverted_index_storage_format" = "V1", > "light_schema_change" = "true", > "disable_auto_compaction" = "false", > "enable_single_replica_compaction" = "false", > "group_commit_interval_ms" = "10000", > "group_commit_data_bytes" = "134217728", > "enable_nondeterministic_function" = "true" > ) AS > select > info_id, > map_infos > from > mv1 a; > ``` > > report an error: `java.lang.NullPointerException: Cannot invoke "org.apache.doris.nereids.StatementContext.getConnectContext()" because "context" is null` > > reason: > > ``` > 1. When creating materialized views, we need to parse the query statement (logicalQuery). > 2. The query contains the SET_VAR hint (for example, /*+ SET_VAR(enable_force_spill = true) */). > 3. When parsing the hint, you need to access StatementContext to set the session variable. > 4. However, when creating the second materialized view, using the first materialized view as the data source, the parser tries to get StatementContext from ConnectContext, but StatementContext is null. > ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
