kasakrisz commented on code in PR #5216:
URL: https://github.com/apache/hive/pull/5216#discussion_r1625541578
##########
ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java:
##########
@@ -1570,10 +1571,28 @@ public Set<FileSinkDesc> getAcidFileSinks() {
return acidFileSinks;
}
- public boolean hasTransactionalInQuery() {
+ public boolean hasReadWriteAcidInQuery() {
return transactionalInQuery;
}
+ public boolean hasAcidResourcesInQuery() {
+ return hasReadWriteAcidInQuery() || getAcidDdlDesc() != null ||
+ Stream.of(getInputs(), getOutputs()).flatMap(Collection::stream)
+ .filter(entity -> entity.getType() == Entity.Type.TABLE ||
entity.getType() == Entity.Type.PARTITION)
+ .flatMap(entity -> {
+ Table tbl = entity.getTable();
+ if (tbl.isMaterializedView() && tbl.getMVMetadata() != null) {
+ return
tbl.getMVMetadata().getSourceTables().stream().map(SourceTable::getTable);
Review Comment:
not necessary:
```
set hive.support.concurrency=true;
set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
create table t1(c int, d int, f string);
insert into t1 values(10, 21,'one'),(30, 22,'three'),(60, 23,'one'),(70,
24,'three'),(80, 25,'three');
create materialized view mat1 disable rewrite stored as orc TBLPROPERTIES
('transactional'='true') as
select c, sum(d) from t1 group by c;
show materialized views;
```
```
# MV Name Rewriting Enabled Mode
Incremental rebuild
mat1 No Manual refresh Not
available
```
```
describe formatted mat1;
```
```
# Materialized View Source table information
Table name Snapshot
default.t1 Unknown
```
So this MV can not be used in automatic query rewrites because Hive can not
confirm whether it is up to date but it can be used in queries:
```
select * from mat1 join t1 on mat1.c = t1.c where d > 10
```
--
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]