[
https://issues.apache.org/jira/browse/BEAM-14430?focusedWorklogId=769346&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-769346
]
ASF GitHub Bot logged work on BEAM-14430:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 11/May/22 23:15
Start Date: 11/May/22 23:15
Worklog Time Spent: 10m
Work Description: robertwb commented on code in PR #17608:
URL: https://github.com/apache/beam/pull/17608#discussion_r870822496
##########
sdks/java/extensions/python/src/test/java/org/apache/beam/sdk/extensions/python/PythonExternalTransformTest.java:
##########
@@ -184,6 +186,19 @@ public void generateArgsWithCustomType() {
assertEquals(456, (int) receivedRow.getRow("field1").getInt32("intField"));
}
+ @Test
+ public void generateArgsWithTypeHint() {
+ PythonExternalTransform<?, ?> transform =
+ PythonExternalTransform
+ .<PCollection<KV<String, String>>, PCollection<KV<String,
Iterable<String>>>>from(
+ "DummyTransform")
+ .withArgs(PythonCallableSource.of("dummy data"))
+ .withTypeHint(
Review Comment:
Until BEAM-14458 is resolved, can we automatically infer at least this
special case from within PythonExternalTransform?
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/PythonCallable.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.logicaltypes;
+
+import org.apache.beam.sdk.annotations.Experimental;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.schemas.Schema.LogicalType;
+import org.apache.beam.sdk.util.PythonCallableSource;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+/** A logical type for PythonCallableSource objects. */
+@Experimental(Experimental.Kind.SCHEMAS)
+public class PythonCallable implements LogicalType<PythonCallableSource,
String> {
+ public static final String IDENTIFIER =
"beam:logical_type:python_callable:v1";
Review Comment:
Should this constant be put into the protos?
Issue Time Tracking
-------------------
Worklog Id: (was: 769346)
Time Spent: 1h 20m (was: 1h 10m)
> Adding a logical type support for Python callables to Row schema
> ----------------------------------------------------------------
>
> Key: BEAM-14430
> URL: https://issues.apache.org/jira/browse/BEAM-14430
> Project: Beam
> Issue Type: New Feature
> Components: cross-language
> Reporter: Heejong Lee
> Assignee: Heejong Lee
> Priority: P2
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> Adding a logical type support for Python callables to Row schema
--
This message was sent by Atlassian Jira
(v8.20.7#820007)