Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ingest/presto-on-hive): enable partition key for presto-on-hive #8380

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a2522af
feat(ingest): enable partition key for presto-on-hive
zheyu001 Jul 7, 2023
234d392
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 7, 2023
74dd61a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
hsheth2 Jul 7, 2023
d33e3d1
style(ingest/presto-on-hive): fix python format
zheyu001 Jul 8, 2023
9c953c6
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 8, 2023
7ab6672
style(datahub-web-react): fix tsx style, typo
zheyu001 Jul 8, 2023
28562d4
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 11, 2023
c0a3639
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 11, 2023
289ab6c
test(ingest): fix test mce golden
zheyu001 Jul 12, 2023
cb1a6e5
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 12, 2023
3a9e44c
test(webreact): fix test
zheyu001 Jul 12, 2023
3b5aaf4
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 12, 2023
83ffc5a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 13, 2023
600e891
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 17, 2023
4f9d00a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 19, 2023
167cc93
test(webreact): revert timeout extension
zheyu001 Jul 20, 2023
79954d6
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 20, 2023
004f060
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 20, 2023
be40198
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
asikowitz Jul 20, 2023
40e3c5a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
asikowitz Jul 21, 2023
8477512
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 25, 2023
95f406a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 25, 2023
1362ab2
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 26, 2023
8632f67
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
anshbansal Jul 30, 2023
33d9bbb
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
zheyu001 Jul 31, 2023
0b7aece
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
anshbansal Aug 1, 2023
b4fd94a
Merge branch 'master' into feature/enable-partition-key-for-presto-on…
anshbansal Aug 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public SchemaField apply(@Nonnull final com.linkedin.schema.SchemaField input, @
result.setGlossaryTerms(GlossaryTermsMapper.map(input.getGlossaryTerms(), entityUrn));
}
result.setIsPartOfKey(input.isIsPartOfKey());
result.setIsPartitioningKey(input.isIsPartitioningKey());
return result;
}

Expand Down
5 changes: 5 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2872,6 +2872,11 @@ type SchemaField {
Whether the field is part of a key schema
"""
isPartOfKey: Boolean

"""
Whether the field is part of a partitioning key schema
"""
isPartitioningKey: Boolean
}

"""
Expand Down
2 changes: 2 additions & 0 deletions datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ export const dataset3WithSchema = {
type: SchemaFieldDataType.String,
nativeDataType: 'varchar(100)',
isPartOfKey: false,
isPartitioningKey: false,
jsonPath: null,
globalTags: null,
glossaryTerms: null,
Expand All @@ -563,6 +564,7 @@ export const dataset3WithSchema = {
type: SchemaFieldDataType.String,
nativeDataType: 'boolean',
isPartOfKey: false,
isPartitioningKey: false,
jsonPath: null,
globalTags: null,
glossaryTerms: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ExtendedSchemaFields } from './types';
import TypeLabel from '../../../../shared/tabs/Dataset/Schema/components/TypeLabel';
import { ForeignKeyConstraint, SchemaMetadata } from '../../../../../../types.generated';
import PrimaryKeyLabel from '../../../../shared/tabs/Dataset/Schema/components/PrimaryKeyLabel';
import PartitioningKeyLabel from '../../../../shared/tabs/Dataset/Schema/components/PartitioningKeyLabel';
import NullableLabel from '../../../../shared/tabs/Dataset/Schema/components/NullableLabel';
import ForeignKeyLabel from '../../../../shared/tabs/Dataset/Schema/components/ForeignKeyLabel';

Expand Down Expand Up @@ -62,6 +63,7 @@ export default function useSchemaTitleRenderer(
</FieldPathText>
<TypeLabel type={record.type} nativeDataType={record.nativeDataType} />
{(schemaMetadata?.primaryKeys?.includes(fieldPath) || record.isPartOfKey) && <PrimaryKeyLabel />}
{record.isPartitioningKey && <PartitioningKeyLabel />}
{record.nullable && <NullableLabel />}
{schemaMetadata?.foreignKeys
?.filter(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { Badge } from 'antd';
import styled from 'styled-components';
import { blue } from '@ant-design/colors';
import { ANTD_GRAY } from '../../../../constants';

const PartitioningKeyBadge = styled(Badge)`
margin-left: 4px;
&&& .ant-badge-count {
background-color: ${ANTD_GRAY[1]};
color: ${blue[5]};
border: 1px solid ${blue[2]};
font-size: 12px;
font-weight: 400;
height: 22px;
}
`;

export default function PartitioningKeyLabel() {
return <PartitioningKeyBadge count="Partition Key" />;
}
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/fragments.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ fragment schemaFieldFields on SchemaField {
nativeDataType
recursive
isPartOfKey
isPartitioningKey
globalTags {
...globalTagsFields
}
Expand Down
1 change: 1 addition & 0 deletions datahub-web-react/src/graphql/versionedDataset.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ query getVersionedDataset($urn: String!, $versionStamp: String) {
nativeDataType
recursive
isPartOfKey
isPartitioningKey
}
lastObserved
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ def loop_tables(
# add table schema fields
schema_fields = self.get_schema_fields(dataset_name, columns)

self._set_partition_key(columns, schema_fields)

schema_metadata = get_schema_metadata(
self.report,
dataset_name,
Expand Down Expand Up @@ -881,6 +883,18 @@ def get_schema_fields_for_column(
default_nullable=True,
)

def _set_partition_key(self, columns, schema_fields):
if len(columns) > 0:
partition_key_names = set()
for column in columns:
if column["is_partition_col"]:
partition_key_names.add(column["col_name"])

for schema_field in schema_fields:
name = schema_field.fieldPath.split(".")[-1]
if name in partition_key_names:
schema_field.isPartitioningKey = True


class SQLAlchemyClient:
def __init__(self, config: SQLAlchemyConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false,
"isPartitioningKey": true,
"jsonProps": "{\"native_data_type\": \"string\", \"_nullable\": true}"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false,
"isPartitioningKey": true,
"jsonProps": "{\"native_data_type\": \"string\", \"_nullable\": true}"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false,
"isPartitioningKey": true,
"jsonProps": "{\"native_data_type\": \"string\", \"_nullable\": true}"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@
"nativeDataType": "string",
"recursive": false,
"isPartOfKey": false,
"isPartitioningKey": true,
"jsonProps": "{\"native_data_type\": \"string\", \"_nullable\": true}"
},
{
Expand Down
Loading