fix: issue-3425 Profiler: add test based on included datatype, issue-3407 Deleting column test shows blank in data-profiler for that column (#3429)

* fix: issue-3425 updated condition as per supported datatype
This commit is contained in:
Shailesh Parmar 2022-03-15 19:25:50 +05:30 committed by GitHub
parent 55c65b5c53
commit 0ab6b29738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 8 deletions

View File

@ -633,6 +633,7 @@ const DatasetDetails: React.FC<DatasetDetailsProps> = ({
constraint: col.constraint as string,
colName: col.name,
colType: col.dataTypeDisplay as string,
dataType: col.dataType as string,
colTests: col.columnTests,
}))}
qualityTestFormHandler={qualityTestFormHandler}

View File

@ -24,6 +24,7 @@ import {
ColumnTest,
DatasetTestModeType,
} from '../../interface/dataQuality.interface';
import { isColumnTestSupported } from '../../utils/EntityUtils';
import { getRoundedValue } from '../../utils/ProfilerUtils';
import { getConstraintIcon } from '../../utils/TableUtils';
import { Button } from '../buttons/Button/Button';
@ -37,6 +38,7 @@ type Props = {
constraint: string;
colName: string;
colType: string;
dataType: string;
colTests?: ColumnTest[];
}>;
qualityTestFormHandler: (
@ -246,7 +248,7 @@ const TableProfiler: FC<Props> = ({
colSpan={2}
data-testid="tableBody-cell">
<div className="tw-flex tw-justify-between">
{col.columnTests ? (
{col.columnTests?.length ? (
<div className="tw-rounded tw-max-h-44 tw-overflow-y-auto tw-flex-1">
{col.columnTests.map((m, i) => (
<div className="tw-flex tw-mb-2" key={i}>
@ -290,7 +292,7 @@ const TableProfiler: FC<Props> = ({
`No tests available`
)}
<div className="tw-self-center tw-ml-5">
{col.name.colType.includes('struct') ? (
{!isColumnTestSupported(col.name.dataType) ? (
<span>Not supported</span>
) : (
<NonAdminAction

View File

@ -17,3 +17,11 @@ export enum ConstraintTypes {
NOT_NULL = 'NOT_NULL',
UNIQUE = 'UNIQUE',
}
export enum PrimaryTableDataTypes {
VARCHAR = 'varchar',
TIMESTAMP = 'timestamp',
DATE = 'date',
NUMERIC = 'numeric',
BOOLEAN = 'boolean',
}

View File

@ -25,6 +25,7 @@ import {
import { ColumnTestType } from '../enums/columnTest.enum';
import { EntityType } from '../enums/entity.enum';
import { ServiceCategory } from '../enums/service.enum';
import { PrimaryTableDataTypes } from '../enums/table.enum';
import { Dashboard } from '../generated/entity/data/dashboard';
import { Pipeline } from '../generated/entity/data/pipeline';
import { Table } from '../generated/entity/data/table';
@ -525,3 +526,11 @@ export const filteredColumnTestOption = (dataType: string) => {
return Object.values(ColumnTestType);
}
};
export const isColumnTestSupported = (dataType: string) => {
const supportedType = Object.values(PrimaryTableDataTypes);
return supportedType.includes(
getDataTypeString(dataType) as PrimaryTableDataTypes
);
};

View File

@ -30,7 +30,7 @@ import {
} from '../constants/constants';
import { EntityType } from '../enums/entity.enum';
import { SearchIndex } from '../enums/search.enum';
import { ConstraintTypes } from '../enums/table.enum';
import { ConstraintTypes, PrimaryTableDataTypes } from '../enums/table.enum';
import { Column, DataType } from '../generated/entity/data/table';
import { TableTest, TestCaseStatus } from '../generated/tests/tableTest';
import { TagLabel } from '../generated/type/tagLabel';
@ -291,22 +291,22 @@ export const getDataTypeString = (dataType: string): string => {
case DataType.Mediumtext:
case DataType.Mediumblob:
case DataType.Blob:
return 'varchar';
return PrimaryTableDataTypes.VARCHAR;
case DataType.Timestamp:
case DataType.Time:
return 'timestamp';
return PrimaryTableDataTypes.TIMESTAMP;
case DataType.Date:
return 'date';
return PrimaryTableDataTypes.DATE;
case DataType.Int:
case DataType.Float:
case DataType.Smallint:
case DataType.Bigint:
case DataType.Numeric:
case DataType.Tinyint:
return 'numeric';
return PrimaryTableDataTypes.NUMERIC;
case DataType.Boolean:
case DataType.Enum:
return 'boolean';
return PrimaryTableDataTypes.BOOLEAN;
default:
return dataType;
}