• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DrillbitContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: QueryContext

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
public QueryContext(final UserSession session, final DrillbitContext drillbitContext) {
  this.drillbitContext = drillbitContext;
  this.session = session;
  queryOptions = new QueryOptionManager(session.getOptions());
  executionControls = new ExecutionControls(queryOptions, drillbitContext.getEndpoint());
  plannerSettings = new PlannerSettings(queryOptions, getFunctionRegistry());
  plannerSettings.setNumEndPoints(drillbitContext.getBits().size());
  table = new DrillOperatorTable(getFunctionRegistry());

  queryContextInfo = Utilities.createQueryContextInfo(session.getDefaultSchemaName());
  contextInformation = new ContextInformation(session.getCredentials(), queryContextInfo);

  try {
    allocator = drillbitContext.getAllocator().getChildAllocator(null, plannerSettings.getInitialPlanningMemorySize(),
        plannerSettings.getPlanningMemoryLimit(), false);
  } catch (OutOfMemoryException e) {
    throw new DrillRuntimeException("Error creating off-heap allocator for planning context.",e);
  }
  // TODO(DRILL-1942) the new allocator has this capability built-in, so this can be removed once that is available
  bufferManager = new BufferManager(this.allocator, null);
  viewExpansionContext = new ViewExpansionContext(this);
  schemaTreesToClose = Lists.newArrayList();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:QueryContext.java


示例2: start

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
public void start(final DrillbitEndpoint endpoint, final Controller controller,
    final DataConnectionCreator data, final ClusterCoordinator coord, final PStoreProvider provider) {
  dContext = new DrillbitContext(endpoint, bContext, coord, controller, data, workBus, provider, executor);
  statusThread.start();

  // TODO remove try block once metrics moved from singleton, For now catch to avoid unit test failures
  try {
    dContext.getMetrics().register(
        MetricRegistry.name("drill.exec.work.running_fragments." + dContext.getEndpoint().getUserPort()),
            new Gauge<Integer>() {
              @Override
              public Integer getValue() {
                return runningFragments.size();
              }
        });
  } catch (final IllegalArgumentException e) {
    logger.warn("Exception while registering metrics", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:WorkManager.java


示例3: cancelExecutingFragments

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
/**
 * Stop all fragments with currently *known* active status (active as in SENDING, AWAITING_ALLOCATION, RUNNING).
 *
 * For the actual cancel calls for intermediate and leaf fragments, see
 * {@link org.apache.drill.exec.work.batch.ControlMessageHandler#cancelFragment}
 * (1) Root fragment: pending or running, send the cancel signal through a tunnel.
 * (2) Intermediate fragment: pending or running, send the cancel signal through a tunnel (for local and remote
 *    fragments). The actual cancel is done by delegating the cancel to the work bus.
 * (3) Leaf fragment: running, send the cancel signal through a tunnel. The cancel is done directly.
 */
void cancelExecutingFragments(final DrillbitContext drillbitContext) {
  final Controller controller = drillbitContext.getController();
  for(final FragmentData data : fragmentDataSet) {
    switch(data.getState()) {
    case SENDING:
    case AWAITING_ALLOCATION:
    case RUNNING:
      final FragmentHandle handle = data.getHandle();
      final DrillbitEndpoint endpoint = data.getEndpoint();
      // TODO is the CancelListener redundant? Does the FragmentStatusListener get notified of the same?
      controller.getTunnel(endpoint).cancelFragment(new SignalListener(endpoint, handle,
          SignalListener.Signal.CANCEL), handle);
      break;

    case FINISHED:
    case CANCELLATION_REQUESTED:
    case CANCELLED:
    case FAILED:
      // nothing to do
      break;
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:34,代码来源:QueryManager.java


示例4: testLimitAcrossBatches

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
@Ignore
// The testcase is not valid. "test4.json" using increasingBigInt(0) to generate a list of increasing number starting from 0, and verify the sum.
// However, when evaluate the increasingBitInt(0), if the outgoing batch could not hold the new value, doEval() return false, and start the
// next batch. But the value has already been increased by 1 in the prior failed try. Therefore, the sum of the generated number could be different,
// depending on the size of each outgoing batch, and when the batch could not hold any more values.
public void testLimitAcrossBatches(@Injectable final DrillbitContext bitContext, @Injectable UserServer.UserClientConnection connection) throws Throwable {
  new NonStrictExpectations(){{
    bitContext.getMetrics(); result = new MetricRegistry();
    bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
    bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
    bitContext.getConfig(); result = c;
    bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
  }};

  verifyLimitCount(bitContext, connection, "test2.json", 69999);
  final long start = 30000;
  final long end = 100000;
  final long expectedSum = (end - start) * (end + start - 1) / 2; //Formula for sum of series

  verifySum(bitContext, connection, "test4.json", 70000, expectedSum);


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


示例5: doTest

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private SimpleRootExec doTest(final DrillbitContext bitContext, UserClientConnection connection, String plan_path) throws Exception{
    new NonStrictExpectations() {{
      bitContext.getMetrics(); result = new MetricRegistry();
      bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
      bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
      bitContext.getConfig(); result = c;
      bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
    }};

    final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
    final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile(plan_path), Charsets.UTF_8));
    final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
    final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
    final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
    return exec;
  }
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:TestHashTable.java


示例6: doTest

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
private SimpleRootExec doTest(final DrillbitContext bitContext, UserClientConnection connection, String file) throws Exception {
  new NonStrictExpectations() {{
    bitContext.getMetrics(); result = new MetricRegistry();
    bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
    bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
    bitContext.getConfig(); result = c;
    bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
  }};

  final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile(file), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
  final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
  return exec;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:17,代码来源:TestAgg.java


示例7: setupScalarReplacementOption

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
/**
 * Set up the options to test the scalar replacement retry option (see
 * ClassTransformer.java). Scalar replacement rewrites bytecode to replace
 * value holders (essentially boxed values) with their member variables as
 * locals. There is still one pattern that doesn't work, and occasionally new
 * ones are introduced. This can be used in tests that exercise failing patterns.
 *
 * <p>This also flushes the compiled code cache.
 *
 * <p>TODO this should get moved to QueryTestUtil once DRILL-2245 has been merged
 *
 * @param drillbit the drillbit
 * @param srOption the scalar replacement option value to use
 * @return the original scalar replacement option setting (so it can be restored)
 */
private static OptionValue setupScalarReplacementOption(
    final Drillbit drillbit, final ScalarReplacementOption srOption) {
  // set the system option
  final DrillbitContext drillbitContext = drillbit.getContext();
  final OptionManager optionManager = drillbitContext.getOptionManager();
  final OptionValue originalOptionValue = optionManager.getOption(ClassTransformer.SCALAR_REPLACEMENT_OPTION);
  final OptionValue newOptionValue = OptionValue.createString(OptionType.SYSTEM,
      ClassTransformer.SCALAR_REPLACEMENT_OPTION, srOption.name().toLowerCase());
  optionManager.setOption(newOptionValue);

  // flush the code cache
  drillbitContext.getCompiler().flushCache();

  return originalOptionValue;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:31,代码来源:TestConvertFunctions.java


示例8: testImplicitCastWithNullExpression

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
public void testImplicitCastWithNullExpression(@Injectable final DrillbitContext bitContext,
                         @Injectable UserServer.UserClientConnection connection) throws Throwable{
  final Object [] expected = new Object[10];

  expected [0] = Boolean.TRUE;
  expected [1] = Boolean.FALSE;
  expected [2] = Boolean.FALSE;
  expected [3] = Boolean.TRUE;

  expected [4] = null;
  expected [5] = null;
  expected [6] = null;
  expected [7] = null;
  expected [8] = null;
  expected [9] = null;

  runTest(bitContext, connection, expected, "functions/cast/testICastNullExp.json");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:20,代码来源:TestImplicitCastFunctions.java


示例9: doPhysicalTest

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
private SimpleRootExec doPhysicalTest(final DrillbitContext bitContext, UserClientConnection connection, String file)
    throws Exception {
  new NonStrictExpectations() {
    {
      bitContext.getMetrics();
      result = new MetricRegistry();
      bitContext.getAllocator();
      result = RootAllocatorFactory.newRoot(config);
      bitContext.getConfig();
      result = config;
    }
  };

  final StoragePluginRegistry reg = new StoragePluginRegistry(bitContext);

  final PhysicalPlanReader reader = new PhysicalPlanReader(config, config.getMapper(),
      CoordinationProtos.DrillbitEndpoint.getDefaultInstance(), reg);
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile(file), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(config);
  final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false)
      .iterator().next()));
  return exec;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:25,代码来源:TestOptiqPlans.java


示例10: testJoinBatchSize

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
public void testJoinBatchSize(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{
  new NonStrictExpectations() {{
    bitContext.getMetrics(); result = new MetricRegistry();
    bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
    bitContext.getConfig(); result = c;
    bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
    bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
  }};

  final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/join/join_batchsize.json"), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
  final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
  exec.next(); // skip schema batch
  while (exec.next()) {
    assertEquals(100, exec.getRecordCount());
  }

  if (context.getFailureCause() != null) {
    throw context.getFailureCause();
  }
  assertTrue(!context.isFailed());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:26,代码来源:TestMergeJoin.java


示例11: NonRootFragmentManager

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
public NonRootFragmentManager(final PlanFragment fragment, final DrillbitContext context)
    throws ExecutionSetupException {
  try {
    this.handle = fragment.getHandle();
    this.context = new FragmentContext(context, fragment, context.getFunctionImplementationRegistry());
    this.buffers = new IncomingBuffers(fragment, this.context);
    final FragmentStatusReporter reporter = new FragmentStatusReporter(this.context,
        context.getController().getTunnel(fragment.getForeman()));
    this.runner = new FragmentExecutor(this.context, fragment, reporter);
    this.context.setBuffers(buffers);

  } catch (ForemanException e) {
    throw new FragmentSetupException("Failure while decoding fragment.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:NonRootFragmentManager.java


示例12: startNewRemoteFragment

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
private void startNewRemoteFragment(final PlanFragment fragment) throws UserRpcException {
  logger.debug("Received remote fragment start instruction", fragment);

  final DrillbitContext drillbitContext = bee.getContext();
  try {
    // we either need to start the fragment if it is a leaf fragment, or set up a fragment manager if it is non leaf.
    if (fragment.getLeafFragment()) {
      final FragmentContext context = new FragmentContext(drillbitContext, fragment,
          drillbitContext.getFunctionImplementationRegistry());
      final ControlTunnel tunnel = drillbitContext.getController().getTunnel(fragment.getForeman());
      final FragmentStatusReporter statusReporter = new FragmentStatusReporter(context, tunnel);
      final FragmentExecutor fr = new FragmentExecutor(context, fragment, statusReporter);
      bee.addFragmentRunner(fr);
    } else {
      // isIntermediate, store for incoming data.
      final NonRootFragmentManager manager = new NonRootFragmentManager(fragment, drillbitContext);
      drillbitContext.getWorkBus().addFragmentManager(manager);
    }

  } catch (final Exception e) {
      throw new UserRpcException(drillbitContext.getEndpoint(),
          "Failure while trying to start remote fragment", e);
  } catch (final OutOfMemoryError t) {
    if (t.getMessage().startsWith("Direct buffer")) {
      throw new UserRpcException(drillbitContext.getEndpoint(),
          "Out of direct memory while trying to start remote fragment", t);
    } else {
      throw t;
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:32,代码来源:ControlMessageHandler.java


示例13: testSV4Filter

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
@Ignore ("Filter does not support SV4")
public void testSV4Filter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
  new NonStrictExpectations() {{
    bitContext.getMetrics(); result = new MetricRegistry();
    bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
    bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
    bitContext.getConfig(); result = c;
    bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
  }};

  final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/filter/test_sv4.json"), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
  final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
  int recordCount = 0;
  while(exec.next()) {
    for (int i = 0; i < exec.getSelectionVector4().getCount(); i++) {
      System.out.println("Got: " + exec.getSelectionVector4().get(i));
    }
    recordCount += exec.getSelectionVector4().getCount();
  }
  exec.close();
  assertEquals(50, recordCount);

  if(context.getFailureCause() != null) {
    throw context.getFailureCause();
  }
  assertTrue(!context.isFailed());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:32,代码来源:TestSimpleFilter.java


示例14: EasyFormatPlugin

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
protected EasyFormatPlugin(String name, DrillbitContext context, Configuration fsConf,
    StoragePluginConfig storageConfig, T formatConfig, boolean readable, boolean writable, boolean blockSplittable,
    boolean compressible, List<String> extensions, String defaultName){
  this.matcher = new BasicFormatMatcher(this, fsConf, extensions, compressible);
  this.readable = readable;
  this.writable = writable;
  this.context = context;
  this.blockSplittable = blockSplittable;
  this.compressible = compressible;
  this.fsConf = fsConf;
  this.storageConfig = storageConfig;
  this.formatConfig = formatConfig;
  this.name = name == null ? defaultName : name;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:EasyFormatPlugin.java


示例15: FileSystemPlugin

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
public FileSystemPlugin(FileSystemConfig config, DrillbitContext context, String name) throws ExecutionSetupException{
  try {
    this.config = config;
    this.context = context;

    fsConf = new Configuration();
    fsConf.set(FileSystem.FS_DEFAULT_NAME_KEY, config.connection);
    fsConf.set("fs.classpath.impl", ClassPathFileSystem.class.getName());
    fsConf.set("fs.drill-local.impl", LocalSyncableFileSystem.class.getName());

    formatPluginsByName = FormatCreator.getFormatPlugins(context, fsConf, config);
    List<FormatMatcher> matchers = Lists.newArrayList();
    formatPluginsByConfig = Maps.newHashMap();
    for (FormatPlugin p : formatPluginsByName.values()) {
      matchers.add(p.getMatcher());
      formatPluginsByConfig.put(p.getConfig(), p);
    }

    final boolean noWorkspace = config.workspaces == null || config.workspaces.isEmpty();
    List<WorkspaceSchemaFactory> factories = Lists.newArrayList();
    if (!noWorkspace) {
      for (Map.Entry<String, WorkspaceConfig> space : config.workspaces.entrySet()) {
        factories.add(new WorkspaceSchemaFactory(context.getConfig(), this, space.getKey(), name, space.getValue(), matchers));
      }
    }

    // if the "default" workspace is not given add one.
    if (noWorkspace || !config.workspaces.containsKey(DEFAULT_WS_NAME)) {
      factories.add(new WorkspaceSchemaFactory(context.getConfig(), this, DEFAULT_WS_NAME, name, WorkspaceConfig.DEFAULT, matchers));
    }

    this.schemaFactory = new FileSystemSchemaFactory(name, factories);
  } catch (IOException e) {
    throw new ExecutionSetupException("Failure setting up file system plugin.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:37,代码来源:FileSystemPlugin.java


示例16: StoragePluginRegistry

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
public StoragePluginRegistry(DrillbitContext context) {
  try {
    this.context = context;
    this.pluginSystemTable = context //
        .getPersistentStoreProvider() //
        .getStore(PStoreConfig //
            .newJacksonBuilder(context.getConfig().getMapper(), StoragePluginConfig.class) //
            .name("sys.storage_plugins") //
            .build());
  } catch (IOException | RuntimeException e) {
    logger.error("Failure while loading storage plugin registry.", e);
    throw new RuntimeException("Faiure while reading and loading storage plugin configuration.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:StoragePluginRegistry.java


示例17: init

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void init() throws DrillbitStartupException {
  final DrillConfig config = context.getConfig();
  final Collection<Class<? extends StoragePlugin>> pluginClasses =
      PathScanner.scanForImplementations(
          StoragePlugin.class,
          config.getStringList(ExecConstants.STORAGE_ENGINE_SCAN_PACKAGES));
  final String lineBrokenList =
      pluginClasses.size() == 0
      ? "" : "\n\t- " + Joiner.on("\n\t- ").join(pluginClasses);
  logger.debug("Found {} storage plugin configuration classes: {}.",
               pluginClasses.size(), lineBrokenList);
  for (Class<? extends StoragePlugin> plugin : pluginClasses) {
    int i = 0;
    for (Constructor<?> c : plugin.getConstructors()) {
      Class<?>[] params = c.getParameterTypes();
      if(params.length != 3
          || params[1] != DrillbitContext.class
          || !StoragePluginConfig.class.isAssignableFrom(params[0])
          || params[2] != String.class) {
        logger.info("Skipping StoragePlugin constructor {} for plugin class {} since it doesn't implement a [constructor(StoragePluginConfig, DrillbitContext, String)]", c, plugin);
        continue;
      }
      availablePlugins.put(params[0], (Constructor<? extends StoragePlugin>) c);
      i++;
    }
    if (i == 0) {
      logger.debug("Skipping registration of StoragePlugin {} as it doesn't have a constructor with the parameters of (StorangePluginConfig, Config)", plugin.getCanonicalName());
    }
  }

  // create registered plugins defined in "storage-plugins.json"
  this.plugins = Maps.newConcurrentMap();
  this.plugins.putAll(createPlugins());

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


示例18: testMultiInputAdd

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
public void testMultiInputAdd(@Injectable final DrillbitContext bitContext, @Injectable UserServer.UserClientConnection connection) throws Throwable
{
    try (RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
         Drillbit bit = new Drillbit(CONFIG, serviceSet);
         DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {

        // run query.
        bit.run();
        client.connect();
        List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL,
                Files.toString(FileUtils.getResourceAsFile("/functions/multi_input_add_test.json"), Charsets.UTF_8));

        RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());

        QueryDataBatch batch = results.get(0);
        assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData()));

        for (VectorWrapper<?> v : batchLoader) {

            ValueVector.Accessor accessor = v.getValueVector().getAccessor();

            assertTrue((accessor.getObject(0)).equals(10));
        }

        batchLoader.clear();
        for(QueryDataBatch b : results){
            b.release();
        }
    }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:32,代码来源:TestMultiInputAdd.java


示例19: testBasicMathFunctions

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
public void testBasicMathFunctions(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable
{
  new NonStrictExpectations() {{
    bitContext.getMetrics(); result = new MetricRegistry();
    bitContext.getAllocator(); result = RootAllocatorFactory.newRoot(c);
    bitContext.getConfig(); result = c;
    bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
    bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
  }};

  final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
  final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/simple_math_functions.json"), Charsets.UTF_8));
  final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
  final FragmentContext context = new FragmentContext(bitContext, BitControl.PlanFragment.getDefaultInstance(), connection, registry);
  final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));

  while(exec.next()) {
    final IntVector intMulVector = exec.getValueVectorById(new SchemaPath("INTMUL", ExpressionPosition.UNKNOWN), IntVector.class);
    final Float8Vector floatMulVector = exec.getValueVectorById(new SchemaPath("FLOATMUL", ExpressionPosition.UNKNOWN), Float8Vector.class);
    final IntVector intAddVector = exec.getValueVectorById(new SchemaPath("INTADD", ExpressionPosition.UNKNOWN), IntVector.class);
    final Float8Vector floatAddVector = exec.getValueVectorById(new SchemaPath("FLOATADD", ExpressionPosition.UNKNOWN), Float8Vector.class);
    assertEquals(exec.getRecordCount(), 1);
    assertEquals(intMulVector.getAccessor().get(0), 2);
    assertEquals(floatMulVector.getAccessor().get(0), (1.1 * 2.2), 0);
    assertEquals(intAddVector.getAccessor().get(0), 3);
    assertEquals(floatAddVector.getAccessor().get(0), (1.1 + 2.2), 0);
  }

  if(context.getFailureCause() != null) {
    throw context.getFailureCause();
  }
  assertTrue(!context.isFailed());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:35,代码来源:TestMathFunctions.java


示例20: testExtendedMathFunc

import org.apache.drill.exec.server.DrillbitContext; //导入依赖的package包/类
@Test
public void testExtendedMathFunc(@Injectable final DrillbitContext bitContext,
                         @Injectable UserServer.UserClientConnection connection) throws Throwable {
  final BigDecimal d = new BigDecimal("100111111111111111111111111111111111.00000000000000000000000000000000000000000000000000001");
  final Object [] expected = new Object[] {Math.cbrt(1000), Math.log(10), (Math.log(64.0)/Math.log(2.0)), Math.exp(10), Math.toDegrees(0.5), Math.toRadians(45.0), Math.PI, Math.cbrt(d.doubleValue()), Math.log(d.doubleValue()), (Math.log(d.doubleValue())/Math.log(2)), Math.exp(d.doubleValue()), Math.toDegrees(d.doubleValue()), Math.toRadians(d.doubleValue())};

  runTest(bitContext, connection, expected, "functions/testExtendedMathFunctions.json");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:TestNewMathFunctions.java



注:本文中的org.apache.drill.exec.server.DrillbitContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OpenIdUserNameExtractor类代码示例发布时间:2022-05-23
下一篇:
Java Filter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap