You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/03/07 21:49:48 UTC

[GitHub] [beam] laraschmidt commented on a change in pull request #16958: [BEAM-14020] Adding SchemaTransform, SchemaTransformProvider, TypedSchemaTransformProvider, and PCollectionRowTuple

laraschmidt commented on a change in pull request #16958:
URL: https://github.com/apache/beam/pull/16958#discussion_r821132149



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/SchemaTransformProvider.java
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+package org.apache.beam.sdk.schemas.transforms;
+
+import java.util.List;
+import java.util.Optional;
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.annotations.Experimental.Kind;
+import org.apache.beam.sdk.annotations.Internal;
+import org.apache.beam.sdk.options.PipelineOptions;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.values.Row;
+
+/**
+ * Provider to create {@link SchemaTransform} instances.
+ *
+ * <p><b>Internal only:</b> This interface is actively being worked on and it will likely change as
+ * we provide implementations for more standard Beam transforms. We provide no backwards
+ * compatibility guarantees and it should not be implemented outside of the Beam repository.
+ */
+@Internal
+@Experimental(Kind.SCHEMAS)
+public interface SchemaTransformProvider {
+  /** Returns an id that uniquely represents this transform. */
+  String identifier();
+
+  /**
+   * Returns the expected schema of the configuration object. Note this is distinct from the schema
+   * of the transform itself.
+   *
+   * <p>Configurations should be forwards compatible. Fields added after this SchemaTransform is
+   * first released should always be nullable.
+   */
+  Schema configurationSchema();
+
+  /**
+   * Produce a SchemaTransform from transform-specific configuration object. Can throw a {@link
+   * InvalidConfigurationException} or a {@link InvalidSchemaException}.
+   */
+  SchemaTransform from(Row configuration);

Review comment:
       Thanks Brian. I just added TypsedSchemaTransformProvider + test into this change.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org