Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ShuchiZhang
Copy link
Contributor

We add an icon for artition keys in hive tables. The partition_keys are parsed by the hive loader. We left place for other loaders to put partition keys in the base_metastore_loader as well. The icon for partition keys should be like:
image

@ShuchiZhang ShuchiZhang force-pushed the paitition-key-icon branch 4 times, most recently from ad9fc58 to cdb1b64 Compare August 19, 2022 17:59
Copy link
Collaborator

@czgu czgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for making this PR, added some minor comments

total_size = int(total_size) if total_size is not None else None

raw_description = ujson.pdumps(description, default=lambda o: o.__dict__)
partition_keys = get_partition_keys(raw_description)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not operate on description directly? so you don't need to do json dump/load

raw_description: str = None

# Arrays of partition keys
partition_keys: List = []
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List[str]?

earliest_partitions = sql.Column(sql.String(description_length))
description = sql.Column(sql.Text(length=mediumtext_length))
hive_metastore_description = sql.Column(sql.Text(length=mediumtext_length))
partition_keys = sql.Column(sql.Text(length=mediumtext_length))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use sql.JSON instead? I am thinking we can use a generic column to store these kind of information.
something like

column_info = sql.Column(sql.JSON)

that way, we can include something like
{
partition_keys: ['colA', 'colB']
}

and in future it is extensible for primary keys, foreign keys for tables that's applicable

hollow?: boolean;
}

export const ColumnIcon: React.FunctionComponent<IColumnIconProps> = ({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a bit of overkill to have a helper component in ui/, can you put it under DataTableViewMini/?

export interface IColumnIconProps {
name?: AllLucideIconNames;
tooltip?: string;
hollow?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use fill instead? or just pass props from this component to the Icon component? so there is no flip of variables

@ShuchiZhang ShuchiZhang force-pushed the paitition-key-icon branch 5 times, most recently from 1b5f374 to c5da338 Compare August 24, 2022 05:04
@ShuchiZhang
Copy link
Contributor Author

@czgu Great suggestion, updated!

Copy link
Collaborator

@czgu czgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just 2 small nit

partition_key.name
for partition_key in hive_metastore_description.partitionKeys
]
except ValueError:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think any of the action here would raise value error? if anything it would be AttributeError right

)

partition_keys_string = "\n".join(partition_keys)
column_infomation = {"partition_keys": partition_keys_string}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{"partition_keys": partition_keys}

@ShuchiZhang
Copy link
Contributor Author

LGTM, just 2 small nit

Updated!

data_table_id, session=session
)

column_infomation = {"partition_keys": partition_keys}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column_infomation = None
if partition_keys:
    column_infomation = {"partition_keys": partition_keys}

const { table, schema, tableColumns, getTable } = useDataTable(tableId);

const renderPanelView = () => {
const partitionKeyList = table.column_info
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const partitionKeyList = table.column_info?.partition_keys ?? [];

earliest_partitions: string;
description: string | ContentState;
hive_metastore_description: string;
column_info: Record<string, string[]>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

column_info?: {
    partition_keys?: string[];
}

@ShuchiZhang
Copy link
Contributor Author

@czgu Thanks for the advice!

Copy link
Collaborator

@czgu czgu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome job, thank you for adding this!

@czgu czgu merged commit ca62466 into pinterest:master Aug 26, 2022
lilyli9 pushed a commit to lilyli9/querybook that referenced this pull request Jan 26, 2023
## [0.20.0](https://github.expedia.biz/eg-analytics-platform/querybook/compare/0.19.1...0.20.0) (2022-09-08)

### Features

* (experimental) add Query transpilation to Querybook (pinterest#988) ([cbf650a](https://github.expedia.biz/eg-analytics-platform/querybook/commit/cbf650a7f0a5dbae16419b0c05f50adf043d3c0d))
* Add a new API of syncing a table from metastore (pinterest#982) ([c0e1dec](https://github.expedia.biz/eg-analytics-platform/querybook/commit/c0e1decfe69cd5919779d7b5504e6c9d516ad76e))
* add icon for partition keys (pinterest#977) ([ca62466](https://github.expedia.biz/eg-analytics-platform/querybook/commit/ca62466b853eb1b3d2523bcabb44d49eafc000e6))
* add query validation to querybook (pinterest#984) ([7069dac](https://github.expedia.biz/eg-analytics-platform/querybook/commit/7069dac81169dacea27f884e770dce079e38d469))
* add support of syncing table/column description from metastore (pinterest#980) ([b8a3eb5](https://github.expedia.biz/eg-analytics-platform/querybook/commit/b8a3eb576a0039b66e8838f20bd1b3ceeae0bd94))
* improve table upload with managed/external (pinterest#979) ([156d020](https://github.expedia.biz/eg-analytics-platform/querybook/commit/156d02086d7363757a52b1b34db8199c6fe40c50))
* Merge remote-tracking branch 'upstream/master' ([394f0da](https://github.expedia.biz/eg-analytics-platform/querybook/commit/394f0daf3e9805358026d591066e63b636e56041))

### Bug Fixes

* column icon css for partition keys (pinterest#987) ([6b08a88](https://github.expedia.biz/eg-analytics-platform/querybook/commit/6b08a88d97fd515c2d74fde10d5b13f6a2a92bbf))
* **DataDoc:** Use Previous Query Engine (pinterest#983) ([1ef498b](https://github.expedia.biz/eg-analytics-platform/querybook/commit/1ef498be2c1e4924c00bce652b0c21f2cea1058d))
* docs website failed to build (pinterest#981) ([970628d](https://github.expedia.biz/eg-analytics-platform/querybook/commit/970628df6ec51b0f907b8ce00ab9e073ff0222f9))
* overflow in raw metastore info (pinterest#976) ([339b2ce](https://github.expedia.biz/eg-analytics-platform/querybook/commit/339b2cee4c7f9d1bc0ca2cafb414a9be40130325))
* scatter/bubble charts were losing their labels after save (pinterest#985) ([0ae4659](https://github.expedia.biz/eg-analytics-platform/querybook/commit/0ae46596480e158c4466e0fee531c4c290207fe4))
rohan-sh1 pushed a commit to CAI-TECHNOLOGIES/cai-ext-db-explorer that referenced this pull request Feb 28, 2023
* feat: add icon for partition keys

* feat: add column info for tables

Co-authored-by: shuczhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants