Re: [PR] [INLONG-10806][SDK] Optimize python dataproxy sdk build script [inlong]
dockerzhang merged PR #10807: URL: https://github.com/apache/inlong/pull/10807 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(inlong) branch master updated: [INLONG-10806][SDK] Optimize python dataproxy sdk build script (#10807)
This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git The following commit(s) were added to refs/heads/master by this push: new 44adf6266c [INLONG-10806][SDK] Optimize python dataproxy sdk build script (#10807) 44adf6266c is described below commit 44adf6266c53c5513b4313e7e096975a575386fb Author: yfsn666 <61183968+yfsn...@users.noreply.github.com> AuthorDate: Mon Aug 19 15:11:10 2024 +0800 [INLONG-10806][SDK] Optimize python dataproxy sdk build script (#10807) --- .../dataproxy-sdk-python/README.md | 25 +- .../dataproxy-sdk-python/build.sh | 56 +++--- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md index bb490d8743..d4e4f94bb2 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md @@ -29,16 +29,37 @@ InLong Dataproxy Python SDK is a wrapper over the existing [C++ SDK](https://git - Python 3.6+ ## Build -Go to the dataproxy-sdk-python root directory, and run + +### Build the C++ SDK + +Go to the `dataproxy-sdk-cpp` root directory, and run the following commands: + +```bash +chmod +x ./build_third_party.sh && chmod +x ./build.sh +./build_third_party.sh +./build.sh +``` + +If you have already built the C++ SDK, you can skip this step. + +### Build the Python SDK + +Go to the `dataproxy-sdk-python` root directory, and run the following commands: ```bash chmod +x ./build.sh ./build.sh ``` +When the .so file is generated, you will see the following message, you can choose to enter the target directory for the .so files. By default, the .so file will be copied to the system python site-packages directory: + +```txt +Your system's Python site-packages directory is: xxx/xxx +Enter the target directory for the .so files (Press Enter to use the default site-packages directory): +``` After the build process finished, you can import the package (`import inlong_dataproxy`) in your python project to use InLong dataproxy. -> **Note**: When the C++ SDK or the version of Python you're using is updated, you'll need to rebuild it by re-executing the `build.sh` script +> **Note**: When the C++ SDK or the version of Python you're using is updated, you'll need to rebuild it by the above steps. ## Config Parameters diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/build.sh b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/build.sh index 1b5bf1ed0e..f38f535dad 100755 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/build.sh +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/build.sh @@ -18,6 +18,8 @@ #!/bin/bash +set -e + BASE_DIR=`dirname "$0"` PY_SDK_DIR=`cd "$BASE_DIR";pwd` @@ -49,24 +51,35 @@ if [ "$(printf '%s\n' "$PYTHON_REQUIRED" "$PYTHON_VERSION" | sort -V | head -n1) exit 1 fi -# Clone and build pybind11 -git clone https://github.com/pybind/pybind11.git $PY_SDK_DIR/pybind11 -mkdir $PY_SDK_DIR/pybind11/build && cd $PY_SDK_DIR/pybind11/build -cmake $PY_SDK_DIR/pybind11 -cmake --build $PY_SDK_DIR/pybind11/build --config Release --target check -make check -j 4 +# Build pybind11(If the pybind11 has been compiled, this step will be skipped) +if [ ! -d "$PY_SDK_DIR/pybind11/build" ]; then +if [ -d "$PY_SDK_DIR/pybind11" ]; then +rm -r $PY_SDK_DIR/pybind11 +fi +git clone https://github.com/pybind/pybind11.git $PY_SDK_DIR/pybind11 +mkdir $PY_SDK_DIR/pybind11/build && cd $PY_SDK_DIR/pybind11/build +cmake $PY_SDK_DIR/pybind11 +cmake --build $PY_SDK_DIR/pybind11/build --config Release --target check +make -j 4 +else +echo "Skipped build pybind11" +fi # Build dataproxy-sdk-cpp(If the dataproxy-sdk-cpp has been compiled, this step will be skipped) if [ ! -e "$CPP_SDK_DIR/release/lib/dataproxy_sdk.a" ]; then -chmod +x $CPP_SDK_DIR/build_third_party.sh -chmod +x $CPP_SDK_DIR/build.sh -cd $CPP_SDK_DIR -. $CPP_SDK_DIR/build_third_party.sh -. $CPP_SDK_DIR/build.sh -cp -r $CPP_SDK_DIR $PY_SDK_DIR +echo "The dataproxy-sdk-cpp is not compiled, you should run the following commands to compile it first:" +echo "--" +echo "cd $CPP_SDK_DIR && chmod +x build_third_party.sh && chmod +x build.sh" +echo "./build_third_party.sh" +echo "./build.sh" +echo "--" +exit 1 else +if [ -d "$PY_SDK_DIR/dataproxy-sdk-cpp" ]; then +rm -r $PY_SDK_DIR/dataproxy-sdk-cpp +fi cp -r $CPP_SDK_DIR $PY_SDK_DIR -echo "Skipped build dataproxy-sdk-cpp" +echo "Copied th
Re: [I] [Feature][SDK] Transform support cos function [inlong]
github-actions[bot] commented on issue #10813: URL: https://github.com/apache/inlong/issues/10813#issuecomment-2295916719 Hello @ying-hua, thank you for opening your first issue in InLong 🧡 We will respond as soon as possible ⏳ If this is a bug report, please provide screenshots or error logs for us to reproduce your issue, so we can do our best to fix it. If you have any questions in the meantime, you can also ask us on the [InLong Discussions](https://github.com/apache/inlong/discussions) 🔍 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
leezng commented on code in PR #10782: URL: https://github.com/apache/inlong/pull/10782#discussion_r1721399533 ## inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts: ## @@ -87,7 +94,170 @@ export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { }) @I18n('meta.Synchronize.SinkMultipleEnable') sinkMultipleEnable: boolean; + @FieldDecorator({ +type: 'radio', +initialValue: 1, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.RealTime'), + value: 1, +}, +{ + label: i18n.t('meta.Synchronize.Offline'), + value: 2, +}, + ], +}, + }) + @ColumnDecorator({ +width: 200, +render: text => inlongGroupModeList?.filter(item => item.value === text)?.[0]?.label, + }) + @I18n('meta.Synchronize.SyncType') + inlongGroupMode: Number; + @FieldDecorator({ +type: 'radio', +initialValue: 0, +visible: values => values.inlongGroupMode === 2, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.Conventional'), + value: 0, +}, +{ + label: i18n.t('meta.Synchronize.Crontab'), + value: 1, +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleType') + scheduleType: Number; + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type: 'select', +initialValue: 'H', +name: 'scheduleUnit', +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Year'), + value: 'Y', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Month'), + value: 'M', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Day'), + value: 'D', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Hours'), + value: 'H', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Minute'), + value: 'I', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Single'), + value: 'O', +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleUnit') + scheduleUnit: String; + + @FieldDecorator({ +type: 'input', +initialValue: 0, +rules: [{ required: true, pattern: new RegExp(/^[0-9]\d*$/, 'g') }], +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +props: values => ({ + suffix: values.scheduleUnit, +}), + }) + @I18n('meta.Synchronize.ScheduleInterval') + scheduleInterval: number; + + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type: TimePicker, +initialValue: dayjs('00:00', format), +name: 'delayTime', +rules: [{ required: true }], +props: { + format: format, +}, + }) + @I18n('meta.Synchronize.DelayTime') + delayTime: dayjs.Dayjs; + + @FieldDecorator({ +type: DatePicker.RangePicker, +props: values => ({ + format: conventionalTimeFormat, + showTime: true, + disabledTime: (date: dayjs.Dayjs, type, info: { from?: dayjs.Dayjs }) => { +return { + disabledSeconds: () => range(0, 60), +}; + }, +}), +visible: values => + values.inlongGroupMode === 2 && (values.scheduleType === 0 || values.scheduleType === 1), +rules: [{ required: true }], + }) + @I18n('meta.Synchronize.ValidTime') + time: dayjs.Dayjs[]; + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 1, +type: 'input', +rules: [{ required: true }], +props: {}, + }) + @I18n('crontab表达式') Review Comment: It seems like locale configuration is missing? -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] [INLONG-10813][SDK] Transform support cos function [inlong]
ying-hua opened a new pull request, #10814: URL: https://github.com/apache/inlong/pull/10814 Fixes #10813 ### Motivation Add a arithmatic function class and unit test. ### Modifications ### Verifying this change *(Please pick either of the following options)* - [ ] This change is a trivial rework/code cleanup without any test coverage. - [x] 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10813][SDK] Transform support cos function [inlong]
ying-hua closed pull request #10814: [INLONG-10813][SDK] Transform support cos function URL: https://github.com/apache/inlong/pull/10814 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10813][SDK] Transform support cos function [inlong]
ying-hua closed pull request #10814: [INLONG-10813][SDK] Transform support cos function URL: https://github.com/apache/inlong/pull/10814 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
wohainilaodou commented on code in PR #10782: URL: https://github.com/apache/inlong/pull/10782#discussion_r1721568337 ## inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts: ## @@ -87,7 +94,170 @@ export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { }) @I18n('meta.Synchronize.SinkMultipleEnable') sinkMultipleEnable: boolean; + @FieldDecorator({ +type: 'radio', +initialValue: 1, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.RealTime'), + value: 1, +}, +{ + label: i18n.t('meta.Synchronize.Offline'), + value: 2, +}, + ], +}, + }) + @ColumnDecorator({ +width: 200, +render: text => inlongGroupModeList?.filter(item => item.value === text)?.[0]?.label, + }) + @I18n('meta.Synchronize.SyncType') + inlongGroupMode: Number; + @FieldDecorator({ +type: 'radio', +initialValue: 0, +visible: values => values.inlongGroupMode === 2, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.Conventional'), + value: 0, +}, +{ + label: i18n.t('meta.Synchronize.Crontab'), + value: 1, +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleType') + scheduleType: Number; + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type: 'select', +initialValue: 'H', +name: 'scheduleUnit', +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Year'), + value: 'Y', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Month'), + value: 'M', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Day'), + value: 'D', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Hours'), + value: 'H', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Minute'), + value: 'I', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Single'), + value: 'O', +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleUnit') + scheduleUnit: String; + + @FieldDecorator({ +type: 'input', +initialValue: 0, +rules: [{ required: true, pattern: new RegExp(/^[0-9]\d*$/, 'g') }], +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +props: values => ({ + suffix: values.scheduleUnit, +}), + }) + @I18n('meta.Synchronize.ScheduleInterval') + scheduleInterval: number; + + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type: TimePicker, +initialValue: dayjs('00:00', format), +name: 'delayTime', +rules: [{ required: true }], +props: { + format: format, +}, + }) + @I18n('meta.Synchronize.DelayTime') + delayTime: dayjs.Dayjs; + + @FieldDecorator({ +type: DatePicker.RangePicker, +props: values => ({ + format: conventionalTimeFormat, + showTime: true, + disabledTime: (date: dayjs.Dayjs, type, info: { from?: dayjs.Dayjs }) => { +return { + disabledSeconds: () => range(0, 60), +}; + }, +}), +visible: values => + values.inlongGroupMode === 2 && (values.scheduleType === 0 || values.scheduleType === 1), +rules: [{ required: true }], + }) + @I18n('meta.Synchronize.ValidTime') + time: dayjs.Dayjs[]; + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 1, +type: 'input', +rules: [{ required: true }], +props: {}, + }) + @I18n('crontab表达式') Review Comment: done -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK [inlong]
doleyzi opened a new pull request, #10815: URL: https://github.com/apache/inlong/pull/10815 - Fixes #10793 ### Motivation Added metric management for DataProxy CPP SDK ### Modifications Added metric management for DataProxy CPP SDK to facilitate system operation -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK [inlong]
luchunliang commented on code in PR #10815: URL: https://github.com/apache/inlong/pull/10815#discussion_r1721622344 ## inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/metric_manager.cc: ## @@ -0,0 +1,64 @@ +/** + * 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. + */ + +#include "metric_manager.h" + +#include +#include +#include + +#include "../utils/logger.h" +#include "../utils/utils.h" +#include "../utils/capi_constant.h" + +namespace inlong { +void MetricManager::Init() { + if (__sync_bool_compare_and_swap(&inited_, false, true)) { +update_thread_ = std::thread(&MetricManager::Run, this); + } + InitEnvironment(); +} +void MetricManager::InitEnvironment() { + environment_.setType("cpp"); + environment_.setVersion(constants::kVersion); + environment_.setPid(getpid()); + environment_.setIp(SdkConfig::getInstance()->local_ip_); +} +void MetricManager::Run() { + prctl(PR_SET_NAME, "metric-manager"); + while (running_) { +LOG_INFO("Start report metric"); +PrintMetric(); + std::this_thread::sleep_for(std::chrono::minutes(constants::kMetricIntervalMinutes)); + } +} +void MetricManager::PrintMetric() { Review Comment: The class name and variable name do not conform to C++ coding style. -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
dockerzhang commented on code in PR #10782: URL: https://github.com/apache/inlong/pull/10782#discussion_r1721623192 ## inlong-dashboard/src/ui/locales/cn.json: ## @@ -430,6 +430,7 @@ "meta.Synchronize.ScheduleUnit.Single": "单次", "meta.Synchronize.ScheduleInterval": "调度周期", "meta.Synchronize.ValidTime": "有效时间", + "meta.Synchronize.CronExpression": "crontab表达式", Review Comment: "crontab表达式" ——> "Crontab 表达式" -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK [inlong]
doleyzi commented on code in PR #10815: URL: https://github.com/apache/inlong/pull/10815#discussion_r1721640599 ## inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/metric_manager.cc: ## @@ -0,0 +1,64 @@ +/** + * 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. + */ + +#include "metric_manager.h" + +#include +#include +#include + +#include "../utils/logger.h" +#include "../utils/utils.h" +#include "../utils/capi_constant.h" + +namespace inlong { +void MetricManager::Init() { + if (__sync_bool_compare_and_swap(&inited_, false, true)) { +update_thread_ = std::thread(&MetricManager::Run, this); + } + InitEnvironment(); +} +void MetricManager::InitEnvironment() { + environment_.setType("cpp"); + environment_.setVersion(constants::kVersion); + environment_.setPid(getpid()); + environment_.setIp(SdkConfig::getInstance()->local_ip_); +} +void MetricManager::Run() { + prctl(PR_SET_NAME, "metric-manager"); + while (running_) { +LOG_INFO("Start report metric"); +PrintMetric(); + std::this_thread::sleep_for(std::chrono::minutes(constants::kMetricIntervalMinutes)); + } +} +void MetricManager::PrintMetric() { Review Comment: Uniformly follow Google specifications, that is, function names are named in camel case. -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK [inlong]
dockerzhang merged PR #10815: URL: https://github.com/apache/inlong/pull/10815 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(inlong) branch master updated: [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK (#10815)
This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git The following commit(s) were added to refs/heads/master by this push: new 47c710b28c [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK (#10815) 47c710b28c is described below commit 47c710b28ce044f9a6e695273c55ea20b72d574e Author: doleyzi <43397300+dole...@users.noreply.github.com> AuthorDate: Mon Aug 19 20:10:18 2024 +0800 [INLONG-10793][SDK] Added metric management for DataProxy CPP SDK (#10815) --- .../dataproxy-sdk-cpp/CMakeLists.txt | 3 +- .../dataproxy-sdk-cpp/src/core/api_imp.cc | 4 +- .../src/manager/metric_manager.cc | 64 + .../dataproxy-sdk-cpp/src/manager/metric_manager.h | 93 + .../dataproxy-sdk-cpp/src/manager/proxy_manager.cc | 1 + .../dataproxy-sdk-cpp/src/metric/environment.h | 48 +++ .../dataproxy-sdk-cpp/src/metric/metric.h | 151 + .../dataproxy-sdk-cpp/src/utils/CMakeLists.txt | 7 +- .../dataproxy-sdk-cpp/src/utils/capi_constant.h| 1 + 9 files changed, 368 insertions(+), 4 deletions(-) diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt index ccbab35336..2a3183fff3 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/CMakeLists.txt @@ -33,6 +33,7 @@ include_directories(src/manager) include_directories(src/group) include_directories(src/protocol) include_directories(src/client) +include_directories(src/metric) link_directories(${PROJECT_SOURCE_DIR}/third_party/lib) link_directories(${PROJECT_SOURCE_DIR}/third_party/lib64) @@ -57,7 +58,7 @@ aux_source_directory(src/protocol PROTOCOL) aux_source_directory(src/client CLIENT) # static library -add_library(dataproxy_sdk STATIC ${UTILS} ${CONFIGS} ${CORE} ${MANAGER} ${GROUP} ${PROTOCOL} ${CLIENT}) +add_library(dataproxy_sdk STATIC ${UTILS} ${CONFIGS} ${CORE} ${MANAGER} ${GROUP} ${PROTOCOL} ${CLIENT} ${METRIC}) set_target_properties(dataproxy_sdk PROPERTIES OUTPUT_NAME "dataproxy_sdk" PREFIX "") diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/core/api_imp.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/core/api_imp.cc index c4b493b068..13ce7223b5 100644 --- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/core/api_imp.cc +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/core/api_imp.cc @@ -25,6 +25,8 @@ #include #include +#include "metric_manager.h" + namespace inlong { int32_t ApiImp::InitApi(const char *config_file_path) { if (!__sync_bool_compare_and_swap(&inited_, false, true)) { @@ -104,7 +106,7 @@ int32_t ApiImp::DoInit() { LOG_INFO("inlong dataproxy cpp sdk Init complete!"); ProxyManager::GetInstance()->Init(); - ProxyManager::GetInstance()->ReadLocalCache(); + MetricManager::GetInstance()->Init(); for (int i = 0; i < SdkConfig::getInstance()->inlong_group_ids_.size(); i++) { LOG_INFO("DoInit CheckConf inlong_group_id:" diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/metric_manager.cc b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/metric_manager.cc new file mode 100644 index 00..061abc0678 --- /dev/null +++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp/src/manager/metric_manager.cc @@ -0,0 +1,64 @@ +/** + * 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. + */ + +#include "metric_manager.h" + +#include +#include +#include + +#include "../utils/logger.h" +#include "../utils/utils.h" +#include "../utils/capi_constant.h" + +namespace inlong { +void MetricManager::Init() { + if (__sync_bool_compare_and_swap(&inited_, false, true)) { +update_thread_ = std::thread(&MetricManager::Run, this); + } + InitEnvironment(); +} +void MetricManager::InitEnvironment() { + environment_.setType("cpp"); + environment_.setVersion(constants::kVersion); + environment_.setPid(getpid()); + environment_.setIp(SdkConfig::getInstance()->local_ip_); +} +void
Re: [PR] [INLONG-10813][SDK] Transform support cos function [inlong]
yfsn666 commented on code in PR #10814: URL: https://github.com/apache/inlong/pull/10814#discussion_r1721611522 ## inlong-sdk/transform-sdk/src/test/java/org/apache/inlong/sdk/transform/process/TestTransformArithmeticFunctionsProcessor.java: ## @@ -281,4 +281,17 @@ public void testSinhFunction() throws Exception { Assert.assertEquals(1, output3.size()); Assert.assertEquals(output3.get(0), "result=3.626860407847019"); } + +@Test +public void testCosFunction() throws Exception { +String transformSql = "select cos(numeric1) from source"; +TransformConfig config = new TransformConfig(transformSql); +TransformProcessor processor = TransformProcessor +.create(config, SourceDecoderFactory.createCsvDecoder(csvSource), +SinkEncoderFactory.createKvEncoder(kvSink)); +// case: sin(0) Review Comment: The comment is incorrect. ```suggestion // case: cos(0) ``` -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
dockerzhang commented on code in PR #10782: URL: https://github.com/apache/inlong/pull/10782#discussion_r1721623192 ## inlong-dashboard/src/ui/locales/cn.json: ## @@ -430,6 +430,7 @@ "meta.Synchronize.ScheduleUnit.Single": "单次", "meta.Synchronize.ScheduleInterval": "调度周期", "meta.Synchronize.ValidTime": "有效时间", + "meta.Synchronize.CronExpression": "crontab表达式", Review Comment: "crontab表达式" ——> "Crontab 表达式" ## inlong-dashboard/src/ui/locales/cn.json: ## @@ -411,7 +411,33 @@ "meta.Synchronize.GroupIdHelp": "数据流组 ID 与数据流 ID 默认相同", "meta.Synchronize.InlongGroupOwnersExtra": "责任人,可查看、修改数据同步信息", "meta.Synchronize.GroupOwners": "责任人", - "meta.Stream.StreamId": "数据流 ID", + "meta.Synchronize.SyncType": "同步类型", + "meta.Synchronize.RealTimeSync": "实时同步", + "meta.Synchronize.RealTime": "实时", + "meta.Synchronize.Offline": "离线", + "meta.Synchronize.OfflineSync": "离线同步", + "meta.Synchronize.SchedulingRules": "调度规则", + "meta.Synchronize.ScheduleType": "调度类型", + "meta.Synchronize.Conventional": "常规", + "meta.Synchronize.Crontab": "Crontab", + "meta.Synchronize.DelayTime": "延迟时间", + "meta.Synchronize.ScheduleUnit": "调度单位", + "meta.Synchronize.ScheduleUnit.Year": "年", + "meta.Synchronize.ScheduleUnit.Month": "月", + "meta.Synchronize.ScheduleUnit.Day": "天", + "meta.Synchronize.ScheduleUnit.Minute": "分钟", + "meta.Synchronize.ScheduleUnit.Hours": "小时", + "meta.Synchronize.ScheduleUnit.Single": "单次", + "meta.Synchronize.ScheduleInterval": "调度周期", + "meta.Synchronize.ValidTime": "有效时间", + "meta.Synchronize.CronExpression": "crontab表达式", Review Comment: ```suggestion "meta.Synchronize.CronExpression": "Crontab 表达式", ``` -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10813][SDK] Transform support cos function [inlong]
dockerzhang merged PR #10814: URL: https://github.com/apache/inlong/pull/10814 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(inlong) branch master updated: [INLONG-10813][SDK] Transform support cos function (#10814)
This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git The following commit(s) were added to refs/heads/master by this push: new 48845109b7 [INLONG-10813][SDK] Transform support cos function (#10814) 48845109b7 is described below commit 48845109b779f4bcfd8e3e2acf0ce5804c75447b Author: Xincheng Huang <60057611+ying-...@users.noreply.github.com> AuthorDate: Mon Aug 19 20:56:30 2024 +0800 [INLONG-10813][SDK] Transform support cos function (#10814) Co-authored-by: Charles Zhang Co-authored-by: yfsn666 <61183968+yfsn...@users.noreply.github.com> --- .../transform/process/function/CosFunction.java| 57 ++ .../transform/process/operator/OperatorTools.java | 2 + .../TestTransformArithmeticFunctionsProcessor.java | 13 + 3 files changed, 72 insertions(+) diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/CosFunction.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/CosFunction.java new file mode 100644 index 00..bbe9c9da96 --- /dev/null +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/CosFunction.java @@ -0,0 +1,57 @@ +/* + * 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.sdk.transform.process.function; + +import org.apache.inlong.sdk.transform.decode.SourceData; +import org.apache.inlong.sdk.transform.process.Context; +import org.apache.inlong.sdk.transform.process.operator.OperatorTools; +import org.apache.inlong.sdk.transform.process.parser.ValueParser; + +import net.sf.jsqlparser.expression.Function; + +import java.math.BigDecimal; + +/** + * CosFunction + * description: cos(numeric)--returns the cosine of numeric + */ +public class CosFunction implements ValueParser { + +private ValueParser numberParser; + +/** + * Constructor + * @param expr + */ +public CosFunction(Function expr) { +numberParser = OperatorTools.buildParser(expr.getParameters().getExpressions().get(0)); +} + +/** + * parse + * @param sourceData + * @param rowIndex + * @return + */ +@Override +public Object parse(SourceData sourceData, int rowIndex, Context context) { +Object numberObj = numberParser.parse(sourceData, rowIndex, context); +BigDecimal numberValue = OperatorTools.parseBigDecimal(numberObj); +return Math.cos(numberValue.doubleValue()); +} +} diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java index 200c5b9d17..4f29fba315 100644 --- a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java @@ -20,6 +20,7 @@ package org.apache.inlong.sdk.transform.process.operator; import org.apache.inlong.sdk.transform.process.function.AbsFunction; import org.apache.inlong.sdk.transform.process.function.CeilFunction; import org.apache.inlong.sdk.transform.process.function.ConcatFunction; +import org.apache.inlong.sdk.transform.process.function.CosFunction; import org.apache.inlong.sdk.transform.process.function.DateExtractFunction; import org.apache.inlong.sdk.transform.process.function.DateExtractFunction.DateExtractFunctionType; import org.apache.inlong.sdk.transform.process.function.DateFormatFunction; @@ -113,6 +114,7 @@ public class OperatorTools { functionMap.put("floor", FloorFunction::new); functionMap.put("sin", SinFunction::new); functionMap.put("sinh", SinhFunction::new); +functionMap.put("cos", CosFunction::new); functionMap.put("year", func -> new DateExtractFunction(DateExtractFunctionType.YEAR, func)); functionMap.put("quarter", func -> new DateExtractFunction(DateExtractFunctionType.QUARTER, func)); functionMap.put("month", func ->
Re: [PR] [INLONG-10287][Agent] Update the Redis Source [inlong]
justinwwhuang commented on code in PR #10801: URL: https://github.com/apache/inlong/pull/10801#discussion_r1721751409 ## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/RedisSource.java: ## @@ -84,6 +181,278 @@ public boolean sourceFinish() { @Override public boolean sourceExist() { -return false; +return true; +} + +private String getRedisUri() { +StringBuffer sb = new StringBuffer("redis://"); +sb.append(hostName).append(":").append(port); +sb.append("?"); +if (!StringUtils.isEmpty(authPassword)) { +sb.append("authPassword=").append(authPassword).append("&"); +} +if (!StringUtils.isEmpty(authUser)) { +sb.append("authUser=").append(authUser).append("&"); +} +if (!StringUtils.isEmpty(readTimeout)) { +sb.append("readTimeout=").append(readTimeout).append("&"); +} +if (ssl) { +sb.append("ssl=").append("yes").append("&"); +} +if (!StringUtils.isEmpty(snapShot)) { +sb.append("replOffset=").append(snapShot).append("&"); +} +if (!StringUtils.isEmpty(replId)) { +sb.append("replId=").append(replId).append("&"); +} +if (sb.charAt(sb.length() - 1) == '?' || sb.charAt(sb.length() - 1) == '&') { +sb.deleteCharAt(sb.length() - 1); +} +return sb.toString(); +} + +private void initReplicator() { +DefaultCommandParser defaultCommandParser = new DefaultCommandParser(); +redisReplicator.addCommandParser(CommandName.name("APPEND"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SADD"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HMSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIRE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIREAT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("GETSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PSETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETRANGE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HDEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LRem"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("ZREM"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RENAME"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PERSIST"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SELECT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHALL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHDB"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HINCRBY"), defaultCommandParser); +redisReplicator.addComman
Re: [PR] [INLONG-10287][Agent] Update the Redis Source [inlong]
emptyOVO commented on code in PR #10801: URL: https://github.com/apache/inlong/pull/10801#discussion_r1721832043 ## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/RedisSource.java: ## @@ -84,6 +181,278 @@ public boolean sourceFinish() { @Override public boolean sourceExist() { -return false; +return true; +} + +private String getRedisUri() { +StringBuffer sb = new StringBuffer("redis://"); +sb.append(hostName).append(":").append(port); +sb.append("?"); +if (!StringUtils.isEmpty(authPassword)) { +sb.append("authPassword=").append(authPassword).append("&"); +} +if (!StringUtils.isEmpty(authUser)) { +sb.append("authUser=").append(authUser).append("&"); +} +if (!StringUtils.isEmpty(readTimeout)) { +sb.append("readTimeout=").append(readTimeout).append("&"); +} +if (ssl) { +sb.append("ssl=").append("yes").append("&"); +} +if (!StringUtils.isEmpty(snapShot)) { +sb.append("replOffset=").append(snapShot).append("&"); +} +if (!StringUtils.isEmpty(replId)) { +sb.append("replId=").append(replId).append("&"); +} +if (sb.charAt(sb.length() - 1) == '?' || sb.charAt(sb.length() - 1) == '&') { +sb.deleteCharAt(sb.length() - 1); +} +return sb.toString(); +} + +private void initReplicator() { +DefaultCommandParser defaultCommandParser = new DefaultCommandParser(); +redisReplicator.addCommandParser(CommandName.name("APPEND"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SADD"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HMSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIRE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIREAT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("GETSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PSETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETRANGE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HDEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LRem"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("ZREM"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RENAME"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PERSIST"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SELECT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHALL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHDB"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HINCRBY"), defaultCommandParser); +redisReplicator.addCommandPars
Re: [PR] [INLONG-10287][Agent] Update the Redis Source [inlong]
emptyOVO commented on code in PR #10801: URL: https://github.com/apache/inlong/pull/10801#discussion_r1721832043 ## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/RedisSource.java: ## @@ -84,6 +181,278 @@ public boolean sourceFinish() { @Override public boolean sourceExist() { -return false; +return true; +} + +private String getRedisUri() { +StringBuffer sb = new StringBuffer("redis://"); +sb.append(hostName).append(":").append(port); +sb.append("?"); +if (!StringUtils.isEmpty(authPassword)) { +sb.append("authPassword=").append(authPassword).append("&"); +} +if (!StringUtils.isEmpty(authUser)) { +sb.append("authUser=").append(authUser).append("&"); +} +if (!StringUtils.isEmpty(readTimeout)) { +sb.append("readTimeout=").append(readTimeout).append("&"); +} +if (ssl) { +sb.append("ssl=").append("yes").append("&"); +} +if (!StringUtils.isEmpty(snapShot)) { +sb.append("replOffset=").append(snapShot).append("&"); +} +if (!StringUtils.isEmpty(replId)) { +sb.append("replId=").append(replId).append("&"); +} +if (sb.charAt(sb.length() - 1) == '?' || sb.charAt(sb.length() - 1) == '&') { +sb.deleteCharAt(sb.length() - 1); +} +return sb.toString(); +} + +private void initReplicator() { +DefaultCommandParser defaultCommandParser = new DefaultCommandParser(); +redisReplicator.addCommandParser(CommandName.name("APPEND"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SADD"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HMSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIRE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("EXPIREAT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("GETSET"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("MSETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PSETEX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETNX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SETRANGE"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HDEL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("LRem"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPOP"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSH"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RPUSHX"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("ZREM"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("RENAME"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECR"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("INCRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("DECRBY"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("PERSIST"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("SELECT"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHALL"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("FLUSHDB"), defaultCommandParser); +redisReplicator.addCommandParser(CommandName.name("HINCRBY"), defaultCommandParser); +redisReplicator.addCommandPars
Re: [I] [Feature][SDK] Transform support Replace function [inlong]
github-actions[bot] commented on issue #10816: URL: https://github.com/apache/inlong/issues/10816#issuecomment-2296781338 Hello @Ybsiz, thank you for opening your first issue in InLong 🧡 We will respond as soon as possible ⏳ If this is a bug report, please provide screenshots or error logs for us to reproduce your issue, so we can do our best to fix it. If you have any questions in the meantime, you can also ask us on the [InLong Discussions](https://github.com/apache/inlong/discussions) 🔍 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
wohainilaodou commented on code in PR #10782: URL: https://github.com/apache/inlong/pull/10782#discussion_r1722569928 ## inlong-dashboard/src/ui/locales/cn.json: ## @@ -411,7 +411,33 @@ "meta.Synchronize.GroupIdHelp": "数据流组 ID 与数据流 ID 默认相同", "meta.Synchronize.InlongGroupOwnersExtra": "责任人,可查看、修改数据同步信息", "meta.Synchronize.GroupOwners": "责任人", - "meta.Stream.StreamId": "数据流 ID", + "meta.Synchronize.SyncType": "同步类型", + "meta.Synchronize.RealTimeSync": "实时同步", + "meta.Synchronize.RealTime": "实时", + "meta.Synchronize.Offline": "离线", + "meta.Synchronize.OfflineSync": "离线同步", + "meta.Synchronize.SchedulingRules": "调度规则", + "meta.Synchronize.ScheduleType": "调度类型", + "meta.Synchronize.Conventional": "常规", + "meta.Synchronize.Crontab": "Crontab", + "meta.Synchronize.DelayTime": "延迟时间", + "meta.Synchronize.ScheduleUnit": "调度单位", + "meta.Synchronize.ScheduleUnit.Year": "年", + "meta.Synchronize.ScheduleUnit.Month": "月", + "meta.Synchronize.ScheduleUnit.Day": "天", + "meta.Synchronize.ScheduleUnit.Minute": "分钟", + "meta.Synchronize.ScheduleUnit.Hours": "小时", + "meta.Synchronize.ScheduleUnit.Single": "单次", + "meta.Synchronize.ScheduleInterval": "调度周期", + "meta.Synchronize.ValidTime": "有效时间", + "meta.Synchronize.CronExpression": "crontab表达式", Review Comment: done -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] [Feature][SDK] Transform SQL support Round function [inlong]
Zkplo commented on issue #10803: URL: https://github.com/apache/inlong/issues/10803#issuecomment-2297854082 > https://private-user-images.githubusercontent.com/48062889/358960411-394d1f0e-c1ca-479b-b871-39304d4d2d7b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMjE0NTQsIm5iZiI6MTcyNDEyMTE1NCwicGF0aCI6Ii80ODA2Mjg4OS8zNTg5NjA0MTEtMzk0ZDFmMGUtYzFjYS00NzliLWI4NzEtMzkzMDRkNGQyZDdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDAyMzIzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWViNzhhOWEzOTI3NzNjNjU3NzgwMDU2NTRlNmU0YTBiZTAzMTFlMjAwODc4ZGUyYTA1ODFiNjdjMmQ4ZGQ1YjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wTvpWhjT7Cdd0AR_LG_P_lXEGUCkdPlIOhLTH4bDmOM";> FYI, the pull request can be modified many times. You don't need to close and create a new pull request if you want to make some modificat ions. > 仅供参考,拉取请求可以修改多次。如果您想进行一些修改,则无需关闭并创建新的拉取请求。 Thank you for your suggestion. I will pay attention to it in the future. -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration [inlong]
dockerzhang merged PR #10782: URL: https://github.com/apache/inlong/pull/10782 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(inlong) branch master updated: [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration (#10782)
This is an automated email from the ASF dual-hosted git repository. dockerzhang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git The following commit(s) were added to refs/heads/master by this push: new 38d2cdb437 [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration (#10782) 38d2cdb437 is described below commit 38d2cdb4374951ee20bf2513d27da06faa7e Author: kamianlaida <165994047+wohainilao...@users.noreply.github.com> AuthorDate: Tue Aug 20 10:52:45 2024 +0800 [INLONG-10779][Dashboard] Data synchronization adds offline synchronization configuration (#10782) Co-authored-by: Charles Zhang --- .../src/plugins/sync/common/SyncDefaultInfo.ts | 170 + .../src/plugins/sync/common/SyncType.ts| 36 + inlong-dashboard/src/ui/locales/cn.json| 28 +++- inlong-dashboard/src/ui/locales/en.json| 26 .../src/ui/pages/SynchronizeDashboard/index.tsx| 19 ++- .../src/ui/pages/SynchronizeDetail/Info/config.tsx | 77 +- .../src/ui/pages/SynchronizeDetail/Info/index.tsx | 38 - 7 files changed, 384 insertions(+), 10 deletions(-) diff --git a/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts b/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts index 9e81013208..4e229a73f0 100644 --- a/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts +++ b/inlong-dashboard/src/plugins/sync/common/SyncDefaultInfo.ts @@ -24,11 +24,18 @@ import i18n from '@/i18n'; import UserSelect from '@/ui/components/UserSelect'; import { genStatusTag, statusList } from './status'; import { timestampFormat } from '@/core/utils'; +import { DatePicker, TimePicker } from 'antd'; +import dayjs from 'dayjs'; +import { inlongGroupModeList } from '@/plugins/sync/common/SyncType'; +import { range } from 'lodash'; const { I18nMap, I18n } = DataWithBackend; const { FieldList, FieldDecorator } = RenderRow; const { ColumnList, ColumnDecorator } = RenderList; +const format = 'HH:mm'; +const conventionalTimeFormat = '-MM-DD HH:mm'; + export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { static I18nMap = I18nMap; static FieldList = FieldList; @@ -87,7 +94,170 @@ export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList { }) @I18n('meta.Synchronize.SinkMultipleEnable') sinkMultipleEnable: boolean; + @FieldDecorator({ +type: 'radio', +initialValue: 1, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.RealTime'), + value: 1, +}, +{ + label: i18n.t('meta.Synchronize.Offline'), + value: 2, +}, + ], +}, + }) + @ColumnDecorator({ +width: 200, +render: text => inlongGroupModeList?.filter(item => item.value === text)?.[0]?.label, + }) + @I18n('meta.Synchronize.SyncType') + inlongGroupMode: Number; + @FieldDecorator({ +type: 'radio', +initialValue: 0, +visible: values => values.inlongGroupMode === 2, +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.Conventional'), + value: 0, +}, +{ + label: i18n.t('meta.Synchronize.Crontab'), + value: 1, +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleType') + scheduleType: Number; + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type: 'select', +initialValue: 'H', +name: 'scheduleUnit', +rules: [{ required: true }], +props: { + options: [ +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Year'), + value: 'Y', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Month'), + value: 'M', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Day'), + value: 'D', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Hours'), + value: 'H', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Minute'), + value: 'I', +}, +{ + label: i18n.t('meta.Synchronize.ScheduleUnit.Single'), + value: 'O', +}, + ], +}, + }) + @I18n('meta.Synchronize.ScheduleUnit') + scheduleUnit: String; + + @FieldDecorator({ +type: 'input', +initialValue: 0, +rules: [{ required: true, pattern: new RegExp(/^[0-9]\d*$/, 'g') }], +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +props: values => ({ + suffix: values.scheduleUnit, +}), + }) + @I18n('meta.Synchronize.ScheduleInterval') + scheduleInterval: number; + + @FieldDecorator({ +visible: values => values.inlongGroupMode === 2 && values.scheduleType === 0, +type:
Re: [PR] [INLONG-10803][SDK] Transform SQL support Round function [inlong]
luchunliang merged PR #10810: URL: https://github.com/apache/inlong/pull/10810 -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(inlong) branch master updated: [INLONG-10803][SDK] Transform SQL support Round function (#10810)
This is an automated email from the ASF dual-hosted git repository. luchunliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/inlong.git The following commit(s) were added to refs/heads/master by this push: new a46d4da26f [INLONG-10803][SDK] Transform SQL support Round function (#10810) a46d4da26f is described below commit a46d4da26fe04a8fc442d3ef009d140903c2ceab Author: Zkplo <87751516+zk...@users.noreply.github.com> AuthorDate: Tue Aug 20 10:57:20 2024 +0800 [INLONG-10803][SDK] Transform SQL support Round function (#10810) * [INLONG-10803][SDK] Transform SQL support Round function * [INLONG-10803][SDK] Transform SQL support Round function - Co-authored-by: ZKpLo <14148880+zk...@user.noreply.gitee.com> --- .../transform/process/function/RoundFunction.java | 60 ++ .../transform/process/operator/OperatorTools.java | 2 + .../TestTransformArithmeticFunctionsProcessor.java | 31 +++ 3 files changed, 93 insertions(+) diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RoundFunction.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RoundFunction.java new file mode 100644 index 00..ecad419635 --- /dev/null +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/RoundFunction.java @@ -0,0 +1,60 @@ +/* + * 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.sdk.transform.process.function; + +import org.apache.inlong.sdk.transform.decode.SourceData; +import org.apache.inlong.sdk.transform.process.Context; +import org.apache.inlong.sdk.transform.process.operator.OperatorTools; +import org.apache.inlong.sdk.transform.process.parser.ValueParser; + +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.Function; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.List; + +/** + * RoundFunction + * description: ROUND(x [,y]) -- Return the nearest integer to x, with optional parameter y indicating the number of decimal places to be rounded. If omitted, return the integer. + */ +public class RoundFunction implements ValueParser { + +private ValueParser numberParser; +private ValueParser reservedDigitsParser; + +public RoundFunction(Function expr) { +List expressions = expr.getParameters().getExpressions(); +numberParser = OperatorTools.buildParser(expressions.get(0)); +if (expressions.size() == 2) { +reservedDigitsParser = OperatorTools.buildParser(expressions.get(1)); +} +} + +@Override +public Object parse(SourceData sourceData, int rowIndex, Context context) { +Object numberObj = numberParser.parse(sourceData, rowIndex, context); +BigDecimal number = OperatorTools.parseBigDecimal(numberObj); +if (reservedDigitsParser != null) { +Object reservedDigitsObj = reservedDigitsParser.parse(sourceData, rowIndex, context); +int reservedDigits = OperatorTools.parseBigDecimal(reservedDigitsObj).intValue(); +return number.setScale(reservedDigits, RoundingMode.HALF_UP).doubleValue(); +} +return Math.round(number.doubleValue()); +} +} diff --git a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java index 4f29fba315..fe361263a4 100644 --- a/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java +++ b/inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/operator/OperatorTools.java @@ -34,6 +34,7 @@ import org.apache.inlong.sdk.transform.process.function.Log2Function; import org.apache.inlong.sdk.transform.process.function.LogFunction; import org.apache.inlong.sdk.transform.process.function.NowFunction; import org.apache.inlong.sdk.transform.process.function.PowerFunction; +import org.apache.inlong.sdk.transform.process.function.RoundFunction;
[PR] [INLONG-10809][SDK] Improvements to TypeConverter field types and CompareValue in OperatorTools [inlong]
Zkplo opened a new pull request, #10817: URL: https://github.com/apache/inlong/pull/10817 Fixes #10809 ### Motivation - Modified the SourceData interface to enable it to return multiple data types; Based on this, the CsvSourceData class was modified. - To enable the functionality of field types, modify the FieldInfo class to have a default TypeConverter. - Based on the TypeConverter interface, two converters, DoubleConverter and LongConverter, have been implemented. - In order to enable InLong Transform to parse floating-point data types in SQL statements, the DoubleParser class is added. - Modify the OperatorTool.compareValue method to align the types of both parties being compared. - Add IfFunction class for testing various classes of ExpressionOperator. ### Verifying this change *(Please pick either of the following options)* - [ ] This change is a trivial rework/code cleanup without any test coverage. - [x] 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* -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] [INLONG-10816][SDK] Transform support Replace function. [inlong]
Ybsiz opened a new pull request, #10818: URL: https://github.com/apache/inlong/pull/10818 Fixes #10816 ### Motivation Add one string function class:ReplaceFunction. Add the corresponding unit test codes ### Modifications ### Verifying this change *(Please pick either of the following options)* - [ ] This change is a trivial rework/code cleanup without any test coverage. - [X] 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* -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10816][SDK] Transform support Replace function. [inlong]
vernedeng commented on code in PR #10818: URL: https://github.com/apache/inlong/pull/10818#discussion_r1722748948 ## inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/ReplaceFunction.java: ## @@ -0,0 +1,61 @@ +/* + * 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.sdk.transform.process.function; + +import org.apache.inlong.sdk.transform.decode.SourceData; +import org.apache.inlong.sdk.transform.process.Context; +import org.apache.inlong.sdk.transform.process.operator.OperatorTools; +import org.apache.inlong.sdk.transform.process.parser.ValueParser; + +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.Function; + +import java.util.List; + +/** + * ReplaceFunction + * description: replace(s, s1, s2)--replace string s1 in string s with string s2. + */ +public class ReplaceFunction implements ValueParser { + +private ValueParser stringParser1; Review Comment: Use more specific variable names -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10816][SDK] Transform support Replace function. [inlong]
vernedeng commented on code in PR #10818: URL: https://github.com/apache/inlong/pull/10818#discussion_r1722749747 ## inlong-sdk/transform-sdk/src/main/java/org/apache/inlong/sdk/transform/process/function/ReplaceFunction.java: ## @@ -0,0 +1,61 @@ +/* + * 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.sdk.transform.process.function; + +import org.apache.inlong.sdk.transform.decode.SourceData; +import org.apache.inlong.sdk.transform.process.Context; +import org.apache.inlong.sdk.transform.process.operator.OperatorTools; +import org.apache.inlong.sdk.transform.process.parser.ValueParser; + +import net.sf.jsqlparser.expression.Expression; +import net.sf.jsqlparser.expression.Function; + +import java.util.List; + +/** + * ReplaceFunction + * description: replace(s, s1, s2)--replace string s1 in string s with string s2. + */ +public class ReplaceFunction implements ValueParser { + +private ValueParser stringParser1; +private ValueParser stringParser2; +private ValueParser stringParser3; + +/** + * Constructor + * @param expr + */ +public ReplaceFunction(Function expr) { +List expressions = expr.getParameters().getExpressions(); +stringParser1 = OperatorTools.buildParser(expressions.get(0)); +stringParser2 = OperatorTools.buildParser(expressions.get(1)); +stringParser3 = OperatorTools.buildParser(expressions.get(2)); +} + +@Override +public Object parse(SourceData sourceData, int rowIndex, Context context) { +Object stringObj1 = stringParser1.parse(sourceData, rowIndex, context); +Object stringObj2 = stringParser2.parse(sourceData, rowIndex, context); +Object stringObj3 = stringParser3.parse(sourceData, rowIndex, context); +String str1 = OperatorTools.parseString(stringObj1); +String str2 = OperatorTools.parseString(stringObj2); +String str3 = OperatorTools.parseString(stringObj3); +return str1.replace(str2.charAt(0), str3.charAt(0)); Review Comment: It's more like replace single char instead of a string -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [INLONG-10809][SDK] Improvements to TypeConverter field types and CompareValue in OperatorTools [inlong]
vernedeng commented on PR #10817: URL: https://github.com/apache/inlong/pull/10817#issuecomment-2298077804 please add more details about this issue -- 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-unsubscr...@inlong.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org