• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BaseTestQuery类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.drill.BaseTestQuery的典型用法代码示例。如果您正苦于以下问题:Java BaseTestQuery类的具体用法?Java BaseTestQuery怎么用?Java BaseTestQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

BaseTestQuery类属于org.apache.drill包,在下文中一共展示了BaseTestQuery类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkReadWriteExtended

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@Test
public void checkReadWriteExtended() throws Exception {

  final String originalFile = "${WORKING_PATH}/src/test/resources/vector/complex/extended.json".replaceAll(
      Pattern.quote("${WORKING_PATH}"),
      Matcher.quoteReplacement(TestTools.getWorkingPath()));

  final String newTable = "TestExtendedTypes/newjson";
  try {
    testNoResult(String.format("ALTER SESSION SET `%s` = 'json'", ExecConstants.OUTPUT_FORMAT_VALIDATOR.getOptionName()));
    testNoResult(String.format("ALTER SESSION SET `%s` = true", ExecConstants.JSON_EXTENDED_TYPES.getOptionName()));

    // create table
    test("create table dfs_test.tmp.`%s` as select * from dfs.`%s`", newTable, originalFile);

    // check query of table.
    test("select * from dfs_test.tmp.`%s`", newTable);

    // check that original file and new file match.
    final byte[] originalData = Files.readAllBytes(Paths.get(originalFile));
    final byte[] newData = Files.readAllBytes(Paths.get(BaseTestQuery.getDfsTestTmpSchemaLocation() + '/' + newTable
        + "/0_0_0.json"));
    assertEquals(new String(originalData), new String(newData));
  } finally {
    testNoResult(String.format("ALTER SESSION SET `%s` = '%s'",
        ExecConstants.OUTPUT_FORMAT_VALIDATOR.getOptionName(),
        ExecConstants.OUTPUT_FORMAT_VALIDATOR.getDefault().getValue()));
    testNoResult(String.format("ALTER SESSION SET `%s` = %s",
        ExecConstants.JSON_EXTENDED_TYPES.getOptionName(),
        ExecConstants.JSON_EXTENDED_TYPES.getDefault().getValue()));
  }
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:33,
代码来源:TestExtendedTypes.java

示例2: TODO

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@Test
@Ignore // TODO(DRILL-3194)
//@Repeat(count = NUM_RUNS)
public void memoryLeaksWhenFailed() {
  setSessionOption(SLICE_TARGET, "10");

  final long before = countAllocatedMemory();

  try {
    final String exceptionDesc = "fragment-execution";
    final Class<? extends Throwable> exceptionClass = IOException.class;
    final String controls = Controls.newBuilder()
      .addException(FragmentExecutor.class, exceptionDesc, exceptionClass)
      .build();

    String query = null;
    try {
      query = BaseTestQuery.getFile("queries/tpch/09.sql");
      query = query.substring(0, query.length() - 1); // drop the ";"
    } catch (final IOException e) {
      fail("Failed to get query file: " + e);
    }

    assertFailsWithException(controls, exceptionClass, exceptionDesc, query);

    final long after = countAllocatedMemory();
    assertEquals(String.format("We are leaking %d bytes", after - before), before, after);

  } finally {
    setSessionOption(SLICE_TARGET, Long.toString(SLICE_TARGET_DEFAULT));
  }
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:33,
代码来源:TestDrillbitResilience.java

示例3: drill1673

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@Test // repeated list within a repeated map
public void drill1673() throws Exception {
  String path = folder.getRoot().toPath().toString();

  String jsonRecords = BaseTestQuery.getFile("store/json/1673.json");
  int numCopies = 25000;
  new TestConstantFolding.SmallFileCreator(folder)
      .setRecord(jsonRecords)
      .createFiles(1, numCopies, "json");

  TestBuilder builder = testBuilder()
      .sqlQuery("select t.fixed_column as fixed_column, " +
                "flatten(t.list_column) as list_col " +
                "from dfs.`" + path + "/bigfile/bigfile.json` as t")
      .baselineColumns("fixed_column", "list_col")
      .unOrdered();
  Object map1 = mapOf("id1", "1",
                      "name", "zhu",
                      "num", listOf(listOf(1l, 2l, 3l)));
  Object map2 = mapOf("id1", "2",
                    "name", "hao",
                    "num", listOf(listOf(4l, 5l, 6l)));
  for (int i = 0; i < numCopies; i++) {
    builder.baselineValues("abc", map1);
    builder.baselineValues("abc", map2);
  }

  builder.go();
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:30,
代码来源:TestFlatten.java

示例4: setupDefaultTestCluster

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@BeforeClass
public static void setupDefaultTestCluster() throws Exception {
  BaseTestQuery.setupDefaultTestCluster();

  updatePlugin(storagePluginConfig -> {
      storagePluginConfig.setEnabled(true);

      DynamoEndpoint endpoint = new DynamoEndpoint(dynamo.getUtil().getUrl());
      storagePluginConfig.setEndpointForTesting(endpoint);

      Map<String, Object> credentials = new HashMap<>();
      AWSCredentials creds = BaseDynamoTableTest.STATIC_CREDENTIALS_PROVIDER.getCredentials();
      StaticCredentialsConfig credentialsConfig = new StaticCredentialsConfig(creds
        .getAWSAccessKeyId(), creds.getAWSSecretKey());
      credentialsConfig.setCredentials(credentials);
      // map the credentials to a generic map and back again so the actual credential config gets
      // converted to a map, just like if/when we would configure the plugin 'normally'
      ObjectMapper mapper = new ObjectMapper();
      try {
        credentials = mapper.readValue(mapper.writeValueAsString(credentials), Map.class);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      storagePluginConfig.setCredentialsForTesting(credentials);

      ParallelScanProperties scan = new ParallelScanProperties();
      scan.setMaxSegments(10);
      scan.setLimit(1);
      scan.setSegmentsPerEndpoint(1);
      storagePluginConfig.setScanPropertiesForTesting(scan);
    }
  );
}
 

开发者ID:fineoio,
项目名称:drill-dynamo-adapter,
代码行数:34,
代码来源:BaseDynamoTest.java

示例5: memoryLeaksWhenCancelled

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@Test
@Repeat(count = NUM_RUNS)
public void memoryLeaksWhenCancelled() {
  setSessionOption(SLICE_TARGET, "10");

  final long before = countAllocatedMemory();

  try {
    final String controls = Controls.newBuilder()
      .addPause(ScreenCreator.class, "sending-data", 1)
      .build();
    String query = null;
    try {
      query = BaseTestQuery.getFile("queries/tpch/09.sql");
      query = query.substring(0, query.length() - 1); // drop the ";"
    } catch (final IOException e) {
      fail("Failed to get query file: " + e);
    }

    final WaitUntilCompleteListener listener = new WaitUntilCompleteListener() {
      private volatile boolean cancelRequested = false;

      @Override
      public void dataArrived(final QueryDataBatch result, final ConnectionThrottle throttle) {
        if (!cancelRequested) {
          check(queryId != null, "Query id should not be null, since we have waited long enough.");
          cancelAndResume();
          cancelRequested = true;
        }
        result.release();
      }
    };

    assertCancelledWithoutException(controls, listener, query);

    final long after = countAllocatedMemory();
    assertEquals(String.format("We are leaking %d bytes", after - before), before, after);
  } finally {
    setSessionOption(SLICE_TARGET, Long.toString(SLICE_TARGET_DEFAULT));
  }
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:42,
代码来源:TestDrillbitResilience.java

示例6: testFlatten_Drill2162_complex

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@Test
public void testFlatten_Drill2162_complex() throws Exception {
  String path = folder.getRoot().toPath().toString();

  String jsonRecords = BaseTestQuery.getFile("flatten/complex_transaction_example_data.json");
  int numCopies = 700;
  new TestConstantFolding.SmallFileCreator(folder)
      .setRecord(jsonRecords)
      .createFiles(1, numCopies, "json");

  List<JsonStringHashMap<String,Object>> data = Lists.newArrayList(
      mapOf("uid", 1l,
          "lst_lst_0", listOf(1l, 2l, 3l, 4l, 5l),
          "lst_lst_1", listOf(2l, 3l, 4l, 5l, 6l),
          "lst_lst", listOf(
          listOf(1l, 2l, 3l, 4l, 5l),
          listOf(2l, 3l, 4l, 5l, 6l))
      ),
      mapOf("uid", 2l,
          "lst_lst_0", listOf(1l, 2l, 3l, 4l, 5l),
          "lst_lst_1", listOf(2l, 3l, 4l, 5l, 6l),
          "lst_lst", listOf(
          listOf(1l, 2l, 3l, 4l, 5l),
          listOf(2l, 3l, 4l, 5l, 6l))
      )
  );

  List<JsonStringHashMap<String, Object>> result = flatten(flatten(flatten(data, "lst_lst_1"), "lst_lst_0"), "lst_lst");

  TestBuilder builder = testBuilder()
      .sqlQuery("select uid, flatten(d.lst_lst[1]) lst1, flatten(d.lst_lst[0]) lst0, flatten(d.lst_lst) lst from " +
                "dfs.`" + path + "/bigfile/bigfile.json` d")
      .unOrdered()
      .baselineColumns("uid", "lst1", "lst0", "lst");
  for (int i = 0; i < numCopies; i++) {
    for (JsonStringHashMap<String, Object> record : result) {
      builder.baselineValues(record.get("uid"), record.get("lst_lst_1"), record.get("lst_lst_0"), record.get("lst_lst"));
    }
  }
  builder.go();
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:42,
代码来源:TestFlatten.java

示例7: setupDefaultTestCluster

点赞 2

import org.apache.drill.BaseTestQuery; //导入依赖的package包/类
@BeforeClass
public static void setupDefaultTestCluster() throws Exception {
  System.setProperty("derby.drda.startNetworkServer", "true");
  server = new NetworkServerControl(InetAddress.getByName("localhost"),
      20000,
      "admin",
      "admin");
  java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
  server.start(consoleWriter);

  BasicDataSource source = new BasicDataSource();
  source.setUrl("jdbc:derby://localhost:20000/memory:testDB;create=true");
  source.setDriverClassName("org.apache.derby.jdbc.ClientDriver");

  final String insertValues1 = "INSERT INTO person VALUES (1, 'Smith', null, '{number:\"123 Main\"}','mtrx', "
      + "'xy', 333.333, 444.444, 555.00, TIME('15:09:02'), DATE('1994-02-23'), TIMESTAMP('1962-09-23 03:23:34.234'),"
      + " 666.66, 1, -1, false)";
  final String insertValues2 = "INSERT INTO person (PersonId) VALUES (null)";
  try (Connection c = source.getConnection()) {
    c.createStatement().execute("CREATE TABLE person\n" +
        "(\n" +
        "PersonID int,\n" +
        "LastName varchar(255),\n" +
        "FirstName varchar(255),\n" +
        "Address varchar(255),\n" +
        "City varchar(255),\n" +
        "Code char(2),\n" +
        "dbl double,\n" +
        "flt float,\n" +
        "rel real,\n" +
        "tm time,\n" +
        "dt date,\n" +
        "tms timestamp,\n" +
        "num numeric(10,2), \n" +
        "sm smallint,\n" +
        "bi bigint,\n" +
        "bool boolean\n" +

        ")");

    c.createStatement().execute(insertValues1);
    c.createStatement().execute(insertValues2);
    c.createStatement().execute(insertValues1);
  }

  BaseTestQuery.setupDefaultTestCluster();
}
 

开发者ID:skhalifa,
项目名称:QDrill,
代码行数:48,
代码来源:TestJdbcPlugin.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)