热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.pig.impl.util.ObjectSerializer.serialize()方法的使用及代码示例

本文整理了Java中org.apache.pig.impl.util.ObjectSerializer.serialize()方法的一些代码示例,展示了ObjectSerializer.seriali

本文整理了Java中org.apache.pig.impl.util.ObjectSerializer.serialize()方法的一些代码示例,展示了ObjectSerializer.serialize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectSerializer.serialize()方法的具体详情如下:
包路径:org.apache.pig.impl.util.ObjectSerializer
类名称:ObjectSerializer
方法名:serialize

ObjectSerializer.serialize介绍

暂无

代码示例

代码示例来源:origin: apache/hive

@Override
public void checkSchema(ResourceSchema resourceSchema) throws IOException {
/* Schema provided by user and the schema computed by Pig
* at the time of calling store must match.
*/
Schema runtimeSchema = Schema.getPigSchema(resourceSchema);
if (pigSchema != null) {
if (!Schema.equals(runtimeSchema, pigSchema, false, true)) {
throw new FrontendException("Schema provided in store statement doesn't match with the Schema" +
"returned by Pig run-time. Schema provided in HCatStorer: " + pigSchema.toString() + " Schema received from Pig runtime: " + runtimeSchema.toString(), PigHCatUtil.PIG_EXCEPTION_CODE);
}
} else {
pigSchema = runtimeSchema;
}
UDFContext.getUDFContext().getUDFProperties(this.getClass(), new String[]{sign}).setProperty(PIG_SCHEMA, ObjectSerializer.serialize(pigSchema));
}

代码示例来源:origin: apache/hive

udfProps.setProperty(COMPUTED_OUTPUT_SCHEMA, ObjectSerializer.serialize(computedSchema));

代码示例来源:origin: apache/phoenix

@Override
public void checkSchema(ResourceSchema s) throws IOException {
schema = s;
getUDFProperties().setProperty(contextSignature + SCHEMA, ObjectSerializer.serialize(schema));
}
}

代码示例来源:origin: forcedotcom/phoenix

@Override
public void checkSchema(ResourceSchema s) throws IOException {
schema = s;
getUDFProperties().setProperty(contextSignature + SCHEMA, ObjectSerializer.serialize(schema));
}

代码示例来源:origin: apache/phoenix

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
if(schema != null) {
return schema;
}
PhoenixConfigurationUtil.loadHBaseConfiguration(job);
final Configuration cOnfiguration= job.getConfiguration();
this.initializePhoenixPigConfiguration(location, configuration);
this.schema = PhoenixPigSchemaUtil.getResourceSchema(this.config);
if(LOG.isDebugEnabled()) {
LOG.debug(String.format("Resource Schema generated for location [%s] is [%s]", location, schema.toString()));
}
this.storeInUDFContext(this.contextSignature, RESOURCE_SCHEMA_SIGNATURE, ObjectSerializer.serialize(schema));
return schema;
}

代码示例来源:origin: ShifuML/shifu

static String serializeRequiredFieldList(RequiredFieldList requiredFieldList) {
try {
return ObjectSerializer.serialize(requiredFieldList);
} catch (IOException e) {
throw new RuntimeException("Failed to searlize required fields.", e);
}
}

代码示例来源:origin: org.apache.pig/pig

public String serialize() {
try {
return ObjectSerializer.serialize(udfConfs);
} catch (IOException e) {
LOG.error("UDFContext#serialize throws error ",e);
return null;
}
}

代码示例来源:origin: org.apache.pig/pig

/**
* Serialize the UDF specific information into an instance
* of JobConf. This function is intended to be called on
* the front end in preparation for sending the data to the
* backend.
* @param conf JobConf to serialize into
* @throws IOException if underlying serialization throws it
*/
public void serialize(Configuration conf) throws IOException {
conf.set(UDF_CONTEXT, ObjectSerializer.serialize(udfConfs));
conf.set(CLIENT_SYS_PROPS, ObjectSerializer.serialize(clientSysProps));
}

代码示例来源:origin: com.twitter/parquet-pig

static String serializeRequiredFieldList(RequiredFieldList requiredFieldList) {
try {
return ObjectSerializer.serialize(requiredFieldList);
} catch (IOException e) {
throw new RuntimeException("Failed to searlize required fields.", e);
}
}

代码示例来源:origin: org.apache.pig/pig

@Override
public void checkSchema(ResourceSchema s) throws IOException {
if (!(caster instanceof LoadStoreCaster)) {
log.error("Caster must implement LoadStoreCaster for writing to Accumulo.");
throw new IOException("Bad Caster " + caster.getClass());
}
schema = s;
getUDFProperties().setProperty(contextSignature + "_schema",
ObjectSerializer.serialize(schema));
}

代码示例来源:origin: org.apache.pig/pig

@Override
public void prepare() {
String s;
try {
s = ObjectSerializer.serialize(schema);
} catch (IOException e) {
throw new RuntimeException("Unable to serialize schema: " + schema, e);
}
add("private static Schema schema = staticSchemaGen(\"" + s + "\");");
}

代码示例来源:origin: org.apache.pig/pig

@Override
public void checkSchema(ResourceSchema s) throws IOException {
if (! (caster_ instanceof LoadStoreCaster)) {
LOG.error("Caster must implement LoadStoreCaster for writing to HBase.");
throw new IOException("Bad Caster " + caster_.getClass());
}
schema_ = s;
getUDFProperties().setProperty(contextSignature + "_schema",
ObjectSerializer.serialize(schema_));
}

代码示例来源:origin: org.apache.pig/pig

public void setScript(String script) throws IOException {
if (script == null)
return;
//Retain the truncated script
setTruncatedScript(script);
//Serialize and encode the string.
this.serializedScript = ObjectSerializer.serialize(script);
}

代码示例来源:origin: org.apache.phoenix/phoenix-pig

@Override
public void checkSchema(ResourceSchema s) throws IOException {
schema = s;
getUDFProperties().setProperty(contextSignature + SCHEMA, ObjectSerializer.serialize(schema));
}
}

代码示例来源:origin: org.apache.pig/pig

private String getSerializedTezPlan() throws IOException {
if (serializedTezPlan == null) {
// Initialize lazy instead of constructor as this might not be needed
serializedTezPlan = ObjectSerializer.serialize(getPlan());
}
return serializedTezPlan;
}

代码示例来源:origin: org.apache.pig/pig

private TypeInfo getTypeInfo(String location, Job job) throws IOException {
Properties p = UDFContext.getUDFContext().getUDFProperties(this.getClass());
TypeInfo typeInfo = (TypeInfo) ObjectSerializer.deserialize(p.getProperty(signature + SchemaSignatureSuffix));
if (typeInfo == null) {
typeInfo = getTypeInfoFromLocation(location, job);
}
if (typeInfo != null) {
p.setProperty(signature + SchemaSignatureSuffix, ObjectSerializer.serialize(typeInfo));
}
return typeInfo;
}

代码示例来源:origin: org.apache.phoenix/phoenix-pig

@Override
public ResourceSchema getSchema(String location, Job job) throws IOException {
if(schema != null) {
return schema;
}
PhoenixConfigurationUtil.loadHBaseConfiguration(job);
final Configuration cOnfiguration= job.getConfiguration();
this.initializePhoenixPigConfiguration(location, configuration);
this.schema = PhoenixPigSchemaUtil.getResourceSchema(this.config);
if(LOG.isDebugEnabled()) {
LOG.debug(String.format("Resource Schema generated for location [%s] is [%s]", location, schema.toString()));
}
this.storeInUDFContext(this.contextSignature, RESOURCE_SCHEMA_SIGNATURE, ObjectSerializer.serialize(schema));
return schema;
}

代码示例来源:origin: org.apache.pig/pig

/**
* Stores the requiredFieldsList as a serialized object so it can be fetched on the cluster. If
* you plan to overwrite pushProjection, you need to call this with the requiredFieldList so it
* they can be accessed on the cluster.
*/
protected void storeProjectedFieldNames(RequiredFieldList requiredFieldList) throws FrontendException {
try {
getUDFProperties().setProperty(projectedFieldsName(),
ObjectSerializer.serialize(requiredFieldList));
} catch (IOException e) {
throw new FrontendException(e);
}
}

代码示例来源:origin: org.apache.pig/pig

@Override
public void checkSchema(ResourceSchema rs) throws IOException {
ResourceFieldSchema fs = new ResourceFieldSchema();
fs.setType(DataType.TUPLE);
fs.setSchema(rs);
typeInfo = HiveUtils.getTypeInfo(fs);
Properties p = UDFContext.getUDFContext().getUDFProperties(this.getClass());
p.setProperty(signature + SchemaSignatureSuffix, ObjectSerializer.serialize(typeInfo));
}

代码示例来源:origin: org.apache.hive.hcatalog/hive-hcatalog-pig-adapter

@Override
public void checkSchema(ResourceSchema resourceSchema) throws IOException {
/* Schema provided by user and the schema computed by Pig
* at the time of calling store must match.
*/
Schema runtimeSchema = Schema.getPigSchema(resourceSchema);
if (pigSchema != null) {
if (!Schema.equals(runtimeSchema, pigSchema, false, true)) {
throw new FrontendException("Schema provided in store statement doesn't match with the Schema" +
"returned by Pig run-time. Schema provided in HCatStorer: " + pigSchema.toString() + " Schema received from Pig runtime: " + runtimeSchema.toString(), PigHCatUtil.PIG_EXCEPTION_CODE);
}
} else {
pigSchema = runtimeSchema;
}
UDFContext.getUDFContext().getUDFProperties(this.getClass(), new String[]{sign}).setProperty(PIG_SCHEMA, ObjectSerializer.serialize(pigSchema));
}

推荐阅读
author-avatar
zhattt199_117
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有