bool RunUpdate() {
  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();

  auto txn = txn_manager.BeginTransaction();

  /////////////////////////////////////////////////////////
  // INDEX SCAN + PREDICATE
  /////////////////////////////////////////////////////////

  std::unique_ptr<executor::ExecutorContext> context(
      new executor::ExecutorContext(txn));

  // Column ids to be added to logical tile after scan.
  std::vector<oid_t> column_ids;
  oid_t column_count = state.column_count + 1;

  for (oid_t col_itr = 0; col_itr < column_count; col_itr++) {
    column_ids.push_back(col_itr);
  }

  // Create and set up index scan executor

  std::vector<oid_t> key_column_ids;
  std::vector<ExpressionType> expr_types;
  std::vector<Value> values;
  std::vector<expression::AbstractExpression *> runtime_keys;

  auto tuple_count = state.scale_factor * DEFAULT_TUPLES_PER_TILEGROUP;
  auto lookup_key = rand() % tuple_count;

  key_column_ids.push_back(0);
  expr_types.push_back(ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL);
  values.push_back(ValueFactory::GetIntegerValue(lookup_key));

  auto ycsb_pkey_index = user_table->GetIndexWithOid(user_table_pkey_index_oid);

  planner::IndexScanPlan::IndexScanDesc index_scan_desc(
      ycsb_pkey_index, key_column_ids, expr_types, values, runtime_keys);

  // Create plan node.
  auto predicate = nullptr;

  planner::IndexScanPlan index_scan_node(user_table, predicate, column_ids,
                                         index_scan_desc);

  // Run the executor
  executor::IndexScanExecutor index_scan_executor(&index_scan_node,
                                                  context.get());

  /////////////////////////////////////////////////////////
  // UPDATE
  /////////////////////////////////////////////////////////

  planner::ProjectInfo::TargetList target_list;
  planner::ProjectInfo::DirectMapList direct_map_list;

  // Update the second attribute
  for (oid_t col_itr = 0; col_itr < column_count; col_itr++) {
    if (col_itr != 1) {
      direct_map_list.emplace_back(col_itr,
                                   std::pair<oid_t, oid_t>(0, col_itr));
    }
  }

  std::string update_raw_value(ycsb_field_length - 1, 'u');
  Value update_val = ValueFactory::GetStringValue(update_raw_value);
  target_list.emplace_back(
      1, expression::ExpressionUtil::ConstantValueFactory(update_val));

  std::unique_ptr<const planner::ProjectInfo> project_info(
      new planner::ProjectInfo(std::move(target_list),
                               std::move(direct_map_list)));
  planner::UpdatePlan update_node(user_table, std::move(project_info));

  executor::UpdateExecutor update_executor(&update_node, context.get());
  update_executor.AddChild(&index_scan_executor);

  /////////////////////////////////////////////////////////
  // EXECUTE
  /////////////////////////////////////////////////////////

  std::vector<executor::AbstractExecutor *> executors;
  executors.push_back(&update_executor);

  ExecuteTest(executors);

  Result result = txn_manager.CommitTransaction();
  if (result == Result::RESULT_SUCCESS) {
    return true;
  } else {
    assert(result == Result::RESULT_ABORTED ||
           result == Result::RESULT_FAILURE);
    return false;
  }

}
bool RunMixed(ZipfDistribution &zipf, FastRandom &rng) {

  auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance();

  concurrency::Transaction *txn = txn_manager.BeginTransaction();

  std::unique_ptr<executor::ExecutorContext> context(
      new executor::ExecutorContext(txn));

  // Column ids to be added to logical tile.
  std::vector<oid_t> column_ids;
  oid_t column_count = state.column_count + 1;

  // read all the attributes in a tuple.
  for (oid_t col_itr = 0; col_itr < column_count; col_itr++) {
    column_ids.push_back(col_itr);
  }

  // Create and set up index scan executor
  std::vector<oid_t> key_column_ids;
  std::vector<ExpressionType> expr_types;

  key_column_ids.push_back(0);
  expr_types.push_back(ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL);

  std::vector<expression::AbstractExpression *> runtime_keys;
  
  for (int i = 0; i < state.operation_count; i++) {

    auto rng_val = rng.NextUniform();

    if (rng_val < state.update_ratio) {
      /////////////////////////////////////////////////////////
      // PERFORM UPDATE
      /////////////////////////////////////////////////////////

      // set up parameter values
      std::vector<type::Value > values;

      auto lookup_key = zipf.GetNextNumber();

      values.push_back(type::ValueFactory::GetIntegerValue(lookup_key).Copy());

      auto ycsb_pkey_index = user_table->GetIndexWithOid(user_table_pkey_index_oid);
    
      planner::IndexScanPlan::IndexScanDesc index_scan_desc(
          ycsb_pkey_index, key_column_ids, expr_types, values, runtime_keys);

      // Create plan node.
      auto predicate = nullptr;

      planner::IndexScanPlan index_scan_node(user_table, predicate, column_ids,
                                             index_scan_desc);

      // Run the executor
      executor::IndexScanExecutor index_scan_executor(&index_scan_node,
                                                      context.get());

      TargetList target_list;
      DirectMapList direct_map_list;

      // update multiple attributes
      for (oid_t col_itr = 0; col_itr < column_count; col_itr++) {
        if (col_itr == 1) {
          if (state.string_mode == true) {

            std::string update_raw_value(100, 'a');
            type::Value update_val = type::ValueFactory::GetVarcharValue(update_raw_value).Copy();
            target_list.emplace_back(
                  col_itr, expression::ExpressionUtil::ConstantValueFactory(update_val));             

          } else {

            int update_raw_value = 1;
            type::Value update_val = type::ValueFactory::GetIntegerValue(update_raw_value).Copy();
            target_list.emplace_back(
                  col_itr, expression::ExpressionUtil::ConstantValueFactory(update_val)); 
          }
        }
        else {
          direct_map_list.emplace_back(col_itr,
                                       std::pair<oid_t, oid_t>(0, col_itr));
        }
      }

      std::unique_ptr<const planner::ProjectInfo> project_info(
          new planner::ProjectInfo(std::move(target_list),
                                   std::move(direct_map_list)));
      planner::UpdatePlan update_node(user_table, std::move(project_info));

      executor::UpdateExecutor update_executor(&update_node, context.get());

      update_executor.AddChild(&index_scan_executor);

      ExecuteUpdate(&update_executor);

      if (txn->GetResult() != Result::RESULT_SUCCESS) {
        txn_manager.AbortTransaction(txn);
        return false;
      }

    } else {
      /////////////////////////////////////////////////////////
      // PERFORM READ
      /////////////////////////////////////////////////////////

      // set up parameter values
      std::vector<type::Value > values;

      auto lookup_key = zipf.GetNextNumber();

      values.push_back(type::ValueFactory::GetIntegerValue(lookup_key).Copy());

      auto ycsb_pkey_index = user_table->GetIndexWithOid(user_table_pkey_index_oid);
    
      planner::IndexScanPlan::IndexScanDesc index_scan_desc(
          ycsb_pkey_index, key_column_ids, expr_types, values, runtime_keys);

      // Create plan node.
      auto predicate = nullptr;

      planner::IndexScanPlan index_scan_node(user_table, predicate, column_ids,
                                             index_scan_desc);

      // Run the executor
      executor::IndexScanExecutor index_scan_executor(&index_scan_node,
                                                      context.get());

      
      
      ExecuteRead(&index_scan_executor);

      if (txn->GetResult() != Result::RESULT_SUCCESS) {
        txn_manager.AbortTransaction(txn);
        return false;
      }
    }
  }

  // transaction passed execution.
  PL_ASSERT(txn->GetResult() == Result::RESULT_SUCCESS);

  auto result = txn_manager.CommitTransaction(txn);

  if (result == Result::RESULT_SUCCESS) {
    return true;
    
  } else {
    // transaction failed commitment.
    PL_ASSERT(result == Result::RESULT_ABORTED ||
           result == Result::RESULT_FAILURE);
    return false;
  }
}