@VisibleForTesting
  /**
   * Method converts statement into a file, compiles the file and then packages the file.
   * @param ss
   * @return Response code of 0 for success 1 for failure
   * @throws CompileProcessorException
   */
  CommandProcessorResponse compile(SessionState ss) throws CommandProcessorException {
    String lockout = "rwx------";
    Project proj = new Project();
    String ioTempDir = System.getProperty(IO_TMP_DIR);
    File ioTempFile = new File(ioTempDir);
    if (!ioTempFile.exists()){
      throw new CommandProcessorException(ioTempDir + " does not exists");
    }
    if (!ioTempFile.isDirectory() || !ioTempFile.canWrite()){
      throw new CommandProcessorException(ioTempDir + " is not a writable directory");
    }
    long runStamp = System.currentTimeMillis();
    String user = (ss != null) ? ss.getUserName() : "anonymous";
    File sessionTempFile = new File(ioTempDir, user + "_" + runStamp);
    if (!sessionTempFile.exists()) {
      sessionTempFile.mkdir();
      setPosixFilePermissions(sessionTempFile, lockout, true);
    }
    Groovyc g = new Groovyc();
    String jarId = myId + "_" + runStamp;
    g.setProject(proj);
    Path sourcePath = new Path(proj);
    File destination = new File(sessionTempFile, jarId + "out");
    g.setDestdir(destination);
    File input = new File(sessionTempFile, jarId + "in");
    sourcePath.setLocation(input);
    g.setSrcdir(sourcePath);
    input.mkdir();

    File fileToWrite = new File(input, this.named);
    try {
      Files.write(Paths.get(fileToWrite.toURI()), code.getBytes(Charset.forName("UTF-8")), StandardOpenOption.CREATE_NEW);
    } catch (IOException e1) {
      throw new CommandProcessorException("writing file", e1);
    }
    destination.mkdir();
    try {
      g.execute();
    } catch (BuildException ex){
      throw new CommandProcessorException("Problem compiling", ex);
    }
    File testArchive = new File(sessionTempFile, jarId + ".jar");
    JarArchiveOutputStream out = null;
    try {
      out = new JarArchiveOutputStream(new FileOutputStream(testArchive));
      for (File f: destination.listFiles()){
        JarArchiveEntry jentry = new JarArchiveEntry(f.getName());
        FileInputStream fis = new FileInputStream(f);
        out.putArchiveEntry(jentry);
        IOUtils.copy(fis, out);
        fis.close();
        out.closeArchiveEntry();
      }
      out.finish();
      setPosixFilePermissions(testArchive, lockout, false);
    } catch (IOException e) {
      throw new CommandProcessorException("Exception while writing jar", e);
    } finally {
      if (out!=null){
        try {
          out.close();
        } catch (IOException WhatCanYouDo) { }
        try {
          if (input.exists())
            FileUtils.forceDeleteOnExit(input);
        } catch (IOException WhatCanYouDo) { /* ignore */ }
        try {
          if (destination.exists())
            FileUtils.forceDeleteOnExit(destination);
        } catch (IOException WhatCanYouDo) { /* ignore */ }
        try {
          if (testArchive != null && testArchive.exists())
            testArchive.deleteOnExit();
        } catch (Exception WhatCanYouDo) { /* ignore */ }
      }
    }

    if (ss != null){
      ss.add_resource(ResourceType.JAR, testArchive.getAbsolutePath());
    }
    CommandProcessorResponse good = new CommandProcessorResponse(null, testArchive.getAbsolutePath());
    return good;
  }
Parses the supplied command
@param ss
@throws CompileProcessorException if the code can not be compiled or the jar can not be made
ql/src/java/org/apache/hadoop/hive/ql/processors/CompileProcessor.java