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/04/24 08:00:52 UTC

[GitHub] [incubator-inlong] yunqingmoswu opened a new pull request, #3903: [INLONG-3839][Sort] Add cascade function support for transform

yunqingmoswu opened a new pull request, #3903:
URL: https://github.com/apache/incubator-inlong/pull/3903

   ### Title Name: [INLONG-3839][Sort] Add cascade function support for transform
   
   Fixes #3839 
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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] [incubator-inlong] healchow commented on a diff in pull request #3903: [INLONG-3839][Sort] Add cascade function support for transform

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


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/transformation/function/CascadeFunctionWrapper.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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 com.google.common.base.Preconditions;
+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.CascadeFunction;
+import org.apache.inlong.sort.protocol.transformation.ConstantParam;
+import org.apache.inlong.sort.protocol.transformation.Function;
+import org.apache.inlong.sort.protocol.transformation.FunctionParam;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * CascadeFunctionWrapper class is a wrapper of {@link CascadeFunction}
+ * It contains a list of {@link CascadeFunction} that really will be executed
+ */
+@JsonTypeName("cascadeFunctionWrapper")
+@EqualsAndHashCode(callSuper = false)
+@Data
+public class CascadeFunctionWrapper implements Function, Serializable {
+
+    private static final long serialVersionUID = 8197348412858988257L;
+
+    @JsonProperty("functions")
+    private final List<CascadeFunction> functions;
+
+    /**
+     * CascadeFunction constructor
+     *
+     * @param functions List of functions that cascade functions really need to execute
+     */
+    @JsonCreator
+    public CascadeFunctionWrapper(@JsonProperty("functions") List<CascadeFunction> functions) {
+        this.functions = Preconditions.checkNotNull(functions, "functions is null");
+        Preconditions.checkState(!functions.isEmpty(), "functions is empty");
+    }
+
+    @Override
+    public List<FunctionParam> getParams() {
+        return new ArrayList<>(functions);
+    }
+
+    @Override
+    public String getName() {
+        throw new UnsupportedOperationException("The method of getName is not support of CascadeFunction");
+    }
+
+    @Override
+    public String format() {
+        ConstantParam s = new ConstantParam(functions.get(0).format());

Review Comment:
   Will there be a null pointer exception here?



-- 
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] [incubator-inlong] healchow merged pull request #3903: [INLONG-3839][Sort] Add cascade function support for transform

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


-- 
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] [incubator-inlong] yunqingmoswu commented on a diff in pull request #3903: [INLONG-3839][Sort] Add cascade function support for transform

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


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/transformation/function/CascadeFunctionWrapper.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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 com.google.common.base.Preconditions;
+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.CascadeFunction;
+import org.apache.inlong.sort.protocol.transformation.ConstantParam;
+import org.apache.inlong.sort.protocol.transformation.Function;
+import org.apache.inlong.sort.protocol.transformation.FunctionParam;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * CascadeFunctionWrapper class is a wrapper of {@link CascadeFunction}
+ * It contains a list of {@link CascadeFunction} that really will be executed
+ */
+@JsonTypeName("cascadeFunctionWrapper")
+@EqualsAndHashCode(callSuper = false)
+@Data
+public class CascadeFunctionWrapper implements Function, Serializable {
+
+    private static final long serialVersionUID = 8197348412858988257L;
+
+    @JsonProperty("functions")
+    private final List<CascadeFunction> functions;
+
+    /**
+     * CascadeFunction constructor
+     *
+     * @param functions List of functions that cascade functions really need to execute
+     */
+    @JsonCreator
+    public CascadeFunctionWrapper(@JsonProperty("functions") List<CascadeFunction> functions) {
+        this.functions = Preconditions.checkNotNull(functions, "functions is null");
+        Preconditions.checkState(!functions.isEmpty(), "functions is empty");
+    }
+
+    @Override
+    public List<FunctionParam> getParams() {
+        return new ArrayList<>(functions);
+    }
+
+    @Override
+    public String getName() {
+        throw new UnsupportedOperationException("The method of getName is not support of CascadeFunction");
+    }
+
+    @Override
+    public String format() {
+        ConstantParam s = new ConstantParam(functions.get(0).format());

Review Comment:
   No, the function list has been restricted in the constructor and can not be empty.



-- 
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