Commit a01f0f71 authored by yu's avatar yu

add the last_path

parent a3fe2add
...@@ -97,6 +97,8 @@ public class FilenameInputPlugin ...@@ -97,6 +97,8 @@ public class FilenameInputPlugin
private static ArrayList<String> tagList; private static ArrayList<String> tagList;
private static int chunkSize; private static int chunkSize;
private static ArrayList<String> last_p = new ArrayList<String>();
@Override @Override
public ConfigDiff transaction(ConfigSource config, public ConfigDiff transaction(ConfigSource config,
...@@ -164,6 +166,7 @@ public class FilenameInputPlugin ...@@ -164,6 +166,7 @@ public class FilenameInputPlugin
// End of sort // End of sort
allFiles.add(files); allFiles.add(files);
last_p.add(files.get(0));
} }
...@@ -182,6 +185,8 @@ public class FilenameInputPlugin ...@@ -182,6 +185,8 @@ public class FilenameInputPlugin
} }
task.setFiles(oneFile); task.setFiles(oneFile);
taskCount = oneFile.size(); taskCount = oneFile.size();
last_p = new ArrayList<String>();
last_p.add(allFiles.get(0).get(0));
} else{ } else{
task.setFiles(allFiles); task.setFiles(allFiles);
taskCount = allFiles.size(); taskCount = allFiles.size();
...@@ -207,7 +212,10 @@ public class FilenameInputPlugin ...@@ -207,7 +212,10 @@ public class FilenameInputPlugin
InputPlugin.Control control) InputPlugin.Control control)
{ {
control.run(taskSource, schema, taskCount); control.run(taskSource, schema, taskCount);
return Exec.newConfigDiff(); ConfigDiff diff = Exec.newConfigDiff();
diff.set("last_path",last_p);
return diff;
} }
@Override @Override
...@@ -233,6 +241,7 @@ public class FilenameInputPlugin ...@@ -233,6 +241,7 @@ public class FilenameInputPlugin
{ {
int nRead; int nRead;
byte[] data = new byte[chunkSize]; byte[] data = new byte[chunkSize];
String filename = new File(file).getCanonicalPath();
FileInputStream dataIn = new FileInputStream(file); FileInputStream dataIn = new FileInputStream(file);
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ByteArrayOutputStream buffer = new ByteArrayOutputStream();
...@@ -241,12 +250,18 @@ public class FilenameInputPlugin ...@@ -241,12 +250,18 @@ public class FilenameInputPlugin
try (PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output)) try (PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output))
{ {
pageBuilder.setString(0,buffer.toString());//Base64.encodeBase64String(buffer.toByteArray())); pageBuilder.setString(0,buffer.toString());//Base64.encodeBase64String(buffer.toByteArray()));
pageBuilder.setString(1, tagList.get(taskIndex) + new File(file).getCanonicalPath() ); pageBuilder.setString(1, tagList.get(taskIndex) + filename );
pageBuilder.addRecord(); pageBuilder.addRecord();
buffer.flush(); buffer.flush();
pageBuilder.finish(); pageBuilder.finish();
} }
} }
if (last_p.size() > 1) {
last_p.set(taskIndex,filename);
}
else {
last_p.set(0,filename);
}
} catch (IOException ex){ } catch (IOException ex){
ex.printStackTrace(); ex.printStackTrace();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment