private static List<Page> createPages(int pageCount, int channelCount, Type type) { int positionCount = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES / (channelCount * 8); List<Page> pages = new ArrayList<>(pageCount); for (int numPage = 0; numPage < pageCount; numPage++) { Block[] blocks = new Block[channelCount]; for (int numChannel = 0; numChannel < channelCount; numChannel++) { if (type.equals(BIGINT)) { blocks[numChannel] = BlockAssertions.createLongSequenceBlock(0, positionCount); } else if (type.equals(VARCHAR)) { blocks[numChannel] = BlockAssertions.createStringSequenceBlock(0, positionCount); } else if (type.equals(DOUBLE)) { blocks[numChannel] = BlockAssertions.createDoubleSequenceBlock(0, positionCount); } else if (type.equals(BOOLEAN)) { blocks[numChannel] = BlockAssertions.createBooleanSequenceBlock(0, positionCount); } else { throw new IllegalArgumentException("Unsupported type: " + type); } } pages.add(new Page(blocks)); } return pages; }
blocks[i] = BlockAssertions.createBooleanSequenceBlock(initialValue, initialValue + length);
BlockAssertions.createDoubleSequenceBlock(15, 25)); List<Block> booleanChannel = ImmutableList.of( BlockAssertions.createBooleanSequenceBlock(10, 20), BlockAssertions.createBooleanSequenceBlock(20, 30), BlockAssertions.createBooleanSequenceBlock(15, 25)); List<Block> extraUnusedChannel = ImmutableList.of( BlockAssertions.createBooleanSequenceBlock(10, 20), BlockAssertions.createBooleanSequenceBlock(20, 30), BlockAssertions.createBooleanSequenceBlock(15, 25));
private static List<Page> createPages(int pageCount, int channelCount, Type type) { int positionCount = PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES / (channelCount * 8); List<Page> pages = new ArrayList<>(pageCount); for (int numPage = 0; numPage < pageCount; numPage++) { Block[] blocks = new Block[channelCount]; for (int numChannel = 0; numChannel < channelCount; numChannel++) { if (type.equals(BIGINT)) { blocks[numChannel] = BlockAssertions.createLongSequenceBlock(0, positionCount); } else if (type.equals(VARCHAR)) { blocks[numChannel] = BlockAssertions.createStringSequenceBlock(0, positionCount); } else if (type.equals(DOUBLE)) { blocks[numChannel] = BlockAssertions.createDoubleSequenceBlock(0, positionCount); } else if (type.equals(BOOLEAN)) { blocks[numChannel] = BlockAssertions.createBooleanSequenceBlock(0, positionCount); } else { throw new IllegalArgumentException("Unsupported type: " + type); } } pages.add(new Page(blocks)); } return pages; }
public static Page createSequencePage(List<? extends Type> types, int length, int... initialValues) { Block[] blocks = new Block[initialValues.length]; for (int i = 0; i < blocks.length; i++) { Type type = types.get(i); int initialValue = initialValues[i]; if (type.equals(BIGINT)) { blocks[i] = BlockAssertions.createLongSequenceBlock(initialValue, initialValue + length); } else if (type.equals(DOUBLE)) { blocks[i] = BlockAssertions.createDoubleSequenceBlock(initialValue, initialValue + length); } else if (type.equals(VARCHAR)) { blocks[i] = BlockAssertions.createStringSequenceBlock(initialValue, initialValue + length); } else if (type.equals(BOOLEAN)) { blocks[i] = BlockAssertions.createBooleanSequenceBlock(initialValue, initialValue + length); } else if (type.equals(DATE)) { blocks[i] = BlockAssertions.createDateSequenceBlock(initialValue, initialValue + length); } else if (type.equals(TIMESTAMP)) { blocks[i] = BlockAssertions.createTimestampSequenceBlock(initialValue, initialValue + length); } else { throw new IllegalStateException("Unsupported type " + type); } } return new Page(blocks); }
BlockAssertions.createDoubleSequenceBlock(15, 25)); List<Block> booleanChannel = ImmutableList.of( BlockAssertions.createBooleanSequenceBlock(10, 20), BlockAssertions.createBooleanSequenceBlock(20, 30), BlockAssertions.createBooleanSequenceBlock(15, 25));