Tabnine Logo
MigrateToV2
Code IndexAdd Tabnine to your IDE (free)

How to use
MigrateToV2
in
co.cask.wrangler.parser

Best Java code snippets using co.cask.wrangler.parser.MigrateToV2 (Showing top 5 results out of 315)

origin: co.cask.wrangler/wrangler-core

public static String getNextToken(StringTokenizer tokenizer, String delimiter,
                 String directive, String field, int lineno) throws DirectiveParseException {
 return getNextToken(tokenizer, delimiter, directive, field, lineno, false);
}
origin: co.cask.wrangler/wrangler-core

  String column = getNextToken(tokenizer, "set column", "column-name", lineno);
  String expr = getNextToken(tokenizer, "\n", "set column", "jexl-expression", lineno);
  transformed.add(String.format("set-column %s exp:{%s};", col(column), expr));
  String columns = getNextToken(tokenizer, "\n", "set columns", "name1, name2, ...", lineno);
  String cols[] = columns.split(",");
  transformed.add(String.format("set-headers %s;", toColumArray(cols)));
String oldcol = getNextToken(tokenizer,  command, "old", lineno);
String newcol = getNextToken(tokenizer, command, "new", lineno);
transformed.add(String.format("rename %s %s;", col(oldcol), col(newcol)));
String col = getNextToken(tokenizer,  command, "col", lineno);
String type = getNextToken(tokenizer, command, "type", lineno);
transformed.add(String.format("set-type %s %s;", col(col), type));
String columns = getNextToken(tokenizer, command, "column", lineno);
String cols[] = columns.split(",");
transformed.add(String.format("drop %s;", toColumArray(cols)));
String col1 = getNextToken(tokenizer, command, "first", lineno);
String col2 = getNextToken(tokenizer, command, "second", lineno);
String dest = getNextToken(tokenizer, command, "new-column", lineno);
String delimiter = getNextToken(tokenizer, "\n", command, "delimiter", lineno);
transformed.add(String.format("merge %s %s %s %s;", col(col1), col(col2), col(dest), quote(delimiter)));
String col = getNextToken(tokenizer, command, "col", lineno);
transformed.add(String.format("uppercase %s;", col(col)));
origin: co.cask.re/dre-core

public RecipePipeline compile(List<String> recipe)
 throws RecipeException, DirectiveParseException, DirectiveLoadException, DirectiveNotFoundException {
 // Support only in-built directives.
 CompositeDirectiveRegistry registry = new CompositeDirectiveRegistry(
  new SystemDirectiveRegistry()
 );
 String migrate = new MigrateToV2(recipe).migrate();
 RecipeParser parser = new GrammarBasedParser(migrate, registry);
 parser.initialize(null); // No Directive Context.
 RecipePipeline pipeline = new RecipePipelineExecutor();
 pipeline.initialize(parser, context);
 return pipeline;
}
origin: co.cask.wrangler/wrangler-core

private static String toColumArray(String[] columns) {
 List<String> array = new ArrayList<>();
 for (String column : columns) {
  array.add(col(trim(column)));
 }
 return Joiner.on(",").join(array);
}
origin: co.cask.wrangler/wrangler-core

public static String getNextToken(StringTokenizer tokenizer, String directive,
                 String field, int lineno) throws DirectiveParseException {
 return getNextToken(tokenizer, null, directive, field, lineno, false);
}
co.cask.wrangler.parserMigrateToV2

Javadoc

This class MigrateToV2 translates from older version of grammar of directives into newer version of recipe grammar.

Following are the conversions that are performed :

  • Convert column name from 'name' to ':name'.
  • Text are quoted with with single or double quote.
  • Expression or conditions are represented 'exp:{}'
  • All directives are terminated by semicolo (;)

Most used methods

  • <init>
  • col
  • getNextToken
  • migrate
    Rewrites the directives in version 1.0 to version 2.0.
  • quote
  • toColumArray

Popular in Java

  • Making http requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JFrame (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now