public QFile getQFile(String name) throws IOException {
      QFile result = new QFile();
      result.name = name;
      if (!useSharedDatabase) {
        result.databaseName = "test_db_" + name.toLowerCase();
        result.specificFilterSet = new RegexFilterSet()
            .addFilter("(PREHOOK|POSTHOOK): (Output|Input): database:" + result.databaseName + "\n",
                "$1: $2: database:default\n")
            .addFilter("(PREHOOK|POSTHOOK): (Output|Input): " + result.databaseName + "@",
                "$1: $2: default@")
            .addFilter("name(:?) " + result.databaseName + "\\.(.*)\n", "name$1 default.$2\n")
            .addFilter("alias(:?) " + result.databaseName + "\\.(.*)\n", "alias$1 default.$2\n")
            .addFilter("/" + result.databaseName + ".db/", "/");
      } else {
        result.databaseName = "default";
        result.specificFilterSet = new RegexFilterSet();
      }
      result.inputFile = new File(queryDirectory, name + ".q");
      result.rawOutputFile = new File(logDirectory, name + ".q.out.raw");
      result.outputFile = new File(logDirectory, name + ".q.out");
      result.logFile = new File(logDirectory, name + ".q.beeline");
      result.beforeExecuteLogFile = new File(logDirectory, name + ".q.beforeExecute.log");
      result.afterExecuteLogFile = new File(logDirectory, name + ".q.afterExecute.log");
      result.useSharedDatabase = useSharedDatabase;
      result.converter = Converter.NONE;
      String input = FileUtils.readFileToString(result.inputFile, "UTF-8");
      if (input.contains("-- SORT_QUERY_RESULTS")) {
        result.converter = Converter.SORT_QUERY_RESULTS;
      }
      if (input.contains("-- HASH_QUERY_RESULTS")) {
        result.converter = Converter.HASH_QUERY_RESULTS;
      }
      if (input.contains("-- SORT_AND_HASH_QUERY_RESULTS")) {
        result.converter = Converter.SORT_AND_HASH_QUERY_RESULTS;
      }

      result.comparePortable = comparePortable;
      result.expectedOutputFile = prepareExpectedOutputFile(name, comparePortable);
      return result;
    }
Builder to generate QFile objects. After initializing the builder it is possible the
generate the next QFile object using it's name only.
itests/util/src/main/java/org/apache/hive/beeline/QFile.java