public class VespaDocumentOperation extends org.apache.pig.EvalFunc<String>
Modifier and Type | Class and Description |
---|---|
static class |
VespaDocumentOperation.Operation |
Modifier and Type | Field and Description |
---|---|
private static String |
CREATE_TENSOR_FIELDS |
private static String |
EXCLUDE_FIELDS |
private VespaDocumentOperation.Operation |
operation |
private static String |
PARTIAL_UPDATE_ASSIGN |
private Properties |
properties |
private static String |
PROPERTY_ID_TEMPLATE |
private static String |
PROPERTY_OPERATION |
private static String |
SIMPLE_ARRAY_FIELDS |
private String |
template |
Constructor and Description |
---|
VespaDocumentOperation(String... params) |
Modifier and Type | Method and Description |
---|---|
static String |
create(VespaDocumentOperation.Operation op,
String docId,
Map<String,Object> fields,
Properties properties)
Create a JSON Vespa document operation given the supplied fields,
operation and document id template.
|
String |
exec(org.apache.pig.data.Tuple tuple) |
private static boolean |
shouldCreateTensor(Map<Object,Object> map,
String name,
Properties properties) |
private static boolean |
shouldWriteField(String name,
Properties properties,
int depth) |
private static boolean |
shouldWritePartialUpdate(VespaDocumentOperation.Operation op,
int depth) |
private static boolean |
shouldWriteTupleStart(org.apache.pig.data.Tuple tuple,
String name,
Properties properties) |
private static void |
writeField(String name,
Object value,
Byte type,
com.fasterxml.jackson.core.JsonGenerator g,
Properties properties,
VespaDocumentOperation.Operation op,
int depth) |
private static void |
writePartialUpdate(Object value,
Byte type,
com.fasterxml.jackson.core.JsonGenerator g,
String name,
Properties properties,
VespaDocumentOperation.Operation op,
int depth) |
private static void |
writeTensor(Map<Object,Object> map,
com.fasterxml.jackson.core.JsonGenerator g) |
private static void |
writeValue(Object value,
Byte type,
com.fasterxml.jackson.core.JsonGenerator g,
String name,
Properties properties,
VespaDocumentOperation.Operation op,
int depth) |
allowCompileTimeCalculation, finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, outputSchema, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
private static final String PROPERTY_ID_TEMPLATE
private static final String PROPERTY_OPERATION
private static final String SIMPLE_ARRAY_FIELDS
private static final String CREATE_TENSOR_FIELDS
private static final String EXCLUDE_FIELDS
private static final String PARTIAL_UPDATE_ASSIGN
private final String template
private final VespaDocumentOperation.Operation operation
private final Properties properties
public VespaDocumentOperation(String... params)
public String exec(org.apache.pig.data.Tuple tuple) throws IOException
exec
in class org.apache.pig.EvalFunc<String>
IOException
public static String create(VespaDocumentOperation.Operation op, String docId, Map<String,Object> fields, Properties properties) throws IOException
op
- Operation (put, remove, update)docId
- Document idfields
- Fields to put in document operationIOException
- ...private static void writeField(String name, Object value, Byte type, com.fasterxml.jackson.core.JsonGenerator g, Properties properties, VespaDocumentOperation.Operation op, int depth) throws IOException
IOException
private static void writeValue(Object value, Byte type, com.fasterxml.jackson.core.JsonGenerator g, String name, Properties properties, VespaDocumentOperation.Operation op, int depth) throws IOException
IOException
private static boolean shouldWritePartialUpdate(VespaDocumentOperation.Operation op, int depth)
private static void writePartialUpdate(Object value, Byte type, com.fasterxml.jackson.core.JsonGenerator g, String name, Properties properties, VespaDocumentOperation.Operation op, int depth) throws IOException
IOException
private static boolean shouldWriteTupleStart(org.apache.pig.data.Tuple tuple, String name, Properties properties)
private static boolean shouldCreateTensor(Map<Object,Object> map, String name, Properties properties)
private static boolean shouldWriteField(String name, Properties properties, int depth)
private static void writeTensor(Map<Object,Object> map, com.fasterxml.jackson.core.JsonGenerator g) throws IOException
IOException
Copyright © 2018. All rights reserved.