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/07/06 07:50:04 UTC

[GitHub] [inlong] bluewang opened a new pull request, #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - Title Example: [INLONG-XYZ][Component] Title of the pull request
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
   
   - Fixes https://github.com/apache/inlong/issues/4885
   
   ### 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] [inlong] leezng merged pull request #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


-- 
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 #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


##########
inlong-dashboard/src/locales/en.json:
##########
@@ -119,6 +119,11 @@
   "components.AccessHelper.StorageMetaData.Iceberg.FieldType": "FieldType",
   "components.AccessHelper.StorageMetaData.Iceberg.FieldDescription": "FieldDescription",
   "components.AccessHelper.StorageMetaData.Iceberg.PartitionStrategy": "PartitionStrategy",
+  "components.AccessHelper.StorageMetaData.Greenplum.TableName": "TableName",
+  "components.AccessHelper.StorageMetaData.Greenplum.FlushInterval": "FlushInterval",
+  "components.AccessHelper.StorageMetaData.Greenplum.FlushIntervalUnit": "S",
+  "components.AccessHelper.StorageMetaData.Greenplum.RetryTimes": "RetryTimes",
+  "components.AccessHelper.StorageMetaData.Greenplum.RetryTimesUnit": "items",

Review Comment:
   `次` should translate to `times`.



-- 
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 #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


##########
inlong-dashboard/src/components/MetaData/StorageGreenplum.tsx:
##########
@@ -0,0 +1,282 @@
+/*

Review Comment:
   Suggest changing the file name to `SinkGreenplum`, because the backend naming is `XxxSink`.



-- 
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 #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


##########
inlong-dashboard/src/components/MetaData/StorageGreenplum.tsx:
##########
@@ -0,0 +1,282 @@
+/*

Review Comment:
   Okay.



-- 
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] leezng commented on a diff in pull request #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


##########
inlong-dashboard/src/components/MetaData/StorageGreenplum.tsx:
##########
@@ -0,0 +1,282 @@
+/*

Review Comment:
   I think don't change this first, there are others such as hive, and then switch them together later, otherwise it will be a bit untidy. @bluewang @healchow 



-- 
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] leezng commented on a diff in pull request #4887: [INLONG-4885][Dashboard] Support Greenplum Sink

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


##########
inlong-dashboard/src/components/MetaData/SinkGreenplum.tsx:
##########
@@ -0,0 +1,239 @@
+/*
+ * 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.
+ */
+
+import React from 'react';
+import {
+  getColsFromFields,
+  GetStorageColumnsType,
+  GetStorageFormFieldsType,
+} from '@/utils/metaData';
+import { ColumnsType } from 'antd/es/table';
+import EditableTable, { ColumnsItemProps } from '@/components/EditableTable';
+import i18n from '@/i18n';
+import { excludeObject } from '@/utils';
+import { sourceDataFields } from './SourceDataFields';
+
+// greenplumFieldTypes
+const greenplumFieldTypes = [
+  'string',
+  'varchar',
+  'char',
+  'tinyint',
+  'smallint',
+  'int',
+  'bigint',
+  'float',
+  'double',
+  'decimal',
+  'numeric',
+  'boolean',
+  'binary',
+  'timestamp',
+  'date',
+  // 'interval',
+].map(item => ({
+  label: item,
+  value: item,
+}));
+
+const getForm: GetStorageFormFieldsType = (
+  type,
+  { currentValues, inlongGroupId, isEdit, dataType, form } = {} as any,
+) => {
+  const fileds = [
+    {
+      type: 'input',
+      label: 'JDBC URL',
+      name: 'jdbcUrl',
+      rules: [{ required: true }],
+      props: {
+        placeholder: 'jdbc:postgresql://127.0.0.1:5432/write',
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+        style: { width: 500 },
+      },
+    },
+    {
+      type: 'input',
+      label: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.TableName'),
+      name: 'tableName',
+      rules: [{ required: true }],
+      props: {
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+      },
+      _inTable: true,
+    },
+    {
+      type: 'radio',
+      label: i18n.t('components.AccessHelper.StorageMetaData.EnableCreateResource'),
+      name: 'enableCreateResource',
+      rules: [{ required: true }],
+      initialValue: 1,
+      tooltip: i18n.t('components.AccessHelper.StorageMetaData.EnableCreateResourceHelp'),
+      props: {
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+        options: [
+          {
+            label: i18n.t('basic.Yes'),
+            value: 1,
+          },
+          {
+            label: i18n.t('basic.No'),
+            value: 0,
+          },
+        ],
+      },
+    },
+    {
+      type: 'input',
+      label: i18n.t('components.AccessHelper.StorageMetaData.Username'),
+      name: 'username',
+      rules: [{ required: true }],
+      props: {
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+      },
+      _inTable: true,
+    },
+    {
+      type: 'password',
+      label: i18n.t('components.AccessHelper.StorageMetaData.Password'),
+      name: 'password',
+      rules: [{ required: true }],
+      props: {
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+        style: {
+          maxWidth: 500,
+        },
+      },
+    },
+    {
+      name: 'flushInterval',
+      type: 'inputnumber',
+      label: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.FlushInterval'),
+      initialValue: 1,
+      props: {
+        min: 1,
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+      },
+      rules: [{ required: true }],
+      suffix: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.FlushIntervalUnit'),
+    },
+    {
+      name: 'retryTime',
+      type: 'inputnumber',
+      label: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.RetryTimes'),
+      initialValue: 3,
+      props: {
+        min: 1,
+        disabled: isEdit && [110, 130].includes(currentValues?.status),
+      },
+      rules: [{ required: true }],
+      suffix: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.RetryTimesUnit'),
+    },
+    {
+      type: (
+        <EditableTable
+          size="small"
+          columns={getFieldListColumns(dataType, currentValues)}
+          canDelete={(record, idx, isNew) => !isEdit || isNew}
+        />
+      ),
+      name: 'sinkFieldList',
+    },
+  ];
+
+  return type === 'col'
+    ? getColsFromFields(fileds)
+    : fileds.map(item => excludeObject(['_inTable'], item));
+};
+
+const getFieldListColumns: GetStorageColumnsType = (dataType, currentValues) => {
+  return [
+    ...sourceDataFields,
+    {
+      title: `GREENPLUM${i18n.t('components.AccessHelper.StorageMetaData.Greenplum.FieldName')}`,
+      dataIndex: 'fieldName',
+      initialValue: '',
+      rules: [
+        { required: true },
+        {
+          pattern: /^[a-z][0-9a-z_]*$/,
+          message: i18n.t('components.AccessHelper.StorageMetaData.Greenplum.FieldNameRule'),
+        },
+      ],
+      props: (text, record, idx, isNew) => ({
+        disabled: [110, 130].includes(currentValues?.status as number) && !isNew,
+      }),
+    },
+    {
+      title: `GREENPLUM${i18n.t('components.AccessHelper.StorageMetaData.Greenplum.FieldType')}`,
+      dataIndex: 'fieldType',
+      initialValue: greenplumFieldTypes[0].value,
+      type: 'select',
+      width: '115px',

Review Comment:
   no need width



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