/** {@inheritDoc} */ @Override public IgfsSecondaryFileSystemPositionedReadable open(IgfsPath path, int bufSize) throws IgniteException { return (IgfsSecondaryFileSystemPositionedReadable)igfs.open(path, bufSize); }
@Override public HadoopIgfsStreamDelegate apply() { IgfsInputStream stream = igfs.open(path, bufSize, seqReadsBeforePrefetch); return new HadoopIgfsStreamDelegate(HadoopIgfsInProc.this, stream, stream.length()); } });
@Override public HadoopIgfsStreamDelegate apply() { IgfsInputStream stream = igfs.open(path, bufSize); return new HadoopIgfsStreamDelegate(HadoopIgfsInProc.this, stream, stream.length()); } });
/** {@inheritDoc} */ @Override public InputStream openInputStream(String path) throws IOException { IgfsPath igfsPath = new IgfsPath(path); return igfsEx.open(igfsPath); }
try (InputStream is0 = igfs.open(new IgfsPath(fileName))) { BufferedReader reader = new BufferedReader(new InputStreamReader(is0));
/** * Tests Hadoop command line integration. */ @Test public void testHadoopCommandLine() throws Exception { assertEquals(0, executeHadoopCmd("fs", "-ls", "/")); assertEquals(0, executeHadoopCmd("fs", "-mkdir", "/input")); assertEquals(0, executeHadoopCmd("fs", "-put", new File(testWorkDir, "test-data").getAbsolutePath(), "/input")); assertTrue(igfs.exists(new IgfsPath("/input/test-data"))); assertEquals(0, executeHadoopCmd("jar", examplesJar.getAbsolutePath(), "wordcount", "/input", "/output")); IgfsPath path = new IgfsPath("/user/" + System.getProperty("user.name") + "/"); assertTrue(igfs.exists(path)); IgfsPath jobStatPath = null; for (IgfsPath jobPath : igfs.listPaths(path)) { assertNull(jobStatPath); jobStatPath = jobPath; } File locStatFile = new File(testWorkDir, "performance"); assertEquals(0, executeHadoopCmd("fs", "-get", jobStatPath.toString() + "/performance", locStatFile.toString())); long evtCnt = HadoopTestUtils.simpleCheckJobStatFile(new BufferedReader(new FileReader(locStatFile))); assertTrue(evtCnt >= 22); //It's the minimum amount of events for job with combiner. assertTrue(igfs.exists(new IgfsPath("/output"))); BufferedReader in = new BufferedReader(new InputStreamReader(igfs.open(new IgfsPath("/output/part-r-00000")))); List<String> res = new ArrayList<>(); String line; while ((line = in.readLine()) != null) res.add(line); Collections.sort(res); assertEquals("[blue\t150, green\t200, red\t100, yellow\t50]", res.toString()); }
/** * Runs query check result. * * @param expRes Expected result. * @param qry Query. * @throws Exception If failed. */ private void checkQuery(String expRes, String qry) throws Exception { assertEquals(0, executeHiveQuery("drop table if exists result")); assertEquals(0, executeHiveQuery( "create table result " + "row format delimited fields terminated by ' ' " + "stored as textfile " + "location '/result' as " + qry )); IgfsInputStream in = igfs.open(new IgfsPath("/result/000000_0")); byte[] buf = new byte[(int) in.length()]; in.read(buf); assertEquals(expRes, new String(buf)); }
IgfsInputStream is = igfs.open(file1); is.readFully(0, new byte[blockSize * 2]); is.close(); is = igfs.open(file2); is.read(new byte[blockSize]); is.close(); is = igfs.open(fileRemote); is.read(new byte[rmtBlockSize]); is.close(); is = igfs.open(fileRemote); is.read(new byte[rmtBlockSize]); is.close();
/** {@inheritDoc} */ @Override public IgfsSecondaryFileSystemPositionedReadable open(IgfsPath path, int bufSize) throws IgniteException { return (IgfsSecondaryFileSystemPositionedReadable)igfs.open(path, bufSize); }