public boolean isRequiresOpenTransaction() {
    return hasTransactionalInQuery() || 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);
          }
          Partition p = entity.getPartition();
          if (p != null) {
            tbl = p.getTable();
          }
          return Stream.of(tbl.getTTable());
        })
        .anyMatch(AcidUtils::isTransactionalTable);
  }
Checks if given specification is proper specification for prefix of
partition cols, for table partitioned by ds, hr, min valid ones are
(ds='2008-04-08'), (ds='2008-04-08', hr='12'), (ds='2008-04-08', hr='12', min='30')
invalid one is for example (ds='2008-04-08', min='30')
@param spec specification key-value map
@return true if the specification is prefix; never returns false, but throws
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java