本文整理汇总了Java中org.apache.drill.exec.proto.UserBitShared.SerializedField方法的典型用法代码示例。如果您正苦于以下问题:Java UserBitShared.SerializedField方法的具体用法?Java UserBitShared.SerializedField怎么用?Java UserBitShared.SerializedField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.drill.exec.proto.UserBitShared
的用法示例。
在下文中一共展示了UserBitShared.SerializedField方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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));
}
示例3: getMetadata
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Override
public UserBitShared.SerializedField getMetadata() {
return getField()
.getAsBuilder()
.setBufferLength(getBufferSize())
.setValueCount(getAccessor().getValueCount())
.build();
}
示例4: 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 UserBitShared.SerializedField vectorMetadata = metadata.getChild(1);
if (getDataVector() == DEFAULT_DATA_VECTOR) {
addOrGetVector(VectorDescriptor.create(vectorMetadata.getMajorType()));
}
final int offsetLength = offsetMetadata.getBufferLength();
final int vectorLength = vectorMetadata.getBufferLength();
vector.load(vectorMetadata, buffer.slice(offsetLength, vectorLength));
}
示例5: verify
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Override
public void verify(ValueVector vector) throws Exception {
final String hint = String.format("%s failed the test case", vector.getClass().getSimpleName());
final UserBitShared.SerializedField metadata = vector.getMetadata();
final int actual = metadata.getChildCount();
assertEquals(hint, types.length, actual);
for (int i = 0; i < types.length; i++) {
final UserBitShared.SerializedField child = metadata.getChild(i);
assertEquals(hint, types[i], child.getMajorType());
}
}
示例6: createDummyFieldList
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
private List<UserBitShared.SerializedField> createDummyFieldList(List<UserBitShared.SerializedField> fieldList) {
List<UserBitShared.SerializedField> dummyFieldList = new ArrayList<UserBitShared.SerializedField>();
for (UserBitShared.SerializedField field : fieldList) {
dummyFieldList.add(createDummyField(field));
}
return dummyFieldList;
}
示例7: testPartitionByForAllTypes
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Test
public void testPartitionByForAllTypes() throws Exception {
final String location = "partitioned_tables_with_nulls";
final String ctasQuery = "create table %s partition by (%s) as %s";
final String tablePath = "dfs.tmp.`%s/%s_%s`";
// key - new table suffix, value - data query
final Map<String, String> variations = Maps.newHashMap();
variations.put("required", "select * from cp.`parquet/alltypes_required.parquet`");
variations.put("optional", "select * from cp.`parquet/alltypes_optional.parquet`");
variations.put("nulls_only", "select * from cp.`parquet/alltypes_optional.parquet` where %s is null");
final QueryDataBatch result = testSqlWithResults("select * from cp.`parquet/alltypes_required.parquet` limit 0").get(0);
for (UserBitShared.SerializedField field : result.getHeader().getDef().getFieldList()) {
final String fieldName = field.getNamePart().getName();
for (Map.Entry<String, String> variation : variations.entrySet()) {
final String table = String.format(tablePath, location, fieldName, variation.getKey());
final String dataQuery = String.format(variation.getValue(), fieldName);
test(ctasQuery, table, fieldName, dataQuery, fieldName);
testBuilder()
.sqlQuery("select * from %s", table)
.unOrdered()
.sqlBaselineQuery(dataQuery)
.build()
.run();
}
}
result.release();
}
示例8: load
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Override
public void load(UserBitShared.SerializedField metadata, DrillBuf buffer) { }
示例9: load
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Override
public void load(UserBitShared.SerializedField metadata, DrillBuf buffer) {
throw new UnsupportedOperationException("ObjectVector does not support this");
}
示例10: getMetadata
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Override
public UserBitShared.SerializedField getMetadata() {
throw new UnsupportedOperationException("ObjectVector does not support this");
}
示例11: minMaxEmptyNonNullableInput
import org.apache.drill.exec.proto.UserBitShared; //导入方法依赖的package包/类
@Test
public void minMaxEmptyNonNullableInput() throws Exception {
// test min and max functions on required type
final QueryDataBatch result = testSqlWithResults("select * from cp.`parquet/alltypes_required.parquet` limit 0")
.get(0);
final Map<String, StringBuilder> functions = Maps.newHashMap();
functions.put("min", new StringBuilder());
functions.put("max", new StringBuilder());
final Map<String, Object> resultingValues = Maps.newHashMap();
for (UserBitShared.SerializedField field : result.getHeader().getDef().getFieldList()) {
final String fieldName = field.getNamePart().getName();
// Only COUNT aggregate function supported for Boolean type
if (fieldName.equals("col_bln")) {
continue;
}
resultingValues.put(String.format("`%s`", fieldName), null);
for (Map.Entry<String, StringBuilder> function : functions.entrySet()) {
function.getValue()
.append(function.getKey())
.append("(")
.append(fieldName)
.append(") ")
.append(fieldName)
.append(",");
}
}
result.release();
final String query = "select %s from cp.`parquet/alltypes_required.parquet` where 1 = 0";
final List<Map<String, Object>> baselineRecords = Lists.newArrayList();
baselineRecords.add(resultingValues);
for (StringBuilder selectBody : functions.values()) {
selectBody.setLength(selectBody.length() - 1);
testBuilder()
.sqlQuery(query, selectBody.toString())
.unOrdered()
.baselineRecords(baselineRecords)
.go();
}
}