code: def test_meta_schedule_database_union():
      mod: IRModule = Matmul
      target = tvm.target.Target("llvm")
      arg_info = ms.arg_info.ArgInfo.from_prim_func(func=mod["main"])
      db_1 = ms.database.MemoryDatabase()
      db_2 = ms.database.MemoryDatabase()
      trace = _create_schedule(mod, _schedule_matmul).trace
  
      def query(db):  # pylint: disable=invalid-name
          return db.query_tuning_record(
              mod=mod, target=target, workload_name="main"
          ).run_secs
  
      def commit_record(db, run_sec):  # pylint: disable=invalid-name
          db.commit_tuning_record(
              ms.database.TuningRecord(
                  trace,
                  workload=db.commit_workload(mod),
                  run_secs=[run_sec],
                  target=target,
                  args_info=arg_info,
              )
          )
  
      commit_record(db_1, 1.0)
      (run_sec,) = query(db_1)
      assert run_sec.value == 1.0
  
      commit_record(db_2, 0.5)
      (run_sec,) = query(db_2)
      assert run_sec.value == 0.5
  
      (run_secs,) = query(ms.database.UnionDatabase(db_1, db_2))
      assert run_secs.value == 0.5
  
      (run_secs,) = query(ms.database.OrderedUnionDatabase(db_1, db_2))
      assert run_secs.value == 1.0
  
imports: import os.path
  import tempfile
  from typing import Callable, List, Optional
  import pytest
  import tvm
  import tvm.testing
  from tvm import meta_schedule
  from tvm import relay, tir
  from tvm.ir.module import IRModule
  from tvm.meta_schedule.database import TuningRecord, Workload
  from tvm.script import tir
  from tvm.target import Target
  from tvm.tir import Schedule
label_desc: Use image node_id 12 for calling a global function with example usage: test_meta_schedule_database_union() and returns: db