<commit_before>package com.inmobi.grill.examples;

import java.io.IOException;

import javax.xml.bind.JAXBException;

import com.inmobi.grill.api.APIResult;
import com.inmobi.grill.api.metastore.XPartition;
import com.inmobi.grill.client.GrillConnection;
import com.inmobi.grill.client.GrillConnectionParams;
import com.inmobi.grill.client.GrillMetadataClient;

public class PopulateSampleMetastore {

  private GrillConnection connection;
  private GrillMetadataClient metaClient;
  private APIResult result;
  private int retCode = 0;

  public PopulateSampleMetastore() throws JAXBException {
    connection = new GrillConnection(new GrillConnectionParams());
    connection.open();
    metaClient = new GrillMetadataClient(connection);
  }

  public void close() {
    connection.close();
  }

  public static void main(String[] args) throws Exception {
    PopulateSampleMetastore populate = null;
    try {
      populate = new PopulateSampleMetastore();
      if (args.length > 0) {
        if (args[0].equals("-db")) {
          String dbName = args[1];
          populate.metaClient.createDatabase(dbName, true);
          populate.metaClient.setDatabase(dbName);
        }
      }
      populate.populateAll();
    } finally {
      if (populate != null) {
        populate.close();
      }

    }
  }

  public void populateAll() throws JAXBException, IOException {
    populateDimTables();
  }

  public void populateDimTables() throws JAXBException, IOException {
    XPartition partition = (XPartition)SampleMetastore.readFromXML("dim1-local-part.xml");
    String partLocation = partition.getLocation();
    if (!partLocation.startsWith("/")) {
      partition.setLocation(System.getProperty("grill.home") + "/" + partLocation);
    }
    result = metaClient.addPartitionToDimension("dim_table", "local", partition);
    if (result.getStatus().equals(APIResult.Status.FAILED)) {
      System.out.println("Adding partition from:dim1-local-part.xml failed");
      retCode = 1;
    } else {
      System.out.println("Added partition from:dim1-local-part.xml");
    }
    partition = (XPartition)SampleMetastore.readFromXML("dim2-local-part.xml");
    partLocation = partition.getLocation();
    if (!partLocation.startsWith("/")) {
      partition.setLocation(System.getProperty("grill.home") + "/" + partLocation);
    }
    result = metaClient.addPartitionToDimension("dim_table2", "local", partition);
    if (result.getStatus().equals(APIResult.Status.FAILED)) {
      System.out.println("Adding partition from:dim1-local-part.xml failed");
      retCode = 1;
    } else {
      System.out.println("Added partition from:dim1-local-part.xml");
    }
  }
}
<commit_msg>Fix output message for adding partition<commit_after>package com.inmobi.grill.examples;

import java.io.IOException;

import javax.xml.bind.JAXBException;

import com.inmobi.grill.api.APIResult;
import com.inmobi.grill.api.metastore.XPartition;
import com.inmobi.grill.client.GrillConnection;
import com.inmobi.grill.client.GrillConnectionParams;
import com.inmobi.grill.client.GrillMetadataClient;

public class PopulateSampleMetastore {

  private GrillConnection connection;
  private GrillMetadataClient metaClient;
  private APIResult result;
  private int retCode = 0;

  public PopulateSampleMetastore() throws JAXBException {
    connection = new GrillConnection(new GrillConnectionParams());
    connection.open();
    metaClient = new GrillMetadataClient(connection);
  }

  public void close() {
    connection.close();
  }

  public static void main(String[] args) throws Exception {
    PopulateSampleMetastore populate = null;
    try {
      populate = new PopulateSampleMetastore();
      if (args.length > 0) {
        if (args[0].equals("-db")) {
          String dbName = args[1];
          populate.metaClient.createDatabase(dbName, true);
          populate.metaClient.setDatabase(dbName);
        }
      }
      populate.populateAll();
    } finally {
      if (populate != null) {
        populate.close();
      }

    }
  }

  public void populateAll() throws JAXBException, IOException {
    populateDimTables();
  }

  public void populateDimTables() throws JAXBException, IOException {
    XPartition partition = (XPartition)SampleMetastore.readFromXML("dim1-local-part.xml");
    String partLocation = partition.getLocation();
    if (!partLocation.startsWith("/")) {
      partition.setLocation(System.getProperty("grill.home") + "/" + partLocation);
    }
    result = metaClient.addPartitionToDimension("dim_table", "local", partition);
    if (result.getStatus().equals(APIResult.Status.FAILED)) {
      System.out.println("Adding partition from:dim1-local-part.xml failed");
      retCode = 1;
    } else {
      System.out.println("Added partition from:dim1-local-part.xml");
    }
    partition = (XPartition)SampleMetastore.readFromXML("dim2-local-part.xml");
    partLocation = partition.getLocation();
    if (!partLocation.startsWith("/")) {
      partition.setLocation(System.getProperty("grill.home") + "/" + partLocation);
    }
    result = metaClient.addPartitionToDimension("dim_table2", "local", partition);
    if (result.getStatus().equals(APIResult.Status.FAILED)) {
      System.out.println("Adding partition from:dim2-local-part.xml failed");
      retCode = 1;
    } else {
      System.out.println("Added partition from:dim2-local-part.xml");
    }
  }
}

{'fraction_non_alphanumeric': 0.12347052280311457, 'fraction_numerical': 0.00482017055988135, 'mean_word_length': 3.732456140350877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5047493', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1613, 'n_words': 289}