@Override public void close() throws IOException { if (appender != null) { appender.close(); // Collect statistics data StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); context.setResultStats(aggregatedStats); } super.close(); }
@Override public void close() throws IOException { if (appender != null) { appender.close(); // Collect statistics data StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); context.setResultStats(aggregatedStats); } super.close(); }
public void close() throws IOException { super.close(); if(appender != null){ appender.flush(); appender.close(); // Collect statistics data StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); context.setResultStats(sumStats); } appender = null; plan = null; } }
public void close() throws IOException { super.close(); if(appender != null){ appender.flush(); appender.close(); // Collect statistics data StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); context.setResultStats(sumStats); } appender = null; plan = null; } }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { partKey.set(tuple); // add tuple getAppender(partKey, tuple).addTuple(tuple); } List<TableStats> statSet = new ArrayList<>(); for (Appender app : appenderMap.values()) { app.flush(); app.close(); statSet.add(app.getStats()); } // Collect and aggregated statistics data TableStats aggregated = StatisticsUtil.aggregateTableStat(statSet); context.setResultStats(aggregated); return null; } }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { partKey.set(tuple); // add tuple getAppender(partKey, tuple).addTuple(tuple); } List<TableStats> statSet = new ArrayList<TableStats>(); for (Appender app : appenderMap.values()) { app.flush(); app.close(); statSet.add(app.getStats()); } // Collect and aggregated statistics data TableStats aggregated = StatisticsUtil.aggregateTableStat(statSet); context.setResultStats(aggregated); return null; } }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { appender.addTuple(tuple); if (maxPerFileSize > 0 && maxPerFileSize <= appender.getEstimatedOutputSize()) { appender.close(); writtenFileNum++; StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); openNewFile(writtenFileNum); } } return null; }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { appender.addTuple(tuple); if (maxPerFileSize > 0 && maxPerFileSize <= appender.getEstimatedOutputSize()) { appender.close(); writtenFileNum++; StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); openNewFile(writtenFileNum); } } return null; }
public static void writeTmpTable(TajoConf conf, Path tablePath) throws IOException { FileTablespace sm = TablespaceManager.getDefault(); Appender appender; Path filePath = new Path(tablePath, "table.csv"); FileSystem fs = filePath.getFileSystem(conf); if (fs.exists(tablePath)) { fs.delete(tablePath, true); } fs.mkdirs(tablePath); appender = sm.getAppender(mockupMeta, mockupSchema, filePath); appender.init(); int deptSize = 10000; int tupleNum = 100; Tuple tuple; for (int i = 0; i < tupleNum; i++) { tuple = new VTuple(2); String key = "test" + (i % deptSize); tuple.put(0, DatumFactory.createText(key)); tuple.put(1, DatumFactory.createInt4(i + 1)); appender.addTuple(tuple); } appender.close(); } }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { if (prevKey == null) { appender = getNextPartitionAppender(getSubdirectory(tuple)); prevKey = new ComparableTuple(inSchema, keyIds); prevKey.set(tuple); } else if (!prevKey.equals(tuple)) { appender.close(); StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); appender = getNextPartitionAppender(getSubdirectory(tuple)); prevKey.set(tuple); // reset all states for file rotating writtenFileNum = 0; } appender.addTuple(tuple); if (maxPerFileSize > 0 && maxPerFileSize <= appender.getEstimatedOutputSize()) { appender.close(); writtenFileNum++; StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); openAppender(writtenFileNum); } } return null; }
@Override public Tuple next() throws IOException { Tuple tuple; while(!context.isStopped() && (tuple = child.next()) != null) { if (prevKey == null) { appender = getNextPartitionAppender(getSubdirectory(tuple)); prevKey = new ComparableTuple(inSchema, keyIds); prevKey.set(tuple); } else if (!prevKey.equals(tuple)) { appender.close(); StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); appender = getNextPartitionAppender(getSubdirectory(tuple)); prevKey.set(tuple); // reset all states for file rotating writtenFileNum = 0; } appender.addTuple(tuple); if (maxPerFileSize > 0 && maxPerFileSize <= appender.getEstimatedOutputSize()) { appender.close(); writtenFileNum++; StatisticsUtil.aggregateTableStat(aggregatedStats, appender.getStats()); openAppender(writtenFileNum); } } return null; }
public void close() throws IOException { super.close(); if(appender != null){ appender.flush(); appender.close(); // Collect statistics data if (sumStats == null) { context.setResultStats(appender.getStats()); } else { StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); context.setResultStats(sumStats); } if (context.getTaskId() != null) { context.addShuffleFileOutput(0, context.getTaskId().toString()); } } appender = null; plan = null; } }
public void close() throws IOException { super.close(); if(appender != null){ appender.flush(); appender.close(); // Collect statistics data if (sumStats == null) { context.setResultStats(appender.getStats()); } else { StatisticsUtil.aggregateTableStat(sumStats, appender.getStats()); context.setResultStats(sumStats); } if (context.getTaskId() != null) { context.addShuffleFileOutput(0, context.getTaskId().toString()); } } appender = null; plan = null; } }
@Test public void testFileAlreadyExists() throws IOException { if (internalType) return; Schema schema = SchemaBuilder.builder() .add("id", Type.INT4) .add("age", Type.INT8) .add("score", Type.FLOAT4) .build(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); if (dataFormat.equalsIgnoreCase(BuiltinStorages.AVRO)) { meta.putProperty(StorageConstants.AVRO_SCHEMA_LITERAL, TEST_PROJECTION_AVRO_SCHEMA); } FileTablespace sm = TablespaceManager.getLocalFs(); Path tablePath = new Path(testDir, "testFileAlreadyExists.data"); Appender appender = sm.getAppender(meta, schema, tablePath); appender.init(); appender.close(); try { appender = sm.getAppender(meta, schema, tablePath); appender.init(); if (BuiltinStorages.ORC.equals(dataFormat)) { appender.close(); } fail(dataFormat); } catch (IOException e) { } finally { IOUtils.cleanup(null, appender); } }
appender.addTuple(t); appender.close(); FileStatus fileStatus = fs.getFileStatus(path);
appender.addTuple(t); appender.close();
appender.close();
@Test public void testDateTextHandling() throws Exception { if (dataFormat.equalsIgnoreCase(BuiltinStorages.AVRO) || internalType) { return; } Schema schema = SchemaBuilder.builder().add("col1", Type.TEXT).build(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); FileTablespace sm = TablespaceManager.getLocalFs(); Path tablePath = new Path(testDir, "testTextHandling.data"); Appender appender = sm.getAppender(meta, schema, tablePath); appender.init(); VTuple tuple = new VTuple(1); tuple.put(0, DatumFactory.createDate(1994,7,30)); appender.addTuple(tuple); appender.flush(); appender.close(); FileStatus status = fs.getFileStatus(tablePath); FileFragment fragment = new FileFragment("table", tablePath, 0, status.getLen()); Scanner scanner = sm.getScanner(meta, schema, fragment, null); scanner.init(); Tuple retrieved; while ((retrieved = scanner.next()) != null) { assertEquals(tuple.get(0).asChars(), retrieved.asDatum(0).asChars()); } scanner.close(); if (internalType){ OldStorageManager.clearCache(); } }
appender.close(); largeScore.setStats(appender.getStats()); catalog.createTable(largeScore);