You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mrql.apache.org by fe...@apache.org on 2013/09/06 22:57:31 UTC
[13/18] MRQL-16: correct source files. ASF licenses,
and POMs for release
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/3de9e485/src/main/java/core/Config.java
----------------------------------------------------------------------
diff --git a/src/main/java/core/Config.java b/src/main/java/core/Config.java
index 2dd4e4e..a801320 100644
--- a/src/main/java/core/Config.java
+++ b/src/main/java/core/Config.java
@@ -87,185 +87,185 @@ final public class Config {
/** store the configuration parameters */
public static void write ( Configuration conf ) {
- conf.setBoolean("mrql.hadoop.mode",hadoop_mode);
- conf.setBoolean("mrql.local.mode",local_mode);
- conf.setBoolean("mrql.distributed.mode",distributed_mode);
- conf.setBoolean("mrql.map.reduce.mode",map_reduce_mode);
- conf.setBoolean("mrql.bsp.mode",bsp_mode);
- conf.setBoolean("mrql.spark.mode",spark_mode);
- conf.setBoolean("mrql.interactive",interactive);
- conf.setBoolean("mrql.compile.functional.arguments",compile_functional_arguments);
- conf.setBoolean("mrql.trace",trace);
- conf.setInt("mrql.nodes",nodes);
- conf.setInt("mrql.mapjoin.size",mapjoin_size);
- conf.setInt("mrql.in.mapper.size",map_cache_size);
- conf.setInt("mrql.max.bag.size.print",max_bag_size_print);
- conf.setInt("mrql.max.materialized.bag",max_materialized_bag);
- conf.setInt("mrql.bsp.msg.size",bsp_msg_size);
- conf.setLong("mrql.range.split.size",range_split_size);
- conf.setInt("mrql.max.merged.streams",max_merged_streams);
- conf.set("mrql.tmp.directory",tmpDirectory);
- conf.setBoolean("mrql.use.combiner",use_combiner);
- conf.setBoolean("mrql.group.join.opt",groupJoinOpt);
- conf.setBoolean("mrql.self.join.opt",selfJoinOpt);
- conf.setBoolean("mrql.trace.execution",trace_execution);
- conf.setBoolean("mrql.trace.exp.execution",trace_exp_execution);
- conf.setBoolean("mrql.quiet.execution",quiet_execution);
- conf.setBoolean("mrql.testing",testing);
- conf.setBoolean("mrql.info",info);
+ conf.setBoolean("mrql.hadoop.mode",hadoop_mode);
+ conf.setBoolean("mrql.local.mode",local_mode);
+ conf.setBoolean("mrql.distributed.mode",distributed_mode);
+ conf.setBoolean("mrql.map.reduce.mode",map_reduce_mode);
+ conf.setBoolean("mrql.bsp.mode",bsp_mode);
+ conf.setBoolean("mrql.spark.mode",spark_mode);
+ conf.setBoolean("mrql.interactive",interactive);
+ conf.setBoolean("mrql.compile.functional.arguments",compile_functional_arguments);
+ conf.setBoolean("mrql.trace",trace);
+ conf.setInt("mrql.nodes",nodes);
+ conf.setInt("mrql.mapjoin.size",mapjoin_size);
+ conf.setInt("mrql.in.mapper.size",map_cache_size);
+ conf.setInt("mrql.max.bag.size.print",max_bag_size_print);
+ conf.setInt("mrql.max.materialized.bag",max_materialized_bag);
+ conf.setInt("mrql.bsp.msg.size",bsp_msg_size);
+ conf.setLong("mrql.range.split.size",range_split_size);
+ conf.setInt("mrql.max.merged.streams",max_merged_streams);
+ conf.set("mrql.tmp.directory",tmpDirectory);
+ conf.setBoolean("mrql.use.combiner",use_combiner);
+ conf.setBoolean("mrql.group.join.opt",groupJoinOpt);
+ conf.setBoolean("mrql.self.join.opt",selfJoinOpt);
+ conf.setBoolean("mrql.trace.execution",trace_execution);
+ conf.setBoolean("mrql.trace.exp.execution",trace_exp_execution);
+ conf.setBoolean("mrql.quiet.execution",quiet_execution);
+ conf.setBoolean("mrql.testing",testing);
+ conf.setBoolean("mrql.info",info);
}
/** load the configuration parameters */
public static void read ( Configuration conf ) {
- if (loaded)
- return;
- loaded = true;
- hadoop_mode = conf.getBoolean("mrql.hadoop.mode",hadoop_mode);
- local_mode = conf.getBoolean("mrql.local.mode",local_mode);
- distributed_mode = conf.getBoolean("mrql.distributed.mode",distributed_mode);
- map_reduce_mode = conf.getBoolean("mrql.map.reduce.mode",map_reduce_mode);
- bsp_mode = conf.getBoolean("mrql.bsp.mode",bsp_mode);
- spark_mode = conf.getBoolean("mrql.spark.mode",spark_mode);
- interactive = conf.getBoolean("mrql.interactive",interactive);
- compile_functional_arguments = conf.getBoolean("mrql.compile.functional.arguments",compile_functional_arguments);
- trace = conf.getBoolean("mrql.trace",trace);
- nodes = conf.getInt("mrql.nodes",nodes);
- mapjoin_size = conf.getInt("mrql.mapjoin.size",mapjoin_size);
- map_cache_size = conf.getInt("mrql.in.mapper.size",map_cache_size);
- max_bag_size_print = conf.getInt("mrql.max.bag.size.print",max_bag_size_print);
- max_materialized_bag = conf.getInt("mrql.max.materialized.bag",max_materialized_bag);
- bsp_msg_size = conf.getInt("mrql.bsp.msg.size",bsp_msg_size);
- range_split_size = conf.getLong("mrql.range.split.size",range_split_size);
- max_merged_streams = conf.getInt("mrql.max.merged.streams",max_merged_streams);
- tmpDirectory = conf.get("mrql.tmp.directory");
- use_combiner = conf.getBoolean("mrql.use.combiner",use_combiner);
- groupJoinOpt = conf.getBoolean("mrql.group.join.opt",groupJoinOpt);
- selfJoinOpt = conf.getBoolean("mrql.self.join.opt",selfJoinOpt);
- trace_execution = conf.getBoolean("mrql.trace.execution",trace_execution);
- trace_exp_execution = conf.getBoolean("mrql.trace.exp.execution",trace_exp_execution);
- quiet_execution = conf.getBoolean("mrql.quiet.execution",quiet_execution);
- testing = conf.getBoolean("mrql.testing",testing);
- info = conf.getBoolean("mrql.info",info);
+ if (loaded)
+ return;
+ loaded = true;
+ hadoop_mode = conf.getBoolean("mrql.hadoop.mode",hadoop_mode);
+ local_mode = conf.getBoolean("mrql.local.mode",local_mode);
+ distributed_mode = conf.getBoolean("mrql.distributed.mode",distributed_mode);
+ map_reduce_mode = conf.getBoolean("mrql.map.reduce.mode",map_reduce_mode);
+ bsp_mode = conf.getBoolean("mrql.bsp.mode",bsp_mode);
+ spark_mode = conf.getBoolean("mrql.spark.mode",spark_mode);
+ interactive = conf.getBoolean("mrql.interactive",interactive);
+ compile_functional_arguments = conf.getBoolean("mrql.compile.functional.arguments",compile_functional_arguments);
+ trace = conf.getBoolean("mrql.trace",trace);
+ nodes = conf.getInt("mrql.nodes",nodes);
+ mapjoin_size = conf.getInt("mrql.mapjoin.size",mapjoin_size);
+ map_cache_size = conf.getInt("mrql.in.mapper.size",map_cache_size);
+ max_bag_size_print = conf.getInt("mrql.max.bag.size.print",max_bag_size_print);
+ max_materialized_bag = conf.getInt("mrql.max.materialized.bag",max_materialized_bag);
+ bsp_msg_size = conf.getInt("mrql.bsp.msg.size",bsp_msg_size);
+ range_split_size = conf.getLong("mrql.range.split.size",range_split_size);
+ max_merged_streams = conf.getInt("mrql.max.merged.streams",max_merged_streams);
+ tmpDirectory = conf.get("mrql.tmp.directory");
+ use_combiner = conf.getBoolean("mrql.use.combiner",use_combiner);
+ groupJoinOpt = conf.getBoolean("mrql.group.join.opt",groupJoinOpt);
+ selfJoinOpt = conf.getBoolean("mrql.self.join.opt",selfJoinOpt);
+ trace_execution = conf.getBoolean("mrql.trace.execution",trace_execution);
+ trace_exp_execution = conf.getBoolean("mrql.trace.exp.execution",trace_exp_execution);
+ quiet_execution = conf.getBoolean("mrql.quiet.execution",quiet_execution);
+ testing = conf.getBoolean("mrql.testing",testing);
+ info = conf.getBoolean("mrql.info",info);
}
public static ArrayList<String> extra_args = new ArrayList<String>();
/** read configuration parameters from the Main args */
public static Bag parse_args ( String args[], Configuration conf ) throws Exception {
- int i = 0;
- int iargs = 0;
- extra_args = new ArrayList<String>();
- ClassImporter.load_classes();
- interactive = true;
- while (i < args.length) {
- if (args[i].equals("-local")) {
- local_mode = true;
- i++;
- } else if (args[i].equals("-dist")) {
- distributed_mode = true;
- i++;
- } else if (args[i].equals("-reducers")) {
- if (++i >= args.length)
- throw new Error("Expected number of reductions");
- nodes = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-bsp_tasks")) {
- if (++i >= args.length && Integer.parseInt(args[i]) < 1)
- throw new Error("Expected max number of bsp tasks > 1");
- nodes = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-nodes")) {
- if (++i >= args.length && Integer.parseInt(args[i]) < 1)
- throw new Error("Expected number of nodes > 1");
- nodes = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-bsp_msg_size")) {
- if (++i >= args.length && Integer.parseInt(args[i]) < 10000)
- throw new Error("Expected max number of bsp messages before subsync() > 10000");
- bsp_msg_size = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-mapjoin_size")) {
- if (++i >= args.length)
- throw new Error("Expected number of MBs");
- mapjoin_size = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-cache_size")) {
- if (++i >= args.length)
- throw new Error("Expected number of entries");
- map_cache_size = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-tmp")) {
- if (++i >= args.length)
- throw new Error("Expected a temporary directory");
- tmpDirectory = args[i];
- i++;
- } else if (args[i].equals("-bag_size")) {
- if (++i >= args.length && Integer.parseInt(args[i]) < 10000)
- throw new Error("Expected max size of materialized bag > 10000");
- max_materialized_bag = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-bag_print")) {
- if (++i >= args.length)
- throw new Error("Expected number of bag elements to print");
- max_bag_size_print = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-split_size")) {
- if (++i >= args.length)
- throw new Error("Expected a split size");
- range_split_size = Long.parseLong(args[i]);
- i++;
- } else if (args[i].equals("-max_merged")) {
- if (++i >= args.length)
- throw new Error("Expected a max number of merged streams");
- max_merged_streams = Integer.parseInt(args[i]);
- i++;
- } else if (args[i].equals("-trace")) {
- trace = true;
- i++;
- } else if (args[i].equals("-C")) {
- compile_functional_arguments = true;
- i++;
- } else if (args[i].equals("-NC")) {
- compile_functional_arguments = false;
- i++;
- } else if (args[i].equals("-P")) {
- trace_execution = true;
- i++;
- } else if (args[i].equals("-quiet")) {
- quiet_execution = true;
- i++;
- } else if (args[i].equals("-info")) {
- info = true;
- i++;
- } else if (args[i].equals("-trace_execution")) {
- trace_execution = true;
- trace_exp_execution = true;
- compile_functional_arguments = false;
- i++;
- } else if (args[i].equals("-methods")) {
- System.out.print("\nImported methods: ");
- ClassImporter.print_methods();
- System.out.println();
- System.out.print("\nAggregations:");
- Translator.print_aggregates();
- System.out.println();
- i++;
- } else if (args[i].charAt(0) == '-')
- throw new Error("Unknown MRQL parameter: "+args[i]);
- else {
- if (interactive) {
- Main.query_file = args[i++];
- interactive = false;
- } else extra_args.add(args[i++]);
- }
- };
- if (hadoop_mode)
- write(conf);
- Plan.conf = conf;
- Bag b = new Bag();
- for ( String s: extra_args )
- b.add(new MR_string(s));
- Interpreter.new_global_binding(new VariableLeaf("args").value(),b);
- return b;
+ int i = 0;
+ int iargs = 0;
+ extra_args = new ArrayList<String>();
+ ClassImporter.load_classes();
+ interactive = true;
+ while (i < args.length) {
+ if (args[i].equals("-local")) {
+ local_mode = true;
+ i++;
+ } else if (args[i].equals("-dist")) {
+ distributed_mode = true;
+ i++;
+ } else if (args[i].equals("-reducers")) {
+ if (++i >= args.length)
+ throw new Error("Expected number of reductions");
+ nodes = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-bsp_tasks")) {
+ if (++i >= args.length && Integer.parseInt(args[i]) < 1)
+ throw new Error("Expected max number of bsp tasks > 1");
+ nodes = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-nodes")) {
+ if (++i >= args.length && Integer.parseInt(args[i]) < 1)
+ throw new Error("Expected number of nodes > 1");
+ nodes = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-bsp_msg_size")) {
+ if (++i >= args.length && Integer.parseInt(args[i]) < 10000)
+ throw new Error("Expected max number of bsp messages before subsync() > 10000");
+ bsp_msg_size = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-mapjoin_size")) {
+ if (++i >= args.length)
+ throw new Error("Expected number of MBs");
+ mapjoin_size = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-cache_size")) {
+ if (++i >= args.length)
+ throw new Error("Expected number of entries");
+ map_cache_size = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-tmp")) {
+ if (++i >= args.length)
+ throw new Error("Expected a temporary directory");
+ tmpDirectory = args[i];
+ i++;
+ } else if (args[i].equals("-bag_size")) {
+ if (++i >= args.length && Integer.parseInt(args[i]) < 10000)
+ throw new Error("Expected max size of materialized bag > 10000");
+ max_materialized_bag = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-bag_print")) {
+ if (++i >= args.length)
+ throw new Error("Expected number of bag elements to print");
+ max_bag_size_print = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-split_size")) {
+ if (++i >= args.length)
+ throw new Error("Expected a split size");
+ range_split_size = Long.parseLong(args[i]);
+ i++;
+ } else if (args[i].equals("-max_merged")) {
+ if (++i >= args.length)
+ throw new Error("Expected a max number of merged streams");
+ max_merged_streams = Integer.parseInt(args[i]);
+ i++;
+ } else if (args[i].equals("-trace")) {
+ trace = true;
+ i++;
+ } else if (args[i].equals("-C")) {
+ compile_functional_arguments = true;
+ i++;
+ } else if (args[i].equals("-NC")) {
+ compile_functional_arguments = false;
+ i++;
+ } else if (args[i].equals("-P")) {
+ trace_execution = true;
+ i++;
+ } else if (args[i].equals("-quiet")) {
+ quiet_execution = true;
+ i++;
+ } else if (args[i].equals("-info")) {
+ info = true;
+ i++;
+ } else if (args[i].equals("-trace_execution")) {
+ trace_execution = true;
+ trace_exp_execution = true;
+ compile_functional_arguments = false;
+ i++;
+ } else if (args[i].equals("-methods")) {
+ System.out.print("\nImported methods: ");
+ ClassImporter.print_methods();
+ System.out.println();
+ System.out.print("\nAggregations:");
+ Translator.print_aggregates();
+ System.out.println();
+ i++;
+ } else if (args[i].charAt(0) == '-')
+ throw new Error("Unknown MRQL parameter: "+args[i]);
+ else {
+ if (interactive) {
+ Main.query_file = args[i++];
+ interactive = false;
+ } else extra_args.add(args[i++]);
+ }
+ };
+ if (hadoop_mode)
+ write(conf);
+ Plan.conf = conf;
+ Bag b = new Bag();
+ for ( String s: extra_args )
+ b.add(new MR_string(s));
+ Interpreter.new_global_binding(new VariableLeaf("args").value(),b);
+ return b;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/3de9e485/src/main/java/core/DataSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/core/DataSet.java b/src/main/java/core/DataSet.java
index 49d9d07..b41d4e2 100644
--- a/src/main/java/core/DataSet.java
+++ b/src/main/java/core/DataSet.java
@@ -33,10 +33,10 @@ public class DataSet {
* @param records total number of dataset records
*/
DataSet ( DataSource s, long counter, long records ) {
- source = new ArrayList<DataSource>();
- source.add(s);
- this.counter = counter;
- this.records = records;
+ source = new ArrayList<DataSource>();
+ source.add(s);
+ this.counter = counter;
+ this.records = records;
}
/** Construct a set of DataSources
@@ -44,44 +44,44 @@ public class DataSet {
* @param records total number of dataset records
*/
DataSet ( long counter, long records ) {
- source = new ArrayList<DataSource>();
- this.counter = counter;
- this.records = records;
+ source = new ArrayList<DataSource>();
+ this.counter = counter;
+ this.records = records;
}
/** add a DataSource to this DataSet */
public void add ( DataSource s ) {
- source.add(s);
+ source.add(s);
}
/** merge this DataSet with the given DataSet */
public void merge ( DataSet ds ) {
- source.addAll(ds.source);
- counter += ds.counter;
- records += ds.records;
+ source.addAll(ds.source);
+ counter += ds.counter;
+ records += ds.records;
}
/** dataset size in bytes */
public long size ( Configuration conf ) {
- long n = 0;
- for (DataSource s: source)
- n += s.size(conf);
- return n;
+ long n = 0;
+ for (DataSource s: source)
+ n += s.size(conf);
+ return n;
}
/** return a single DataSource path by merging all the DataSource paths in this DataSet */
public String merge () {
- Object[] ds = source.toArray();
- String path = ((DataSource)ds[0]).path.toString();
- for ( int i = 1; i < ds.length; i++ )
- path += ","+((DataSource)ds[i]).path;
- return path;
+ Object[] ds = source.toArray();
+ String path = ((DataSource)ds[0]).path.toString();
+ for ( int i = 1; i < ds.length; i++ )
+ path += ","+((DataSource)ds[i]).path;
+ return path;
}
public String toString () {
- String p = "<"+counter;
- for (DataSource s: source)
- p += ","+s;
- return p+">";
+ String p = "<"+counter;
+ for (DataSource s: source)
+ p += ","+s;
+ return p+">";
}
}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/3de9e485/src/main/java/core/DataSource.java
----------------------------------------------------------------------
diff --git a/src/main/java/core/DataSource.java b/src/main/java/core/DataSource.java
index ad8bdef..7a88741 100644
--- a/src/main/java/core/DataSource.java
+++ b/src/main/java/core/DataSource.java
@@ -44,115 +44,115 @@ public class DataSource {
* It assumes that each path can only be associated with a single data source format and parser
*/
final static class DataSourceDirectory extends HashMap<String,DataSource> {
- public void read ( Configuration conf ) {
- clear();
- for ( String s: conf.get("mrql.data.source.directory").split("@@@") ) {
- String[] p = s.split("===");
- put(p[0],DataSource.read(p[1],conf));
- }
- }
-
- public String toString () {
- String s = "";
- for ( String k: keySet() )
- s += "@@@"+k+"==="+get(k);
- if (s.equals(""))
- return s;
- else return s.substring(3);
- }
-
- public DataSource get ( String name ) {
- for ( Map.Entry<String,DataSource> e: entrySet() )
- if (name.startsWith(e.getKey()))
- return e.getValue();
- return null;
- }
-
- public void distribute ( Configuration conf ) {
- conf.set("mrql.data.source.directory",toString());
- }
+ public void read ( Configuration conf ) {
+ clear();
+ for ( String s: conf.get("mrql.data.source.directory").split("@@@") ) {
+ String[] p = s.split("===");
+ put(p[0],DataSource.read(p[1],conf));
+ }
+ }
+
+ public String toString () {
+ String s = "";
+ for ( String k: keySet() )
+ s += "@@@"+k+"==="+get(k);
+ if (s.equals(""))
+ return s;
+ else return s.substring(3);
+ }
+
+ public DataSource get ( String name ) {
+ for ( Map.Entry<String,DataSource> e: entrySet() )
+ if (name.startsWith(e.getKey()))
+ return e.getValue();
+ return null;
+ }
+
+ public void distribute ( Configuration conf ) {
+ conf.set("mrql.data.source.directory",toString());
+ }
}
DataSource () {}
DataSource ( int source_num,
- String path,
- Class<? extends MRQLFileInputFormat> inputFormat,
- Configuration conf ) {
- this.source_num = source_num;
- this.path = path;
- this.inputFormat = inputFormat;
- to_be_merged = false;
- try {
- Path p = new Path(path);
- FileSystem fs = p.getFileSystem(conf);
- String complete_path = fs.getFileStatus(p).getPath().toString();
- //String complete_path = "file:"+path;
- this.path = complete_path;
- dataSourceDirectory.put(this.path,this);
- } catch (IOException e) {
- throw new Error(e);
- }
+ String path,
+ Class<? extends MRQLFileInputFormat> inputFormat,
+ Configuration conf ) {
+ this.source_num = source_num;
+ this.path = path;
+ this.inputFormat = inputFormat;
+ to_be_merged = false;
+ try {
+ Path p = new Path(path);
+ FileSystem fs = p.getFileSystem(conf);
+ String complete_path = fs.getFileStatus(p).getPath().toString();
+ //String complete_path = "file:"+path;
+ this.path = complete_path;
+ dataSourceDirectory.put(this.path,this);
+ } catch (IOException e) {
+ throw new Error(e);
+ }
}
public static void loadParsers() {
- if (!loaded) {
- DataSource.parserDirectory.put("xml",XMLParser.class);
- DataSource.parserDirectory.put("json",JsonParser.class);
- DataSource.parserDirectory.put("line",LineParser.class);
- loaded = true;
- }
+ if (!loaded) {
+ DataSource.parserDirectory.put("xml",XMLParser.class);
+ DataSource.parserDirectory.put("json",JsonParser.class);
+ DataSource.parserDirectory.put("line",LineParser.class);
+ loaded = true;
+ }
}
static {
- loadParsers();
+ loadParsers();
}
private static long size ( Path path, Configuration conf ) throws IOException {
- FileStatus s = path.getFileSystem(conf).getFileStatus(path);
- if (!s.isDir())
- return s.getLen();
- long size = 0;
- for ( FileStatus fs: path.getFileSystem(conf).listStatus(path) )
- size += fs.getLen();
- return size;
+ FileStatus s = path.getFileSystem(conf).getFileStatus(path);
+ if (!s.isDir())
+ return s.getLen();
+ long size = 0;
+ for ( FileStatus fs: path.getFileSystem(conf).listStatus(path) )
+ size += fs.getLen();
+ return size;
}
/** data set size in bytes */
public long size ( Configuration conf ) {
- try {
- return size(new Path(path),conf);
- } catch (IOException e) {
- throw new Error(e);
- }
+ try {
+ return size(new Path(path),conf);
+ } catch (IOException e) {
+ throw new Error(e);
+ }
}
public static DataSource read ( String buffer, Configuration conf ) {
- try {
- String[] s = buffer.split(separator);
- int n = Integer.parseInt(s[1]);
- if (s[0].equals("Binary"))
- return new BinaryDataSource(n,s[2],conf);
- else if (s[0].equals("Generator"))
- return new GeneratorDataSource(n,s[2],conf);
- else if (s[0].equals("Text"))
- return new ParsedDataSource(n,s[3],parserDirectory.get(s[2]),((Node)Tree.parse(s[4])).children(),conf);
- else throw new Error("Unrecognized data source: "+s[0]);
- } catch (Exception e) {
- throw new Error(e);
- }
+ try {
+ String[] s = buffer.split(separator);
+ int n = Integer.parseInt(s[1]);
+ if (s[0].equals("Binary"))
+ return new BinaryDataSource(n,s[2],conf);
+ else if (s[0].equals("Generator"))
+ return new GeneratorDataSource(n,s[2],conf);
+ else if (s[0].equals("Text"))
+ return new ParsedDataSource(n,s[3],parserDirectory.get(s[2]),((Node)Tree.parse(s[4])).children(),conf);
+ else throw new Error("Unrecognized data source: "+s[0]);
+ } catch (Exception e) {
+ throw new Error(e);
+ }
}
public static DataSource get ( String path, Configuration conf ) {
- if (dataSourceDirectory.isEmpty())
- dataSourceDirectory.read(conf);
- return dataSourceDirectory.get(path);
+ if (dataSourceDirectory.isEmpty())
+ dataSourceDirectory.read(conf);
+ return dataSourceDirectory.get(path);
}
public static DataSource getCached ( String remote_path, String local_path, Configuration conf ) {
- DataSource ds = get(remote_path,conf);
- ds.path = local_path;
- dataSourceDirectory.put(local_path,ds);
- return ds;
+ DataSource ds = get(remote_path,conf);
+ ds.path = local_path;
+ dataSourceDirectory.put(local_path,ds);
+ return ds;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/3de9e485/src/main/java/core/Environment.java
----------------------------------------------------------------------
diff --git a/src/main/java/core/Environment.java b/src/main/java/core/Environment.java
index 7058a22..2c5ee11 100644
--- a/src/main/java/core/Environment.java
+++ b/src/main/java/core/Environment.java
@@ -27,17 +27,17 @@ final public class Environment implements Serializable {
public Environment next;
Environment ( String n, MRData v, Environment next ) {
- name = n;
- value = v;
- this.next = next;
+ name = n;
+ value = v;
+ this.next = next;
}
private void writeObject(ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
+ out.defaultWriteObject();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
- name = Tree.add(name);
+ in.defaultReadObject();
+ name = Tree.add(name);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-mrql/blob/3de9e485/src/main/java/core/GeneratorDataSource.java
----------------------------------------------------------------------
diff --git a/src/main/java/core/GeneratorDataSource.java b/src/main/java/core/GeneratorDataSource.java
index 38a0d70..8d93399 100644
--- a/src/main/java/core/GeneratorDataSource.java
+++ b/src/main/java/core/GeneratorDataSource.java
@@ -25,25 +25,25 @@ import org.apache.hadoop.conf.Configuration;
/** A DataSource used for processing the range min..max */
final public class GeneratorDataSource extends DataSource {
GeneratorDataSource ( int source_num, String path, Configuration conf ) {
- super(source_num,path,GeneratorInputFormat.class,conf);
+ super(source_num,path,GeneratorInputFormat.class,conf);
}
GeneratorDataSource ( String path, Configuration conf ) {
- super(-1,path,GeneratorInputFormat.class,conf);
+ super(-1,path,GeneratorInputFormat.class,conf);
}
public static long size ( Path path, Configuration conf ) throws IOException {
- // each file generates range_split_size long integers
- FileStatus s = path.getFileSystem(conf).getFileStatus(path);
- if (!s.isDir())
- return Config.range_split_size*8;
- long size = 0;
- for ( FileStatus fs: path.getFileSystem(conf).listStatus(path) )
- size += Config.range_split_size*8;
- return size;
+ // each file generates range_split_size long integers
+ FileStatus s = path.getFileSystem(conf).getFileStatus(path);
+ if (!s.isDir())
+ return Config.range_split_size*8;
+ long size = 0;
+ for ( FileStatus fs: path.getFileSystem(conf).listStatus(path) )
+ size += Config.range_split_size*8;
+ return size;
}
public String toString () {
- return "Generator"+separator+source_num+separator+path;
+ return "Generator"+separator+source_num+separator+path;
}
}