public Table createTable(TestHiveShell shell, String tableName, Schema schema, PartitionSpec spec,
      FileFormat fileFormat, List<Record> records, Integer formatVersion, Map<String, String> tblProperties,
      String storageHandler) {
    TableIdentifier identifier = TableIdentifier.of("default", tableName);
    String tblProps = propertiesForCreateTableSQL(ImmutableMap.<String, String>builder().putAll(tblProperties)
        .put(TableProperties.DEFAULT_FILE_FORMAT, fileFormat.toString())
        .put(InputFormatConfig.TABLE_SCHEMA, SchemaParser.toJson(schema))
        .put(InputFormatConfig.PARTITION_SPEC, PartitionSpecParser.toJson(spec))
        .put(TableProperties.FORMAT_VERSION, Integer.toString(formatVersion))
        .build());
    shell.executeStatement("CREATE EXTERNAL TABLE " + identifier +
        " STORED BY " + storageHandler + " " +
        locationForCreateTableSQL(identifier) + tblProps);

    if (records != null && !records.isEmpty()) {
      String query = getInsertQuery(records, identifier, false);
      shell.executeStatement(query);
    }

    return loadTable(identifier);
  }
Creates a partitioned Hive test table using Hive SQL. The table will be in the 'default' database.
The table will be populated with the provided List of {@link Record}s using a Hive insert statement.
@param shell The HiveShell used for Hive table creation
@param tableName The name of the test table
@param schema The schema used for the table creation
@param spec The partition specification for the table
@param fileFormat The file format used for writing the data
@param records The records with which the table is populated
@param formatVersion The version of the spec the table should use (format-version)
@param tblProperties Additional table properties
@param storageHandler Storage Handler to be used
@return The created table
@throws IOException If there is an error writing data
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestTables.java