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

[#5827] improvement(CLI): Fix CLI throws an obscure error when Delete a table with a missing table name #5906

Merged
merged 22 commits into from
Dec 23, 2024

Conversation

Abyss-lord
Copy link
Contributor

@Abyss-lord Abyss-lord commented Dec 18, 2024

What changes were proposed in this pull request?

Fix CLI throws an obscure error when Delete a table with a missing table name.it should give clearer hints.

Why are the changes needed?

Fix: #5827

Does this PR introduce any user-facing change?

NO

How was this patch tested?

local bash test

bin/gcli.sh table delete --metalake demo_metalake
Missing required argument(s): catalog, schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog
# output: Missing required argument(s): schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog.default
# output: Missing required argument(s): table

bin/gcli.sh table details --metalake demo_metalake --name Hive_catalog.default
# output
# Malformed entity name.
# Missing required argument(s): table

Unit test

add some test case to test whether the command fuse is executed correctly.

@Abyss-lord
Copy link
Contributor Author

hi @justinmclean @xunliu , Could you please take a look when you have time?

@justinmclean
Copy link
Member

justinmclean commented Dec 19, 2024

You can use @SuppressWarnings("DefaultCharset") on the added tests to fix the build issue.

Fix cli throws an obscure error when Delete a table with a missing table name.it should give clearer hints.
add some test case to test whether the command fuse is executed correctly
@Abyss-lord
Copy link
Contributor Author

You can use @SuppressWarnings("DefaultCharset") on the added tests to fix the build issue.

thank you, @justinmclean plz review this again

@justinmclean
Copy link
Member

Is this the current output?

bin/gcli.sh table delete --metalake demo_metalake
# output: Missing required argument(s): catalog, schema

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog
# output: Missing required argument(s): schema

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog.default
# output: Missing required argument(s): table

If so, the first two errors are not entirely correct, and they are missing the table name as well. It is also not really missing an argument just part of one.

add some test case to test whether the command fuse is executed correctly
@Abyss-lord
Copy link
Contributor Author

Abyss-lord commented Dec 19, 2024

Is this the current output?

bin/gcli.sh table delete --metalake demo_metalake
# output: Missing required argument(s): catalog, schema

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog
# output: Missing required argument(s): schema

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog.default
# output: Missing required argument(s): table

If so, the first two errors are not entirely correct, and they are missing the table name as well. It is also not really missing an argument just part of one.

fix, thank you

justinmclean
justinmclean previously approved these changes Dec 20, 2024
Copy link
Member

@justinmclean justinmclean 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 these changes.

Abyss-lord and others added 2 commits December 22, 2024 12:25
move handling of LIST command "back" to the switch case and fix the test case.
@Abyss-lord
Copy link
Contributor Author

Hi @justinmclean , I’ve finished updating the code. Please take a look at the PR again when you have time.

Copy link
Member

@justinmclean justinmclean left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@justinmclean justinmclean merged commit 2786436 into apache:main Dec 23, 2024
25 checks passed
@Abyss-lord Abyss-lord deleted the fix-delete-table branch December 23, 2024 08:03
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this pull request Dec 23, 2024
…Delete a table with a missing table name (apache#5906)

### What changes were proposed in this pull request?

Fix CLI throws an obscure error when Delete a table with a missing table
name.it should give clearer hints.

### Why are the changes needed?

Fix: apache#5827 

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

#### local bash test

```bash
bin/gcli.sh table delete --metalake demo_metalake
Missing required argument(s): catalog, schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog
# output: Missing required argument(s): schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog.default
# output: Missing required argument(s): table

bin/gcli.sh table details --metalake demo_metalake --name Hive_catalog.default
# output
# Malformed entity name.
# Missing required argument(s): table
```

#### Unit test

add some test case to test whether the command fuse is executed
correctly.
justinmclean pushed a commit that referenced this pull request Dec 25, 2024
… methods (#5972)

### What changes were proposed in this pull request?

refactor the validation logic of all entities and add test case, just
like validation of table command #5906 . A hint is provided when the
user's output is missing the required arguments. for example:

```bash
gcli column list -m demo_metalake, --name Hive_catalog
# Malformed entity name.
# Missing required argument(s): schema, table

gcli column details -m demo_metalake, --name Hive_catalog --audit
# Malformed entity name.
# Missing required argument(s): schema, table, column

gcli user delete -m demo_metalake
Missing --user option.
```
Currently, the Role command needs to be refactored and opened as a
separate issue

### Why are the changes needed?

Fix: #5861 

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

local test
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this pull request Dec 29, 2024
…Delete a table with a missing table name (apache#5906)

### What changes were proposed in this pull request?

Fix CLI throws an obscure error when Delete a table with a missing table
name.it should give clearer hints.

### Why are the changes needed?

Fix: apache#5827 

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

#### local bash test

```bash
bin/gcli.sh table delete --metalake demo_metalake
Missing required argument(s): catalog, schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog
# output: Missing required argument(s): schema, table

bin/gcli.sh table delete --metalake demo_metalake --name Hive_catalog.default
# output: Missing required argument(s): table

bin/gcli.sh table details --metalake demo_metalake --name Hive_catalog.default
# output
# Malformed entity name.
# Missing required argument(s): table
```

#### Unit test

add some test case to test whether the command fuse is executed
correctly.
Abyss-lord added a commit to Abyss-lord/gravitino that referenced this pull request Dec 29, 2024
…handle methods (apache#5972)

### What changes were proposed in this pull request?

refactor the validation logic of all entities and add test case, just
like validation of table command apache#5906 . A hint is provided when the
user's output is missing the required arguments. for example:

```bash
gcli column list -m demo_metalake, --name Hive_catalog
# Malformed entity name.
# Missing required argument(s): schema, table

gcli column details -m demo_metalake, --name Hive_catalog --audit
# Malformed entity name.
# Missing required argument(s): schema, table, column

gcli user delete -m demo_metalake
Missing --user option.
```
Currently, the Role command needs to be refactored and opened as a
separate issue

### Why are the changes needed?

Fix: apache#5861 

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

local test
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.

[Improvement] Delete a table with a missing table name causes an obscure error in the Gravitino CLI
2 participants