Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-26497 Support materialized views on Iceberg source tables
  3. HIVE-26924

Alter materialized view enable rewrite throws SemanticException for source iceberg table

    XMLWordPrintableJSON

Details

    Description

      alter materialized view enable rewrite throws SemanticException for source iceberg table

      SQL test

      >>> create materialized view mv_rewrite as select t, si from all100k where t>115;
      
      >>> analyze table mv_rewrite compute statistics for columns;
      
      >>> set hive.explain.user=false;
      
      >>> explain select si,t from all100k where t>116 and t<120;
      !!! match row_contains
                alias: iceberg_test_db_hive.mv_rewrite
      
      >>> alter materialized view mv_rewrite disable rewrite;
      
      >>> explain select si,t from all100k where t>116 and t<120;
      !!! match row_contains
                alias: all100k
      
      >>> alter materialized view mv_rewrite enable rewrite;
      
      >>> explain select si,t from all100k where t>116 and t<120;
      !!! match row_contains
                alias: iceberg_test_db_hive.mv_rewrite
      
      >>> drop materialized view mv_rewrite; 

       

      Error

      2023-01-10T18:40:34,303 INFO  [pool-3-thread-1] jdbc.TestDriver: Query: alter materialized view mv_rewrite enable rewrite
      2023-01-10T18:40:34,365 INFO  [Thread-10] jdbc.TestDriver: INFO  : Compiling command(queryId=hive_20230110184034_f557b4a6-40a0-42ba-8e67-2f273f50af36): alter materialized view mv_rewrite enable rewrite
      2023-01-10T18:40:34,426 INFO  [Thread-10] jdbc.TestDriver: ERROR : FAILED: SemanticException Automatic rewriting for materialized view cannot be enabled if the materialized view uses non-transactional tables
      2023-01-10T18:40:34,426 INFO  [Thread-10] jdbc.TestDriver: org.apache.hadoop.hive.ql.parse.SemanticException: Automatic rewriting for materialized view cannot be enabled if the materialized view uses non-transactional tables
      2023-01-10T18:40:34,426 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.ddl.view.materialized.alter.rewrite.AlterMaterializedViewRewriteAnalyzer.analyzeInternal(AlterMaterializedViewRewriteAnalyzer.java:75)
      2023-01-10T18:40:34,426 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:313)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Compiler.analyze(Compiler.java:222)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Compiler.compile(Compiler.java:105)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:201)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:657)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:603)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.Driver.compileAndRespond(Driver.java:597)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.hive.ql.reexec.ReExecDriver.compileAndRespond(ReExecDriver.java:127)
      2023-01-10T18:40:34,427 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:206)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork$1.run(SQLOperation.java:336)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.security.AccessController.doPrivileged(Native Method)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/javax.security.auth.Subject.doAs(Subject.java:423)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1899)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at org.apache.hive.service.cli.operation.SQLOperation$BackgroundWork.run(SQLOperation.java:358)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      2023-01-10T18:40:34,428 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      2023-01-10T18:40:34,429 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      2023-01-10T18:40:34,429 INFO  [Thread-10] jdbc.TestDriver:      at java.base/java.lang.Thread.run(Thread.java:829)
      2023-01-10T18:40:34,429 INFO  [Thread-10] jdbc.TestDriver:
      2023-01-10T18:40:34,429 INFO  [Thread-10] jdbc.TestDriver: INFO  : Completed compiling command(queryId=hive_20230110184034_f557b4a6-40a0-42ba-8e67-2f273f50af36); Time taken: 0.03 seconds
      2023-01-10T18:40:34,520 ERROR [pool-3-thread-1] jdbc.TestDriver: Error while compiling statement: FAILED: SemanticException Automatic rewriting for materialized view cannot be enabled if the materialized view uses non-transactional tables 

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              dharmikt Dharmik Thakkar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h