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

Adding some options multiple times to the command-line ends up with a list of values in config #166

Open
jkovacs-hwx opened this issue Jan 13, 2025 · 3 comments

Comments

@jkovacs-hwx
Copy link

E.g. using

hms-mirror  \
--external-warehouse-directory /warehouse/tablespace/external/hive \
... \
--external-warehouse-directory /warehouse/tablespace/external/hive \
...

ends up with a config value:

externalDirectory: "/warehouse/tablespace/external/hive,/warehouse/tablespace/external/hive"

...which could cause issues at runtime.

Command should either fail or should use only the last defined value for configs that should have single values.

@dstreev
Copy link
Collaborator

dstreev commented Jan 19, 2025

This looks like a bug in the commons-cli library where the values are combined even though the option has been configured to accept only 1 argument.

@jkovacs-hwx
Copy link
Author

I wasn't sure how these are picked up but tested and found that unfortunately used as a single value:
Using:

  --external-warehouse-directory /data/hive/external --warehouse-directory /data/hive/managed \
  --external-warehouse-directory /data/hive/external --warehouse-directory /data/hive/managed

Got in session-config.yaml:

  warehouse:
    source: "GLOBAL"
    externalDirectory: "/data/hive/external,/data/hive/external"
    managedDirectory: "/data/hive/managed,/data/hive/managed"

and in RIGHT_execute.sql:

-- Alter Database Location
ALTER DATABASE mydb SET LOCATION "hdfs://cdpprod/data/hive/external,/data/hive/external/hive";
-- Alter Database Managed Location
ALTER DATABASE mydb SET MANAGEDLOCATION "hdfs://cdpprod/data/hive/managed,/data/hive/managed/mydb";

@dstreev
Copy link
Collaborator

dstreev commented Jan 20, 2025

Yes, agreed. In my tests it looks like the commons-cli library is picking up both values and combining them before I intercept them for evaluation.

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

No branches or pull requests

2 participants