Tabnine Logo
UserCodeWrapper.getUserCodeClass
Code IndexAdd Tabnine to your IDE (free)

How to use
getUserCodeClass
method
in
org.apache.flink.api.common.operators.util.UserCodeWrapper

Best Java code snippets using org.apache.flink.api.common.operators.util.UserCodeWrapper.getUserCodeClass (Showing top 20 results out of 315)

origin: apache/flink

/**
 * Marks the group reduce operation as combinable. Combinable operations may pre-reduce the
 * data before the actual group reduce operations. Combinable user-defined functions
 * must implement the interface {@link GroupCombineFunction}.
 * 
 * @param combinable Flag to mark the group reduce operation as combinable.
 */
public void setCombinable(boolean combinable) {
  // sanity check
  if (combinable && !GroupCombineFunction.class.isAssignableFrom(this.userFunction.getUserCodeClass())) {
    throw new IllegalArgumentException("Cannot set a UDF as combinable if it does not implement the interface " +
        GroupCombineFunction.class.getName());
  } else {
    this.combinable = combinable;
  }
}

origin: apache/flink

private String getDescriptionForUserCode(UserCodeWrapper<?> wrapper) {
  try {
    if (wrapper.hasObject()) {
      try {
        return wrapper.getUserCodeObject().toString();
      }
      catch (Throwable t) {
        return wrapper.getUserCodeClass().getName();
      }
    }
    else {
      return wrapper.getUserCodeClass().getName();
    }
  }
  catch (Throwable t) {
    return null;
  }
}

origin: apache/flink

super(pactContract);
if (pactContract.getUserCodeWrapper().getUserCodeClass() == null) {
  throw new IllegalArgumentException("Input format has not been set.");
if (NonParallelInput.class.isAssignableFrom(pactContract.getUserCodeWrapper().getUserCodeClass())) {
  setParallelism(1);
  this.sequentialInput = true;
                        pactContract.getUserCodeWrapper().getUserCodeClass());
origin: apache/flink

private <OUT> List<OUT> executeDataSource(GenericDataSourceBase<?, ?> source, int superStep)
    throws Exception {
  @SuppressWarnings("unchecked")
  GenericDataSourceBase<OUT, ?> typedSource = (GenericDataSourceBase<OUT, ?>) source;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSource.getName(), 1, 0, 1, 0);
  
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichInputFormat.class.isAssignableFrom(typedSource.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
  } else {
    ctx = null;
  }
  return typedSource.executeOnCollections(ctx, executionConfig);
}

origin: apache/flink

private <IN, OUT> List<OUT> executeUnaryOperator(SingleInputOperator<?, ?, ?> operator, int superStep) throws Exception {
  Operator<?> inputOp = operator.getInput();
  if (inputOp == null) {
    throw new InvalidProgramException("The unary operation " + operator.getName() + " has no input.");
  }
  
  @SuppressWarnings("unchecked")
  List<IN> inputData = (List<IN>) execute(inputOp, superStep);
  
  @SuppressWarnings("unchecked")
  SingleInputOperator<IN, OUT, ?> typedOp = (SingleInputOperator<IN, OUT, ?>) operator;
  
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedOp.getName(), 1, 0, 1, 0);
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichFunction.class.isAssignableFrom(typedOp.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
    
    for (Map.Entry<String, Operator<?>> bcInputs : operator.getBroadcastInputs().entrySet()) {
      List<?> bcData = execute(bcInputs.getValue());
      ctx.setBroadcastVariable(bcInputs.getKey(), bcData);
    }
  } else {
    ctx = null;
  }
  return typedOp.executeOnCollections(inputData, ctx, executionConfig);
}

origin: apache/flink

if (FileInputFormat.class.isAssignableFrom(getOperator().getFormatWrapper().getUserCodeClass()) &&
    this.estimatedOutputSize >= 0) {
  estimator.addFileInputCost(this.estimatedOutputSize, costs);
origin: apache/flink

private <IN> void executeDataSink(GenericDataSinkBase<?> sink, int superStep) throws Exception {
  Operator<?> inputOp = sink.getInput();
  if (inputOp == null) {
    throw new InvalidProgramException("The data sink " + sink.getName() + " has no input.");
  }
  
  @SuppressWarnings("unchecked")
  List<IN> input = (List<IN>) execute(inputOp);
  
  @SuppressWarnings("unchecked")
  GenericDataSinkBase<IN> typedSink = (GenericDataSinkBase<IN>) sink;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSink.getName(), 1, 0, 1, 0);
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
    
  if (RichOutputFormat.class.isAssignableFrom(typedSink.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
  } else {
    ctx = null;
  }
  typedSink.executeOnCollections(input, ctx, executionConfig);
}

origin: apache/flink

if (RichFunction.class.isAssignableFrom(typedOp.getUserCodeWrapper().getUserCodeClass())) {
  ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
    new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
origin: apache/flink

MapOperatorBase<?, ?, ?> worksetMapper = (MapOperatorBase<?, ?, ?>) worksetSelfJoin.getFirstInput();
assertEquals(IdentityMapper.class, worksetMapper.getUserCodeWrapper().getUserCodeClass());
assertEquals(NextWorksetMapper.class, nextWorksetMapper.getUserCodeWrapper().getUserCodeClass());
if (solutionSetJoin.getUserCodeWrapper().getUserCodeObject() instanceof WrappingFunction) {
  WrappingFunction<?> wf = (WrappingFunction<?>) solutionSetJoin.getUserCodeWrapper().getUserCodeObject();
  assertEquals(SolutionWorksetJoin.class, solutionSetJoin.getUserCodeWrapper().getUserCodeClass());
origin: apache/flink

assertEquals(KeyExtractingMapper.class, keyExtractor.getUserCodeWrapper().getUserCodeClass());
origin: apache/flink

assertEquals(KeyExtractingMapper.class, keyExtractor.getUserCodeWrapper().getUserCodeClass());
origin: org.apache.flink/flink-core

/**
 * Marks the group reduce operation as combinable. Combinable operations may pre-reduce the
 * data before the actual group reduce operations. Combinable user-defined functions
 * must implement the interface {@link GroupCombineFunction}.
 * 
 * @param combinable Flag to mark the group reduce operation as combinable.
 */
public void setCombinable(boolean combinable) {
  // sanity check
  if (combinable && !GroupCombineFunction.class.isAssignableFrom(this.userFunction.getUserCodeClass())) {
    throw new IllegalArgumentException("Cannot set a UDF as combinable if it does not implement the interface " +
        GroupCombineFunction.class.getName());
  } else {
    this.combinable = combinable;
  }
}

origin: com.alibaba.blink/flink-core

/**
 * Marks the group reduce operation as combinable. Combinable operations may pre-reduce the
 * data before the actual group reduce operations. Combinable user-defined functions
 * must implement the interface {@link GroupCombineFunction}.
 * 
 * @param combinable Flag to mark the group reduce operation as combinable.
 */
public void setCombinable(boolean combinable) {
  // sanity check
  if (combinable && !GroupCombineFunction.class.isAssignableFrom(this.userFunction.getUserCodeClass())) {
    throw new IllegalArgumentException("Cannot set a UDF as combinable if it does not implement the interface " +
        GroupCombineFunction.class.getName());
  } else {
    this.combinable = combinable;
  }
}

origin: org.apache.flink/flink-optimizer_2.11

private String getDescriptionForUserCode(UserCodeWrapper<?> wrapper) {
  try {
    if (wrapper.hasObject()) {
      try {
        return wrapper.getUserCodeObject().toString();
      }
      catch (Throwable t) {
        return wrapper.getUserCodeClass().getName();
      }
    }
    else {
      return wrapper.getUserCodeClass().getName();
    }
  }
  catch (Throwable t) {
    return null;
  }
}

origin: org.apache.flink/flink-optimizer_2.10

private String getDescriptionForUserCode(UserCodeWrapper<?> wrapper) {
  try {
    if (wrapper.hasObject()) {
      try {
        return wrapper.getUserCodeObject().toString();
      }
      catch (Throwable t) {
        return wrapper.getUserCodeClass().getName();
      }
    }
    else {
      return wrapper.getUserCodeClass().getName();
    }
  }
  catch (Throwable t) {
    return null;
  }
}

origin: org.apache.flink/flink-optimizer

private String getDescriptionForUserCode(UserCodeWrapper<?> wrapper) {
  try {
    if (wrapper.hasObject()) {
      try {
        return wrapper.getUserCodeObject().toString();
      }
      catch (Throwable t) {
        return wrapper.getUserCodeClass().getName();
      }
    }
    else {
      return wrapper.getUserCodeClass().getName();
    }
  }
  catch (Throwable t) {
    return null;
  }
}

origin: com.alibaba.blink/flink-optimizer

private String getDescriptionForUserCode(UserCodeWrapper<?> wrapper) {
  try {
    if (wrapper.hasObject()) {
      try {
        return wrapper.getUserCodeObject().toString();
      }
      catch (Throwable t) {
        return wrapper.getUserCodeClass().getName();
      }
    }
    else {
      return wrapper.getUserCodeClass().getName();
    }
  }
  catch (Throwable t) {
    return null;
  }
}

origin: com.alibaba.blink/flink-core

private <OUT> List<OUT> executeDataSource(GenericDataSourceBase<?, ?> source, int superStep)
    throws Exception {
  @SuppressWarnings("unchecked")
  GenericDataSourceBase<OUT, ?> typedSource = (GenericDataSourceBase<OUT, ?>) source;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSource.getName(), 1, 0, 1, 0);
  
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichInputFormat.class.isAssignableFrom(typedSource.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, classLoader, executionConfig, cachedFiles, accumulatorRegistry, metrics) :
        new IterationRuntimeUDFContext(taskInfo, classLoader, executionConfig, cachedFiles, accumulatorRegistry, metrics);
  } else {
    ctx = null;
  }
  return typedSource.executeOnCollections(ctx, executionConfig);
}

origin: org.apache.flink/flink-core

private <OUT> List<OUT> executeDataSource(GenericDataSourceBase<?, ?> source, int superStep)
    throws Exception {
  @SuppressWarnings("unchecked")
  GenericDataSourceBase<OUT, ?> typedSource = (GenericDataSourceBase<OUT, ?>) source;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSource.getName(), 1, 0, 1, 0);
  
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
  if (RichInputFormat.class.isAssignableFrom(typedSource.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
  } else {
    ctx = null;
  }
  return typedSource.executeOnCollections(ctx, executionConfig);
}

origin: org.apache.flink/flink-core

private <IN> void executeDataSink(GenericDataSinkBase<?> sink, int superStep) throws Exception {
  Operator<?> inputOp = sink.getInput();
  if (inputOp == null) {
    throw new InvalidProgramException("The data sink " + sink.getName() + " has no input.");
  }
  
  @SuppressWarnings("unchecked")
  List<IN> input = (List<IN>) execute(inputOp);
  
  @SuppressWarnings("unchecked")
  GenericDataSinkBase<IN> typedSink = (GenericDataSinkBase<IN>) sink;
  // build the runtime context and compute broadcast variables, if necessary
  TaskInfo taskInfo = new TaskInfo(typedSink.getName(), 1, 0, 1, 0);
  RuntimeUDFContext ctx;
  MetricGroup metrics = new UnregisteredMetricsGroup();
    
  if (RichOutputFormat.class.isAssignableFrom(typedSink.getUserCodeWrapper().getUserCodeClass())) {
    ctx = superStep == 0 ? new RuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics) :
        new IterationRuntimeUDFContext(taskInfo, userCodeClassLoader, executionConfig, cachedFiles, accumulators, metrics);
  } else {
    ctx = null;
  }
  typedSink.executeOnCollections(input, ctx, executionConfig);
}

org.apache.flink.api.common.operators.utilUserCodeWrappergetUserCodeClass

Javadoc

Gets the class of the user code. If the user code is provided as a class, this class is just returned. If the user code is provided as an object, Object#getClass() is called on the user code object.

Popular methods of UserCodeWrapper

  • getUserCodeObject
    Gets the user code object, which may be either a function or an input or output format. The subclass
  • hasObject
    Checks whether the wrapper already has an object, or whether it needs to instantiate it.

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • Kernel (java.awt.image)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JTextField (javax.swing)
  • Best IntelliJ plugins
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