本文整理了Java中org.apache.flink.configuration.Configuration.setBytes()
方法的一些代码示例,展示了Configuration.setBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setBytes()
方法的具体详情如下:
包路径:org.apache.flink.configuration.Configuration
类名称:Configuration
方法名:setBytes
[英]Adds the given byte array to the configuration object. If key is null
then nothing is added.
[中]将给定的字节数组添加到配置对象。如果键为null
,则不添加任何内容。
代码示例来源:origin: apache/flink
@Override
public void setBytes(final String key, final byte[] bytes) {
this.backingConfig.setBytes(this.prefix + key, bytes);
}
代码示例来源:origin: apache/flink
public static void writeObjectToConfig(Object o, Configuration config, String key) throws IOException {
byte[] bytes = serializeObject(o);
config.setBytes(key, bytes);
}
代码示例来源:origin: apache/flink
public void setOperatorID(OperatorID operatorID) {
this.config.setBytes(OPERATOR_ID, operatorID.getBytes());
}
代码示例来源:origin: apache/flink
public static void writeFileInfoToConfig(String name, DistributedCacheEntry e, Configuration conf) {
int num = conf.getInteger(CACHE_FILE_NUM, 0) + 1;
conf.setInteger(CACHE_FILE_NUM, num);
conf.setString(CACHE_FILE_NAME + num, name);
conf.setString(CACHE_FILE_PATH + num, e.filePath);
conf.setBoolean(CACHE_FILE_EXE + num, e.isExecutable || new File(e.filePath).canExecute());
conf.setBoolean(CACHE_FILE_DIR + num, e.isZipped || new File(e.filePath).isDirectory());
if (e.blobKey != null) {
conf.setBytes(CACHE_FILE_BLOB_KEY + num, e.blobKey);
}
}
代码示例来源:origin: apache/flink
orig.setDouble("E", Math.E);
orig.setBoolean("shouldbetrue", true);
orig.setBytes("bytes sequence", new byte[] { 1, 2, 3, 4, 5 });
orig.setClass("myclass", this.getClass());
代码示例来源:origin: org.apache.flink/flink-core
@Override
public void setBytes(final String key, final byte[] bytes) {
this.backingConfig.setBytes(this.prefix + key, bytes);
}
代码示例来源:origin: com.alibaba.blink/flink-core
@Override
public void setBytes(final String key, final byte[] bytes) {
this.backingConfig.setBytes(this.prefix + key, bytes);
}
代码示例来源:origin: org.apache.flink/flink-core
public static void writeObjectToConfig(Object o, Configuration config, String key) throws IOException {
byte[] bytes = serializeObject(o);
config.setBytes(key, bytes);
}
代码示例来源:origin: com.alibaba.blink/flink-core
public static void writeObjectToConfig(Object o, Configuration config, String key) throws IOException {
byte[] bytes = serializeObject(o);
config.setBytes(key, bytes);
}
代码示例来源:origin: org.apache.flink/flink-streaming-java
public void setOperatorID(OperatorID operatorID) {
this.config.setBytes(OPERATOR_ID, operatorID.getBytes());
}
代码示例来源:origin: org.apache.flink/flink-streaming-java_2.11
public void setOperatorID(OperatorID operatorID) {
this.config.setBytes(OPERATOR_ID, operatorID.getBytes());
}
代码示例来源:origin: com.alibaba.blink/flink-runtime
public void setOutputDataDistribution(DataDistribution distribution, int outputNum) {
this.config.setString(OUTPUT_DATA_DISTRIBUTION_CLASS, distribution.getClass().getName());
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputViewStreamWrapper out = new DataOutputViewStreamWrapper(baos)) {
distribution.write(out);
config.setBytes(OUTPUT_DATA_DISTRIBUTION_PREFIX + outputNum, baos.toByteArray());
}
catch (IOException e) {
throw new RuntimeException("Error serializing the DataDistribution: " + e.getMessage(), e);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
public void setOutputDataDistribution(DataDistribution distribution, int outputNum) {
this.config.setString(OUTPUT_DATA_DISTRIBUTION_CLASS, distribution.getClass().getName());
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputViewStreamWrapper out = new DataOutputViewStreamWrapper(baos)) {
distribution.write(out);
config.setBytes(OUTPUT_DATA_DISTRIBUTION_PREFIX + outputNum, baos.toByteArray());
}
catch (IOException e) {
throw new RuntimeException("Error serializing the DataDistribution: " + e.getMessage(), e);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.11
public void setOutputDataDistribution(DataDistribution distribution, int outputNum) {
this.config.setString(OUTPUT_DATA_DISTRIBUTION_CLASS, distribution.getClass().getName());
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputViewStreamWrapper out = new DataOutputViewStreamWrapper(baos)) {
distribution.write(out);
config.setBytes(OUTPUT_DATA_DISTRIBUTION_PREFIX + outputNum, baos.toByteArray());
}
catch (IOException e) {
throw new RuntimeException("Error serializing the DataDistribution: " + e.getMessage(), e);
}
}
代码示例来源:origin: org.apache.flink/flink-runtime_2.10
public void setOutputDataDistribution(DataDistribution distribution, int outputNum) {
this.config.setString(OUTPUT_DATA_DISTRIBUTION_CLASS, distribution.getClass().getName());
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputViewStreamWrapper out = new DataOutputViewStreamWrapper(baos)) {
distribution.write(out);
config.setBytes(OUTPUT_DATA_DISTRIBUTION_PREFIX + outputNum, baos.toByteArray());
}
catch (IOException e) {
throw new RuntimeException("Error serializing the DataDistribution: " + e.getMessage(), e);
}
}
代码示例来源:origin: org.apache.flink/flink-core
public static void writeFileInfoToConfig(String name, DistributedCacheEntry e, Configuration conf) {
int num = conf.getInteger(CACHE_FILE_NUM, 0) + 1;
conf.setInteger(CACHE_FILE_NUM, num);
conf.setString(CACHE_FILE_NAME + num, name);
conf.setString(CACHE_FILE_PATH + num, e.filePath);
conf.setBoolean(CACHE_FILE_EXE + num, e.isExecutable || new File(e.filePath).canExecute());
conf.setBoolean(CACHE_FILE_DIR + num, e.isZipped || new File(e.filePath).isDirectory());
if (e.blobKey != null) {
conf.setBytes(CACHE_FILE_BLOB_KEY + num, e.blobKey);
}
}
代码示例来源:origin: com.alibaba.blink/flink-core
public static void writeFileInfoToConfig(String name, DistributedCacheEntry e, Configuration conf) {
int num = conf.getInteger(CACHE_FILE_NUM,0) + 1;
conf.setInteger(CACHE_FILE_NUM, num);
conf.setString(CACHE_FILE_NAME + num, name);
conf.setString(CACHE_FILE_PATH + num, e.filePath);
conf.setBoolean(CACHE_FILE_EXE + num, e.isExecutable || new File(e.filePath).canExecute());
conf.setBoolean(CACHE_FILE_DIR + num, e.isZipped || new File(e.filePath).isDirectory());
if (e.blobKey != null) {
conf.setBytes(CACHE_FILE_BLOB_KEY + num, e.blobKey);
}
}
代码示例来源:origin: amidst/toolbox
public static <T extends DataInstance> DataSet<DataOnMemory<T>> toBatches(DataFlink<T> data, int batchSize){
try{
Configuration config = new Configuration();
config.setInteger(BATCH_SIZE, batchSize);
config.setBytes(ATTRIBUTES, Serialization.serializeObject(data.getAttributes()));
return data.getDataSet().mapPartition(new DataBatch<T>()).withParameters(config);
}catch(Exception ex){
throw new UndeclaredThrowableException(ex);
}
}
代码示例来源:origin: amidst/toolbox
public static <T extends DataInstance> DataSet<DataOnMemory<T>> toBatchesBySeqID(DataFlink<T> data, int batchSize){
try{
Configuration config = new Configuration();
config.setInteger(BATCH_SIZE, batchSize);
config.setBytes(ATTRIBUTES, Serialization.serializeObject(data.getAttributes()));
return data.getDataSet().mapPartition(new DataBatchBySeqID<T>()).withParameters(config);
}catch(Exception ex){
throw new UndeclaredThrowableException(ex);
}
}
代码示例来源:origin: amidst/toolbox
public DataSet<DataPosterior> computePosterior(DataFlink<DataInstance> dataFlink){
Attribute seq_id = dataFlink.getAttributes().getSeq_id();
if (seq_id==null)
throw new IllegalArgumentException("Functionality only available for data sets with a seq_id attribute");
try{
Configuration config = new Configuration();
config.setString(ParameterLearningAlgorithm.BN_NAME, this.getName());
config.setBytes(SVB, Serialization.serializeObject(svb));
return dataFlink
.getBatchedDataSet(this.batchSize,batchConverter)
.flatMap(new ParallelVBMapInference())
.withParameters(config);
}catch(Exception ex){
throw new UndeclaredThrowableException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!