You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ne...@apache.org on 2021/01/18 21:07:39 UTC

[incubator-pinot] branch master updated: setting default Data Type while setting type in Add Schema dialog (#6452)

This is an automated email from the ASF dual-hosted git repository.

nehapawar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 8085fb7  setting default Data Type while setting type in Add Schema dialog (#6452)
8085fb7 is described below

commit 8085fb76f8a70eb5bc6326850fcc735fe955d98b
Author: Sanket Shah <sh...@users.noreply.github.com>
AuthorDate: Tue Jan 19 02:37:23 2021 +0530

    setting default Data Type while setting type in Add Schema dialog (#6452)
---
 .../Homepage/Operations/SchemaComponent.tsx        | 42 +++++++++++++++++++---
 1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/pinot-controller/src/main/resources/app/components/Homepage/Operations/SchemaComponent.tsx b/pinot-controller/src/main/resources/app/components/Homepage/Operations/SchemaComponent.tsx
index 69ccb5b..0c0132b 100644
--- a/pinot-controller/src/main/resources/app/components/Homepage/Operations/SchemaComponent.tsx
+++ b/pinot-controller/src/main/resources/app/components/Homepage/Operations/SchemaComponent.tsx
@@ -84,10 +84,7 @@ export default function SchemaComponent({
   schemaObj,
 }: Props) {
   const classes = useStyles();
-  const defaultColumnObj = {
-    columnName: '',
-    type: '',
-    dataType: '',
+  const defaultOptionalColumnObj = {
     multiValue: 'false',
     maxLength: '',
     virtualColumnProvider: '',
@@ -98,6 +95,12 @@ export default function SchemaComponent({
     granularityUnit: '',
     granularityInterval: ''
   };
+  const defaultColumnObj = {
+    columnName: '',
+    type: '',
+    dataType: '',
+    ...defaultOptionalColumnObj
+  };
   const defaultSchemaObj = {
     schemaName,
     dimensionFieldSpecs: [],
@@ -109,12 +112,43 @@ export default function SchemaComponent({
     metric: ["INT", "LONG", "DOUBLE", "FLOAT", "BYTES"],
     datetime: ["STRING", "INT", "LONG"]
   };
+  const preFilledData = {
+    dimension: {
+      dataType: "STRING",
+      multiValue: "false"
+    },
+    metric: {
+      dataType: "LONG"
+    },
+    datetime: {
+      dataType: "LONG",
+      timeUnit: "MILLISECONDS",
+      timeFormat: "EPOCH",
+      granularityInterval: "1",
+      granularityUnit: "MILLISECONDS"
+    },
+  };
   
   const [columnList, setColumnList] = useState([{...defaultColumnObj}]);
 
+  const setPreFilledData = (index, fieldName, value, colList) => {
+    switch (fieldName) {
+      case "type": {
+        colList[index] = {
+          ...colList[index],
+          ...defaultOptionalColumnObj,
+          ...preFilledData[value]
+        }
+
+        break;
+      }
+    }
+  }
+
   const changeHandler = (index, fieldName, value) => {
     let newColumnList = [...columnList];
     newColumnList[index][fieldName] = value;
+    setPreFilledData(index, fieldName, value, newColumnList);
     setColumnList(newColumnList);
   };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org