当前位置: 首页>>代码示例>>Java>>正文


Java UserBitShared类代码示例

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


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

示例1: testWindowGroupByOnView

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test // DRILL-3346
public void testWindowGroupByOnView() throws Exception {
  try {
    thrownException.expect(new UserExceptionMatcher(UserBitShared.DrillPBError.ErrorType.VALIDATION));
    String createView = "create view testWindowGroupByOnView(a, b) as \n" +
        "select n_nationkey, n_name from cp.`tpch/nation.parquet`";
    String query = "explain plan for SELECT max(a) OVER (), b as col2 \n" +
        "from testWindowGroupByOnView \n" +
        "group by b";

    test("use dfs_test.tmp");
    test(createView);
    test(query);
  } finally {
    test("drop view testWindowGroupByOnView");
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:18,代码来源:TestWindowFunctions.java

示例2: runTestsOnFile

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
public void runTestsOnFile(String filename, UserBitShared.QueryType queryType, String[] queries, long[] rowCounts) throws Exception {
  if (VERBOSE_DEBUG) {
    System.out.println("===================");
    System.out.println("source data in json");
    System.out.println("===================");
    System.out.println(Files.toString(FileUtils.getResourceAsFile(filename), Charsets.UTF_8));
  }

  int i = 0;
  for (String query : queries) {
    if (VERBOSE_DEBUG) {
      System.out.println("=====");
      System.out.println("query");
      System.out.println("=====");
      System.out.println(query);
      System.out.println("======");
      System.out.println("result");
      System.out.println("======");
    }
    int rowCount = testRunAndPrint(queryType, query);
    assertEquals(rowCounts[i], rowCount);
    System.out.println();
    i++;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:26,代码来源:TestJsonReader.java

示例3: testProjectPushdown

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test
public void testProjectPushdown() throws Exception {
  String[] queries = {Files.toString(FileUtils.getResourceAsFile("/store/json/project_pushdown_json_physical_plan.json"), Charsets.UTF_8)};
  long[] rowCounts = {3};
  String filename = "/store/json/schema_change_int_to_string.json";
  test("alter system set `store.json.all_text_mode` = false");
  runTestsOnFile(filename, UserBitShared.QueryType.PHYSICAL, queries, rowCounts);

  List<QueryDataBatch> results = testPhysicalWithResults(queries[0]);
  assertEquals(1, results.size());
  // "`field_1`", "`field_3`.`inner_1`", "`field_3`.`inner_2`", "`field_4`.`inner_1`"

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

  // this used to be five.  It is now three.  This is because the plan doesn't have a project.
  // Scanners are not responsible for projecting non-existent columns (as long as they project one column)
  assertEquals(3, batchLoader.getSchema().getFieldCount());
  testExistentColumns(batchLoader);

  batch.release();
  batchLoader.clear();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:25,代码来源:TestJsonReader.java

示例4: testVectorCanLoadEmptyBuffer

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test
public void testVectorCanLoadEmptyBuffer() throws Exception {
  final DrillBuf empty = allocator.getEmpty();

  testVectors(new VectorVerifier() {

    @Override
    public void verify(ValueVector vector) {
      final String hint = String.format("%s failed the test case", vector.getClass().getSimpleName());
      final UserBitShared.SerializedField metadata = vector.getMetadata();
      assertEquals(hint, 0, metadata.getBufferLength());
      assertEquals(hint, 0, metadata.getValueCount());

      vector.load(metadata, empty);

      assertEquals(hint, 0, vector.getValueCapacity());
      assertEquals(hint, 0, vector.getAccessor().getValueCount());

      vector.clear();
    }
  });
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:TestValueVector.java

示例5: TestBuilder

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
public TestBuilder(BufferAllocator allocator, String query, UserBitShared.QueryType queryType, Boolean ordered,
                   boolean approximateEquality, Map<SchemaPath, TypeProtos.MajorType> baselineTypeMap,
                   String baselineOptionSettingQueries, String testOptionSettingQueries, boolean highPerformanceComparison,
                   int expectedNumBatches) {
  this(allocator);
  if (ordered == null) {
    throw new RuntimeException("Ordering not set, when using a baseline file or query you must explicitly call the ordered() or unOrdered() method on the " + this.getClass().getSimpleName());
  }
  this.query = query;
  this.queryType = queryType;
  this.ordered = ordered;
  this.approximateEquality = approximateEquality;
  this.baselineTypeMap = baselineTypeMap;
  this.baselineOptionSettingQueries = baselineOptionSettingQueries;
  this.testOptionSettingQueries = testOptionSettingQueries;
  this.highPerformanceComparison = highPerformanceComparison;
  this.expectedNumBatches = expectedNumBatches;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:19,代码来源:TestBuilder.java

示例6: createDummyField

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
private UserBitShared.SerializedField createDummyField(UserBitShared.SerializedField field) {
  UserBitShared.SerializedField.Builder newDummyFieldBuilder = UserBitShared.SerializedField.newBuilder()
      .setVarByteLength(0)
      .setBufferLength(0)
      .setValueCount(0)
      .setNamePart(field.getNamePart())
      .setMajorType(field.getMajorType());

  int index = 0;
  for (UserBitShared.SerializedField childField : field.getChildList()) {
    // make sure we make a copy of all children, so we do not corrupt the
    // original fieldList. This will recursively call itself.
    newDummyFieldBuilder.addChild(index, createDummyField(childField));
    index++;
  }

  UserBitShared.SerializedField newDummyField = newDummyFieldBuilder.build();

  return newDummyField;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:21,代码来源:MergingRecordBatch.java

示例7: testWindowGroupByOnView

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test // DRILL-3346
@Category(UnlikelyTest.class)
public void testWindowGroupByOnView() throws Exception {
  try {
    thrownException.expect(new UserExceptionMatcher(UserBitShared.DrillPBError.ErrorType.VALIDATION));
    String createView = "create view testWindowGroupByOnView(a, b) as \n" +
        "select n_nationkey, n_name from cp.`tpch/nation.parquet`";
    String query = "explain plan for SELECT max(a) OVER (), b as col2 \n" +
        "from testWindowGroupByOnView \n" +
        "group by b";

    test("use dfs.tmp");
    test(createView);
    test(query);
  } finally {
    test("drop view testWindowGroupByOnView");
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:19,代码来源:TestWindowFunctions.java

示例8: runTestsOnFile

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
public void runTestsOnFile(String filename, UserBitShared.QueryType queryType, String[] queries, long[] rowCounts) throws Exception {
  if (VERBOSE_DEBUG) {
    System.out.println("===================");
    System.out.println("source data in json");
    System.out.println("===================");
    System.out.println(Files.toString(DrillFileUtils.getResourceAsFile(filename), Charsets.UTF_8));
  }

  int i = 0;
  for (String query : queries) {
    if (VERBOSE_DEBUG) {
      System.out.println("=====");
      System.out.println("query");
      System.out.println("=====");
      System.out.println(query);
      System.out.println("======");
      System.out.println("result");
      System.out.println("======");
    }
    int rowCount = testRunAndPrint(queryType, query);
    assertEquals(rowCounts[i], rowCount);
    System.out.println();
    i++;
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:26,代码来源:TestJsonReader.java

示例9: testProjectPushdown

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test
public void testProjectPushdown() throws Exception {
  String[] queries = {Files.toString(DrillFileUtils.getResourceAsFile("/store/json/project_pushdown_json_physical_plan.json"), Charsets.UTF_8)};
  long[] rowCounts = {3};
  String filename = "/store/json/schema_change_int_to_string.json";
  test("alter system set `store.json.all_text_mode` = false");
  runTestsOnFile(filename, UserBitShared.QueryType.PHYSICAL, queries, rowCounts);

  List<QueryDataBatch> results = testPhysicalWithResults(queries[0]);
  assertEquals(1, results.size());
  // "`field_1`", "`field_3`.`inner_1`", "`field_3`.`inner_2`", "`field_4`.`inner_1`"

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

  // this used to be five.  It is now three.  This is because the plan doesn't have a project.
  // Scanners are not responsible for projecting non-existent columns (as long as they project one column)
  assertEquals(3, batchLoader.getSchema().getFieldCount());
  testExistentColumns(batchLoader);

  batch.release();
  batchLoader.clear();
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:25,代码来源:TestJsonReader.java

示例10: testVectorCanLoadEmptyBuffer

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Test
public void testVectorCanLoadEmptyBuffer() throws Exception {
  @SuppressWarnings("resource")
  final DrillBuf empty = allocator.getEmpty();

  testVectors(new VectorVerifier() {

    @Override
    public void verify(ValueVector vector) {
      final String hint = String.format("%s failed the test case", vector.getClass().getSimpleName());
      final UserBitShared.SerializedField metadata = vector.getMetadata();
      assertEquals(hint, 0, metadata.getBufferLength());
      assertEquals(hint, 0, metadata.getValueCount());

      vector.load(metadata, empty);

      assertEquals(hint, 0, vector.getValueCapacity());
      assertEquals(hint, 0, vector.getAccessor().getValueCount());

      vector.clear();
    }
  });
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:24,代码来源:TestValueVector.java

示例11: runAndDump

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
private void runAndDump(ClientFixture client, String sql, long expectedRows, long spillCycle, long fromSpilledPartitions, long toSpilledPartitions) throws Exception {
  QueryBuilder.QuerySummary summary = client.queryBuilder().sql(sql).run();
  if (expectedRows > 0) {
    assertEquals(expectedRows, summary.recordCount());
  }

  ProfileParser profile = client.parseProfile(summary.queryIdString());
  List<ProfileParser.OperatorProfile> ops = profile.getOpsOfType(UserBitShared.CoreOperatorType.HASH_AGGREGATE_VALUE);

  assertTrue(!ops.isEmpty());
  // check for the first op only
  ProfileParser.OperatorProfile hag0 = ops.get(0);
  long opCycle = hag0.getMetric(HashAggTemplate.Metric.SPILL_CYCLE.ordinal());
  assertEquals(spillCycle, opCycle);
  long op_spilled_partitions = hag0.getMetric(HashAggTemplate.Metric.SPILLED_PARTITIONS.ordinal());
  assertTrue(op_spilled_partitions >= fromSpilledPartitions && op_spilled_partitions <= toSpilledPartitions);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:18,代码来源:TestHashAggrSpill.java

示例12: TestBuilder

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
public TestBuilder(TestServices services, Object query, UserBitShared.QueryType queryType, Boolean ordered,
                   boolean approximateEquality, Map<SchemaPath, TypeProtos.MajorType> baselineTypeMap,
                   String baselineOptionSettingQueries, String testOptionSettingQueries, boolean highPerformanceComparison,
                   int expectedNumBatches) {
  this(services);
  if (ordered == null) {
    throw new RuntimeException("Ordering not set, when using a baseline file or query you must explicitly call the ordered() or unOrdered() method on the " + this.getClass().getSimpleName());
  }
  this.query = query;
  this.queryType = queryType;
  this.ordered = ordered;
  this.approximateEquality = approximateEquality;
  this.baselineTypeMap = baselineTypeMap;
  this.baselineOptionSettingQueries = baselineOptionSettingQueries;
  this.testOptionSettingQueries = testOptionSettingQueries;
  this.highPerformanceComparison = highPerformanceComparison;
  this.expectedNumBatches = expectedNumBatches;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:19,代码来源:TestBuilder.java

示例13: load

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Override
public void load(UserBitShared.SerializedField metadata, DrillBuf buffer) {
  final UserBitShared.SerializedField offsetMetadata = metadata.getChild(0);
  offsets.load(offsetMetadata, buffer);

  final int offsetLength = offsetMetadata.getBufferLength();
  final UserBitShared.SerializedField bitMetadata = metadata.getChild(1);
  final int bitLength = bitMetadata.getBufferLength();
  bits.load(bitMetadata, buffer.slice(offsetLength, bitLength));

  final UserBitShared.SerializedField vectorMetadata = metadata.getChild(2);
  if (getDataVector() == DEFAULT_DATA_VECTOR) {
    addOrGetVector(VectorDescriptor.create(vectorMetadata.getMajorType()));
  }

  final int vectorLength = vectorMetadata.getBufferLength();
  vector.load(vectorMetadata, buffer.slice(offsetLength + bitLength, vectorLength));
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:19,代码来源:ListVector.java

示例14: connect

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
public void connect(RpcConnectionHandler<ServerConnection> handler, DrillbitEndpoint endpoint,
    UserProperties props, UserBitShared.UserCredentials credentials) {
  UserToBitHandshake.Builder hsBuilder = UserToBitHandshake.newBuilder()
      .setRpcVersion(UserRpcConfig.RPC_VERSION)
      .setSupportListening(true)
      .setSupportComplexTypes(supportComplexTypes)
      .setSupportTimeout(true)
      .setCredentials(credentials);

  if (props != null) {
    hsBuilder.setProperties(props);
  }

  this.connectAsClient(handler, hsBuilder.build(), endpoint.getAddress(), endpoint.getUserPort());
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:16,代码来源:UserClient.java

示例15: getMetadata

import org.apache.drill.exec.proto.UserBitShared; //导入依赖的package包/类
@Override
public UserBitShared.SerializedField getMetadata() {
  return getField()
      .getAsBuilder()
      .setBufferLength(getBufferSize())
      .setValueCount(getAccessor().getValueCount())
      .build();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:9,代码来源:ZeroVector.java


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