You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/08/17 06:54:08 UTC

[GitHub] [inlong] emhui opened a new pull request, #5579: [INLONG-5577][Manager][Sort] Support function fieldType

emhui opened a new pull request, #5579:
URL: https://github.com/apache/inlong/pull/5579

   ### Prepare a Pull Request
   
   [INLONG-5577][Manager][Sort] Support function fieldType
   
   - Fixes #5577 
   
   ### Motivation
   
   Support for defining fields as function types
   
   ### Modifications
   
   When FieldType is set to a function type, there is no need to add single quotation marks


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] gong commented on pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
gong commented on PR #5579:
URL: https://github.com/apache/inlong/pull/5579#issuecomment-1217552273

   Add a UT. How to use it. 


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #5579:
URL: https://github.com/apache/inlong/pull/5579#discussion_r948603917


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/transformation/function/CustomFunction.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.inlong.sort.protocol.transformation.function;
+
+import java.util.Collections;
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.transformation.Function;
+import org.apache.inlong.sort.protocol.transformation.FunctionParam;
+import org.apache.inlong.sort.protocol.transformation.StringConstantParam;
+
+/**
+ * CustomFunction class uses the content of field as a function
+ */
+@JsonTypeName("customFunction")
+@EqualsAndHashCode(callSuper = false)
+@Data
+public class CustomFunction implements Function {
+
+    private final String content;
+
+    @JsonCreator
+    public CustomFunction(@JsonProperty("content") String content) {
+        this.content = content;
+    }
+
+    @Override
+    public List<FunctionParam> getParams() {
+        return Collections.singletonList(new StringConstantParam(content));
+    }
+
+    /**
+     * Function param name
+     *
+     * @return The name of this function param
+     */
+    @Override
+    public String getName() {
+        return "CUSTOMFUNCTION";

Review Comment:
   It is recommended to throw an exception directly here, and this method is not allowed to be accessed.



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] healchow merged pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
healchow merged PR #5579:
URL: https://github.com/apache/inlong/pull/5579


-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] emhui commented on a diff in pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
emhui commented on code in PR #5579:
URL: https://github.com/apache/inlong/pull/5579#discussion_r948612107


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/transformation/function/CustomFunction.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.inlong.sort.protocol.transformation.function;
+
+import java.util.Collections;
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.transformation.Function;
+import org.apache.inlong.sort.protocol.transformation.FunctionParam;
+import org.apache.inlong.sort.protocol.transformation.StringConstantParam;
+
+/**
+ * CustomFunction class uses the content of field as a function
+ */
+@JsonTypeName("customFunction")
+@EqualsAndHashCode(callSuper = false)
+@Data
+public class CustomFunction implements Function {
+
+    private final String content;
+
+    @JsonCreator
+    public CustomFunction(@JsonProperty("content") String content) {
+        this.content = content;
+    }
+
+    @Override
+    public List<FunctionParam> getParams() {
+        return Collections.singletonList(new StringConstantParam(content));
+    }
+
+    /**
+     * Function param name
+     *
+     * @return The name of this function param
+     */
+    @Override
+    public String getName() {
+        return "CUSTOMFUNCTION";

Review Comment:
   Thank you, this is a good suggestion.



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] emhui commented on a diff in pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
emhui commented on code in PR #5579:
URL: https://github.com/apache/inlong/pull/5579#discussion_r948605579


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PulsarExtractNode.java:
##########
@@ -44,7 +44,6 @@ public class PulsarExtractNode extends ExtractNode {
     @Nonnull
     @JsonProperty("topic")
     private String topic;
-    @Nonnull

Review Comment:
   Has been corrected.



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #5579:
URL: https://github.com/apache/inlong/pull/5579#discussion_r948603634


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/PulsarExtractNode.java:
##########
@@ -44,7 +44,6 @@ public class PulsarExtractNode extends ExtractNode {
     @Nonnull
     @JsonProperty("topic")
     private String topic;
-    @Nonnull

Review Comment:
   Why remove the validation in this PR?



-- 
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: commits-unsubscribe@inlong.apache.org

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


[GitHub] [inlong] emhui commented on pull request #5579: [INLONG-5577][Manager][Sort] Support function fieldType

Posted by GitBox <gi...@apache.org>.
emhui commented on PR #5579:
URL: https://github.com/apache/inlong/pull/5579#issuecomment-1217668225

   > Add a UT. How to use it.
   
   1


-- 
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: commits-unsubscribe@inlong.apache.org

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