Skip to content

Commit

Permalink
This closes #1910
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalperi committed Feb 8, 2017
2 parents 8c1a577 + 268b905 commit 570ddb7
Show file tree
Hide file tree
Showing 12 changed files with 390 additions and 80 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -39,6 +39,10 @@ env/
# committed.
dependency-reduced-pom.xml

# The build process copies the standard_coders.yaml file into Python module,
# but it shouldn't be committed.
sdks/python/apache_beam/coders/standard_coders.yaml

# Hotspot VM leaves this log in a non-target directory when java crashes
hs_err_pid*.log

Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Expand Up @@ -319,6 +319,12 @@
<artifactId>beam-sdks-common-fn-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-common-fn-api</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>org.apache.beam</groupId>
Expand Down Expand Up @@ -793,6 +799,11 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-scala_2.10</artifactId>
Expand Down
14 changes: 14 additions & 0 deletions runners/direct-java/pom.xml
Expand Up @@ -268,5 +268,19 @@
<artifactId>google-cloud-dataflow-java-proto-library-all</artifactId>
<scope>test</scope>
</dependency>

<!-- transitive test dependencies from beam-sdk-java-core -->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-common-fn-api</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion sdks/common/fn-api/pom.xml
Expand Up @@ -35,7 +35,7 @@
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
Expand Down
@@ -0,0 +1,98 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This file is broken into multiple sections delimited by ---. Each section specifies a set of
# reference encodings for a single standardized coder used in a specific context.
#
# Each section contains up to 3 properties:
#
# coder: a common coder spec. Currently, a URN and URNs for component coders as necessary.
# nested: a boolean meaning whether the coder was used in the nested context. Missing means to
# test both contexts, a shorthand for when the coder is invariant across context.
# examples: a map of {encoded bytes: original JSON object} encoded with the coder in the context.
# The LHS (key) is a byte array encoded as a JSON-escaped string. The RHS (value) is
# one of a few standard JSON types such as numbers, strings, dicts that map naturally
# to the type encoded by the coder.
#
# These choices were made to strike a balance between portability, ease of use, and simple
# legibility of this file itself.
#
# It is expected that future work will move the `coder` field into a format that it would be
# represented by the Runner API, so that it can be understood by all SDKs and harnesses.


coder:
urn: "urn:beam:coders:bytes:0.1"
nested: false
examples:
"abc": abc
"ab\0c": "ab\0c"

---

coder:
urn: "urn:beam:coders:bytes:0.1"
nested: true
examples:
"\u0003abc": abc
"\u0004ab\0c": "ab\0c"
"\u00c8\u0001 10| 20| 30| 40| 50| 60| 70| 80| 90| 100| 110| 120| 130| 140| 150| 160| 170| 180| 190| 200|":
" 10| 20| 30| 40| 50| 60| 70| 80| 90| 100| 110| 120| 130| 140| 150| 160| 170| 180| 190| 200|"

---

coder:
urn: "urn:beam:coders:varint:0.1"
examples:
"\0": 0
"\u0001": 1
"\u000A": 10
"\u00c8\u0001": 200
"\u00e8\u0007": 1000
"\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u00ff\u0001": -1

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:varint:0.1"}]
examples:
"\u0003abc\0": {key: abc, value: 0}
"\u0004ab\0c\u000A": {key: "ab\0c", value: 10}

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:bytes:0.1"}]
nested: false
examples:
"\u0003abcdef": {key: abc, value: def}
"\u0004ab\0cde\0f": {key: "ab\0c", value: "de\0f"}

---

coder:
urn: "urn:beam:coders:kv:0.1"
components: [{urn: "urn:beam:coders:bytes:0.1"},
{urn: "urn:beam:coders:bytes:0.1"}]
nested: true
examples:
"\u0003abc\u0003def": {key: abc, value: def}
"\u0004ab\0c\u0004de\0f": {key: "ab\0c", value: "de\0f"}
13 changes: 13 additions & 0 deletions sdks/java/core/pom.xml
Expand Up @@ -429,6 +429,19 @@
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.apache.beam</groupId>
<artifactId>beam-sdks-common-fn-api</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
Expand Down

0 comments on commit 570ddb7

Please sign in to comment.