assertGreaterThanOrEqual(queryStatsList.size(), 5); // duplicate stats is possible assertEquals(queryStatsList.get(0).getState(), "QUEUED"); assertEquals(queryStatsList.get(queryStatsList.size() - 1).getState(), "FINISHED");
@Test public void testNoDictionariesBytesLimit() { int stripeMaxBytes = megabytes(100); int bytesPerRow = 1024; int expectedMaxRowCount = stripeMaxBytes / bytesPerRow; DataSimulator simulator = new DataSimulator(0, stripeMaxBytes, expectedMaxRowCount * 2, megabytes(16), bytesPerRow); for (int loop = 0; loop < 3; loop++) { assertFalse(simulator.isDictionaryMemoryFull()); assertEquals(simulator.getRowCount(), 0); assertEquals(simulator.getBufferedBytes(), 0); simulator.advanceToNextStateChange(); // since there are no dictionary columns, the simulator should advance until the strip is full assertFalse(simulator.isDictionaryMemoryFull()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount); simulator.finalOptimize(); assertFalse(simulator.isDictionaryMemoryFull()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount); simulator.reset(); } }
assertTrue(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull);
assertTrue(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull);
assertFalse(dictionaryColumn.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedRowCountAtFlip); assertTrue(directColumn.isDirect()); assertFalse(dictionaryColumn.isDirect()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull); assertTrue(directColumn.isDirect()); assertFalse(dictionaryColumn.isDirect()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCountAtFull);
@Test public void testSingleDictionaryColumnByteLimit() { int bytesPerEntry = 1024; int dictionaryEntries = 1024; TestDictionaryColumn column = dictionaryColumn(bytesPerEntry, dictionaryEntries); // construct a simulator that will hit the row limit first int stripeMaxBytes = megabytes(100); int bytesPerRow = estimateIndexBytesPerValue(dictionaryEntries); int expectedMaxRowCount = stripeMaxBytes / bytesPerRow; DataSimulator simulator = new DataSimulator(0, stripeMaxBytes, expectedMaxRowCount * 10, megabytes(16), 0, column); for (int loop = 0; loop < 3; loop++) { assertFalse(simulator.isDictionaryMemoryFull()); assertFalse(column.isDirect()); assertEquals(simulator.getRowCount(), 0); assertEquals(simulator.getBufferedBytes(), 0); simulator.advanceToNextStateChange(); // since there dictionary columns is only 1 MB, the simulator should advance until the strip is full assertFalse(simulator.isDictionaryMemoryFull()); assertFalse(column.isDirect()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertLessThan(simulator.getRowCount(), expectedMaxRowCount); simulator.finalOptimize(); assertFalse(simulator.isDictionaryMemoryFull()); assertFalse(column.isDirect()); assertGreaterThanOrEqual(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertLessThan(simulator.getRowCount(), expectedMaxRowCount); simulator.reset(); } }
assertFalse(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount); assertFalse(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);
assertFalse(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount); assertFalse(column.isDirect()); assertLessThan(simulator.getBufferedBytes(), (long) stripeMaxBytes); assertGreaterThanOrEqual(simulator.getRowCount(), expectedMaxRowCount);
public void doIntegration(TestingOrcDataSource orcDataSource, DataSize maxMergeDistance, DataSize maxReadSize, DataSize tinyStripeThreshold) throws IOException { OrcReader orcReader = new OrcReader(orcDataSource, ORC, maxMergeDistance, maxReadSize, tinyStripeThreshold, new DataSize(1, Unit.MEGABYTE)); // 1 for reading file footer assertEquals(orcDataSource.getReadCount(), 1); List<StripeInformation> stripes = orcReader.getFooter().getStripes(); // Sanity check number of stripes. This can be three or higher because of orc writer low memory mode. assertGreaterThanOrEqual(stripes.size(), 3); //verify wrapped by CachingOrcReader assertInstanceOf(wrapWithCacheIfTinyStripes(orcDataSource, stripes, maxMergeDistance, tinyStripeThreshold), CachingOrcDataSource.class); OrcRecordReader orcRecordReader = orcReader.createRecordReader( ImmutableMap.of(0, VARCHAR), (numberOfRows, statisticsByColumnIndex) -> true, HIVE_STORAGE_TIME_ZONE, newSimpleAggregatedMemoryContext(), INITIAL_BATCH_SIZE); int positionCount = 0; while (true) { int batchSize = orcRecordReader.nextBatch(); if (batchSize <= 0) { break; } Block block = orcRecordReader.readBlock(VARCHAR, 0); positionCount += block.getPositionCount(); } assertEquals(positionCount, POSITION_COUNT); }
assertGreaterThanOrEqual(stream.getLength(), size); size = stream.getLength();
public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T actual, T expected) { assertGreaterThanOrEqual(actual, expected, null); }
public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T actual, T expected) { assertGreaterThanOrEqual(actual, expected, null); }
public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T actual, T expected) { assertGreaterThanOrEqual(actual, expected, null); }
@SuppressWarnings({"unchecked", "rawtypes"}) public void passGreaterThanOrEqual(Comparable actual, Comparable expected) { assertGreaterThanOrEqual(actual, expected); assertGreaterThanOrEqual(actual, expected, MESSAGE); }
@SuppressWarnings({"RawUseOfParameterizedType"}) public void passGreaterThanOrEqual(Comparable actual, Comparable expected) { Assertions.assertGreaterThanOrEqual(actual, expected); Assertions.assertGreaterThanOrEqual(actual, expected, MESSAGE); }
@SuppressWarnings({"unchecked", "rawtypes"}) public void passGreaterThanOrEqual(Comparable actual, Comparable expected) { assertGreaterThanOrEqual(actual, expected); assertGreaterThanOrEqual(actual, expected, MESSAGE); }
@Test public void time() throws Exception { TimedStat stat = new TimedStat(); stat.time((Callable<Void>) () -> { LockSupport.parkNanos(SECONDS.toNanos(10)); return null; }); assertEquals(stat.getCount(), 1); assertEquals(stat.getMin(), stat.getMax()); assertGreaterThanOrEqual(stat.getMax(), 10.0); }
@Test public void time() throws Exception { TimedStat stat = new TimedStat(); stat.time((Callable<Void>) () -> { LockSupport.parkNanos(SECONDS.toNanos(10)); return null; }); assertEquals(stat.getCount(), 1); assertEquals(stat.getMin(), stat.getMax()); assertGreaterThanOrEqual(stat.getMax(), 10.0); }
@Test public void test() throws Exception { JmxGcMonitor gcMonitor = new JmxGcMonitor(); assertEquals(gcMonitor.getMajorGcCount(), 0); assertEquals(gcMonitor.getMajorGcTime(), new Duration(0, NANOSECONDS)); try { gcMonitor.start(); assertGreaterThanOrEqual(gcMonitor.getMajorGcCount(), (long) 0); assertGreaterThanOrEqual(gcMonitor.getMajorGcTime(), new Duration(0, NANOSECONDS)); } finally { gcMonitor.stop(); } } }
@Test public void test() throws Exception { JmxGcMonitor gcMonitor = new JmxGcMonitor(); assertEquals(gcMonitor.getMajorGcCount(), 0); assertEquals(gcMonitor.getMajorGcTime(), new Duration(0, NANOSECONDS)); try { gcMonitor.start(); assertGreaterThanOrEqual(gcMonitor.getMajorGcCount(), (long) 0); assertGreaterThanOrEqual(gcMonitor.getMajorGcTime(), new Duration(0, NANOSECONDS)); } finally { gcMonitor.stop(); } } }