@BeforeClass public static void setup_TestSimpleJson() throws Exception { try (Table table = DBTests.createOrReplaceTable(TABLE_NAME); InputStream in = MaprDBTestsSuite.getJsonStream(JSON_FILE_URL); DocumentStream stream = Json.newDocumentStream(in)) { tableCreated = true; tablePath = table.getPath().toUri().getPath(); for (Document document : stream) { table.insert(document, "business_id"); } table.flush(); } }
@BeforeClass public static void setup_TestSimpleJson() throws Exception { // We create a large table with auto-split set to disabled. // Without intra-tablet partitioning, this test should run with only one minor fragment try (Table table = DBTests.createOrReplaceTable(TABLE_NAME, false /*autoSplit*/); InputStream in = MaprDBTestsSuite.getJsonStream(JSON_FILE_URL); DocumentStream stream = Json.newDocumentStream(in)) { tableCreated = true; tablePath = table.getPath().toUri().getPath(); List<Document> docs = Lists.newArrayList(stream); for (char ch = 'A'; ch <= 'T'; ch++) { for (int rowIndex = 0; rowIndex < 5000; rowIndex++) { for (int i = 0; i < docs.size(); i++) { final Document document = docs.get(i); final String id = String.format("%c%010d%03d", ch, rowIndex, i); document.set("documentId", rowIndex); table.insertOrReplace(id, document); } } } table.flush(); DBTests.waitForRowCount(table.getPath(), TOTAL_ROW_COUNT); setSessionOption("planner.width.max_per_node", 5); } }
@BeforeClass public static void setup_TestEncodedFieldPaths() throws Exception { try (Table table = DBTests.createOrReplaceTable(TABLE_NAME, ImmutableMap.of("codes", "codes"))) { tableCreated = true; tablePath = table.getPath().toUri().getPath(); DBTests.createIndex(TABLE_NAME, INDEX_NAME, new String[] {"age"}, new String[] {"name.last", "data.salary"}); DBTests.admin().getTableIndexes(table.getPath(), true); try (final InputStream in = TestEncodedFieldPaths.class.getResourceAsStream(JSON_FILE_URL); final DocumentStream stream = Json.newDocumentStream(in);) { table.insertOrReplace(stream); table.flush(); } // wait for the indexes to sync DBTests.waitForRowCount(table.getPath(), 5, INDEX_FLUSH_TIMEOUT); DBTests.waitForIndexFlush(table.getPath(), INDEX_FLUSH_TIMEOUT); } finally { test("ALTER SESSION SET `planner.disable_full_table_scan` = true"); } }
table.flush(); DBTests.waitForIndexFlush(table.getPath(), INDEX_FLUSH_TIMEOUT); Thread.sleep(200000);