@@ -99,37 +99,40 @@ public SqlContext(final Configuration configuration, final List<Plugin> plugins)
9999 * Entry point for executing SQL statements while providing arguments.
100100 * You need to provide at least a JDBC source.
101101 *
102- * @param args args[0] = SQL statement path, args[1] = JDBC driver, args[2] =
103- * JDBC URL, args[3] = JDBC user,
104- * args[4] = JDBC password, args[5] = outputPath,
105- * args[6...] = platforms
102+ * @param args
103+ * <ul>
104+ * <li><b>-p, --platforms</b>: Comma-separated list of execution
105+ * platforms (e.g., spark, java).</li>
106+ * <li><b>-q, --query</b>: Path to the SQL query file to be
107+ * executed.</li>
108+ * <li><b>-o, --outputPath</b>: Path where the output results will
109+ * be stored.</li>
110+ * <li><b>-c, --config</b>: Path to the configuration file.</li>
111+ * </ul>
106112 */
107113 public static void main (final String [] args ) throws Exception {
108114 if (args .length < 4 )
109115 throw new IllegalArgumentException (
110116 "Usage: ./bin/wayang-submit org.apache.wayang.api.sql.SqlContext <configuration path> <SQL statement path> <output path> [platforms...]" );
111117
112- //Specify the named arguments
113- Options options = new Options ();
118+ // Specify the named arguments
119+ final Options options = new Options ();
114120 options .addOption ("p" , "platforms" , true , "[platforms...]" );
115121 options .addOption ("q" , "query" , true , "SQL statement path" );
116122 options .addOption ("o" , "outputPath" , true , "Output path" );
117123 options .addOption ("c" , "config" , true , "File path for config file" );
118124
119- CommandLineParser parser = new DefaultParser ();
120- CommandLine cmd = parser .parse (options , args );
125+ final CommandLineParser parser = new DefaultParser ();
126+ final CommandLine cmd = parser .parse (options , args );
121127
122128 final String queryPath = cmd .getOptionValue ("q" );
123129 final String outputPath = cmd .getOptionValue ("o" );
124130
125131 final String query = StringUtils .chop (Files .readString (Paths .get (queryPath )).stripTrailing ());
126- final Configuration configuration = new Configuration ();
132+ final Configuration configuration = new Configuration (cmd . getOptionValue ( "c" ) );
127133
128- if (cmd .hasOption ("c" )) {
129- configuration .load (cmd .getOptionValue ("c" ));
130- }
131-
132- final SqlContext context = new SqlContext (configuration , List .of (Java .channelConversionPlugin (), Postgres .conversionPlugin ()));
134+ final SqlContext context = new SqlContext (configuration ,
135+ List .of (Java .channelConversionPlugin (), Postgres .conversionPlugin ()));
133136
134137 final List <Plugin > plugins = JavaConversions .seqAsJavaList (Parameters .loadPlugins (cmd .getOptionValue ("p" )));
135138 plugins .stream ().forEach (context ::register );
@@ -172,7 +175,7 @@ public static void main(final String[] args) throws Exception {
172175 writer .write (Arrays .toString (record .getValues ()));
173176 writer .newLine ();
174177 }
175- } catch (IOException e ) {
178+ } catch (final IOException e ) {
176179 e .printStackTrace ();
177180 }
178181 }
0 commit comments