Skip to content

Commit

Permalink
Remove stale code
Browse files Browse the repository at this point in the history
  • Loading branch information
danielligman authored and andrewseidl committed Apr 5, 2022
1 parent 84d5429 commit c93c765
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 33 deletions.
3 changes: 1 addition & 2 deletions Parser/ParserWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class ParserWrapper {
bool is_itas = false;
bool is_copy = false;
bool is_copy_to = false;
bool is_optimize = false;
bool is_validate = false;

DMLType getDMLType() const { return dml_type_; }
Expand Down Expand Up @@ -100,7 +99,7 @@ class ParserWrapper {
if (is_ddl_) {
return isCalcitePermissableDdl(read_only_mode);
}
return (!is_optimize && !is_validate && isCalcitePermissableDml(read_only_mode) &&
return (!is_validate && isCalcitePermissableDml(read_only_mode) &&
!(explain_type_ == ExplainType::Other));
}

Expand Down
31 changes: 0 additions & 31 deletions ThriftHandler/DBHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6506,37 +6506,6 @@ void DBHandler::sql_execute_impl(ExecutionResult& _return,
auto result_future = execute_rel_alg_task->get_future();
result_future.get();
return;
} else if (pw.is_optimize) {
// Get the Stmt object
std::unique_ptr<Parser::Stmt> stmt =
Parser::create_stmt_for_query(query_str, *session_ptr);
const auto optimize_stmt = dynamic_cast<Parser::OptimizeTableStmt*>(stmt.get());
CHECK(optimize_stmt);

_return.addExecutionTime(measure<>::execution([&]() {
const auto td_with_lock =
lockmgr::TableSchemaLockContainer<lockmgr::WriteLock>::acquireTableDescriptor(
cat, optimize_stmt->getTableName());
const auto td = td_with_lock();

if (!td ||
!user_can_access_table(*session_ptr, td, AccessPrivileges::DELETE_FROM_TABLE)) {
throw std::runtime_error("Table " + optimize_stmt->getTableName() +
" does not exist.");
}
if (td->isView) {
throw std::runtime_error("OPTIMIZE TABLE command is not supported on views.");
}

auto executor = Executor::getExecutor(
Executor::UNITARY_EXECUTOR_ID, "", "", system_parameters_);
const TableOptimizer optimizer(td, executor.get(), cat);
if (optimize_stmt->shouldVacuumDeletedRows()) {
optimizer.vacuumDeletedRows();
}
optimizer.recomputeMetadata();
}));
return;
}

// TODO: is this following check even necessary any more ?
Expand Down

0 comments on commit c93c765

Please sign in to comment.