You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Peter Vary (JIRA)" <ji...@apache.org> on 2016/08/01 10:21:20 UTC

[jira] [Commented] (HIVE-14374) BeeLine argument, and configuration handling cleanup

    [ https://issues.apache.org/jira/browse/HIVE-14374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15401797#comment-15401797 ] 

Peter Vary commented on HIVE-14374:
-----------------------------------

Hi,

I have collected the configuration variables:

{panel:title=Wiki}
-u, -r, -n, -p, -d, -e, -f, -w --password-file, --hiveconf, --hivevar, --color, --showHeader, --headerInterval, --fastConnect, --autoCommit, --verbose, --showWarnings, --showDbInPrompt, --showNestedErrs, --numberFormat, --force, --maxWidth, --maxColumnWidth, --silent, --autosave, --outputformat, --truncateTable, --delimiterForDSV, --isolation, --nullemptystring, --incremental, --help
{panel}

{panel:title=Help text - beeline mode}
-u, -r, -n, -p, -d, -i, -e, -f, -w --password-file, --hiveconf, --hivevar, --property-file, --color, --showHeader, --headerInterval, --fastConnect, --autoCommit, --verbose, --showWarnings, --showDbInPrompt, --showNestedErrs, --numberFormat, --force, --maxWidth, --maxColumnWidth, --silent, --autosave, --outputformat, --incremental, --truncateTable, --delimiterForDSV, --isolation, --nullemptystring, --addlocaldriverjar, --addlocaldrivername, --showConnectedUrl, --help
{panel}

{panel:title=Help text - compatibility mode}
Generated from code, so the same as below
{panel}

{panel:title=Code - beeline compatibility mode}
-database, -e, -f, -i, --hiveconf, --hivevar, -d --define, -S| --silent, -v| --verbose, -H| --help

{panel}

{panel:title=Code - beeline beeline mode}
-d, -u, -r, -n, -p, -w --password-file, -a, -i, -e, -f, -help, --hivevar, --hiveconf, --property-file
+ all of the configuration file options
{panel}

{panel:title=Configuration file - beeline beeline mode}
headerinterval, fastconnect, incremental, outputformat, autosave, entirelineascommand, authtype, delimiterfordsv, force, initfiles, showconnectedurl, maxheight, maxcolumnwidth, numberformat, timeout, showelapsedtime, verbose, showwarnings, hivevariables, lastconnectedurl, truncatetable, isolation, nullemptystring, trimscripts, showdbinprompt, scriptfile, color, shownestederrs, showheader, autocommit, hiveconfvariables, historyfile
{panel}


> BeeLine argument, and configuration handling cleanup
> ----------------------------------------------------
>
>                 Key: HIVE-14374
>                 URL: https://issues.apache.org/jira/browse/HIVE-14374
>             Project: Hive
>          Issue Type: Improvement
>          Components: Beeline
>    Affects Versions: 2.2.0
>            Reporter: Peter Vary
>            Assignee: Peter Vary
>
> BeeLine uses reflection, to set the BeeLineOpts attributes when parsing command line arguments, and when loading the configuration file.
> This means, that creating a setXXX, getXXX method in BeeLineOpts is a potential risk of exposing an attribute for the user unintentionally. There is a possibility to exclude an attribute from saving the value in the configuration file with the Ignore annotation. This does not restrict the loading or command line setting of these parameters which means there are many undocumented "features" as-is, like setting the lastConnectedUrl, allowMultilineCommand, maxHeight, trimScripts, etc. from command line.
> This part of the code needs a little cleanup.
> I think we should make this exposure more explicit, and be able to differentiate the configurable options depending on the source (command line, and configuration file), so I propose to create a mechanism to tell explicitly which BeeLineOpts attributes are settable by command line, and configuration file, and every other attribute should be inaccessible by the user of the beeline cli.
> One possible solution could be two annotations like these:
> - CommandLineOption - there could be a mandatory text parameter here, so the developer had to provide the help text for it which could be displayed to the user
> - ConfigurationFileOption - no text is required here
> Something like this:
> - This attribute could be provided by command line, and from a configuration file too:
> {noformat}
> @CommandLineOption("automatically save preferences")
> @ConfigurationFileOption
> public void setAutosave(boolean autosave) {
>   this.autosave = autosave;
> }
> public void getAutosave() {
>   return this.autosave;
> }
> {noformat}
> - This attribute could be set through the configuration only
> {noformat}
> @ConfigurationFileOption
> public void setLastConnectedUrl(String lastConnectedUrl) {
>   this.lastConnectedUrl = lastConnectedUrl;

> }
> 

> public String getLastConnectedUrl()
> {

>   return lastConnectedUrl;
> 
}
> 
{noformat}
> - Attribute could be set through command line only - I think this is not too relevant, but possible
> {noformat}
> @CommandLineOption("specific command line option")
> public void setSpecificCommandLineOption(String specificCommandLineOption) {
> 
  this.specificCommandLineOption = specificCommandLineOption;
> 
}
> 

> public String getSpecificCommandLineOption() {
> 
  return specificCommandLineOption;
> 
}
> 
{noformat}
> - Attribute could not be set
> {noformat}
> public static Env getEnv() {
> 
  return env;
> 
}
> 

public static void setEnv(Env envToUse) {
> 
  env = envToUse;
> 
}
> {noformat}
> Accouring to our previous conversations, I think you might be interested in: 
> [~spena], [~vihangk1], [~aihuaxu], [~ngangam], [~ychena], [~xuefuz]
> but anyone is welcome to discuss this.
> What do you think about the proposed solution?
> Any better ideas, or extensions?
> Thanks,
> Peter



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)