[ https://issues.apache.org/jira/browse/HDFS-12321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16139451#comment-16139451 ]
Chen Liang commented on HDFS-12321: ----------------------------------- bq. Now we need to add these two as two options of the command. Before we run the SQL, we have to bind the arguments in the right location (JDBC limitations where this is done via position, so we already remember the arguments positions. So when user runs the command he/she will do it like this-- "hdfs sqlquery commandName -volumeName myVolume -bucketName myBucket" – inside code we will do a getOption("volumeName") which will return the myVolume to us, which will become part of SQL query. Same thing for bucketName, and sql will contain myBucket. Yes, this is exactly I was talking about, the part that requires code is: the CLI Parser *must be able to recognize these two options* "-volumeName" and "-bucketName", such that they can be parsed by Parser class. i.e. we call {{CommandLine cmd = BasicParser#parse(options)}} followed by {{cmd.getOptionValue("volumeName")}}, then we obtain the corresponding command line values of volumeName. But how is this going to happen? i.e. how can the parser recognize this option? Take another example, there is command like {{hdfs scm -container -create -c Contaienr0}}. Take {{-create}} for instance. The way it worked is to explicitly code {{-create}} as an option that can be recognized by CLI. So similarly here "-volumeName" and "-bucketName" must also be coded I guess. But these two options come with the user-provided sql query and are only meaningful for this user-provided query, thus they can only be provided along with this sql query, probably in the json file I suppose. Then CLI takes these options and adds them as recognizable options. This is the whole point I was try to make. Maybe there is a way for {{BasicParser}} or something to parse options by their given order (which would be a bit odd to me...). In this case, things might become easier. > Ozone : debug cli: add support to load user-provided SQL query > -------------------------------------------------------------- > > Key: HDFS-12321 > URL: https://issues.apache.org/jira/browse/HDFS-12321 > Project: Hadoop HDFS > Issue Type: Sub-task > Reporter: Chen Liang > Assignee: Chen Liang > Fix For: ozone > > Attachments: HDFS-12321-HDFS-7240.001.patch, > HDFS-12321-HDFS-7240.002.patch, HDFS-12321-HDFS-7240.003.patch, > HDFS-12321-HDFS-7240.004.patch, HDFS-12321-HDFS-7240.005.patch, > HDFS-12321-HDFS-7240.006.patch, HDFS-12321-HDFS-7240.007.patch > > > This JIRA extends SQL CLI to support loading a user-provided file that > includes any sql query the user wants to run on the SQLite db obtained by > converting Ozone metadata db. -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org