summaryrefslogtreecommitdiffstats
path: root/vespa-hadoop/src/test/pig/feed_create_operations.pig
diff options
context:
space:
mode:
Diffstat (limited to 'vespa-hadoop/src/test/pig/feed_create_operations.pig')
-rw-r--r--vespa-hadoop/src/test/pig/feed_create_operations.pig23
1 files changed, 23 insertions, 0 deletions
diff --git a/vespa-hadoop/src/test/pig/feed_create_operations.pig b/vespa-hadoop/src/test/pig/feed_create_operations.pig
new file mode 100644
index 00000000000..2186935b59a
--- /dev/null
+++ b/vespa-hadoop/src/test/pig/feed_create_operations.pig
@@ -0,0 +1,23 @@
+-- REGISTER vespa-hadoop.jar -- Not needed in tests
+
+-- Create valid Vespa put operations
+DEFINE VespaPutOperation
+ com.yahoo.vespa.hadoop.pig.VespaDocumentOperation(
+ 'operation=put',
+ 'docid=id:<application>:metrics::<name>-<date>'
+ );
+
+-- By default, VespaStorage assumes it's feeding valid Vespa operations
+DEFINE VespaStorage
+ com.yahoo.vespa.hadoop.pig.VespaStorage();
+
+-- Load tabular data
+metrics = LOAD 'src/test/resources/tabular_data.csv' AS (date:chararray, name:chararray, value:int, application:chararray);
+
+-- Transform tabular data to a Vespa document operation JSON format
+metrics = FOREACH metrics GENERATE VespaPutOperation(*);
+
+-- Store into Vespa
+STORE metrics INTO '$ENDPOINT' USING VespaStorage();
+
+