use of org.apache.hadoop.hive.metastore.api.Schema in project hive by apache.
the class Driver method getThriftSchema.
/**
* Get a Schema with fields represented with Thrift DDL types
*/
public Schema getThriftSchema() throws Exception {
Schema schema;
try {
schema = getSchema();
if (schema != null) {
List<FieldSchema> lst = schema.getFieldSchemas();
// Go over the schema and convert type to thrift type
if (lst != null) {
for (FieldSchema f : lst) {
f.setType(ColumnType.typeToThriftType(f.getType()));
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw e;
}
LOG.info("Returning Thrift schema: " + schema);
return schema;
}
use of org.apache.hadoop.hive.metastore.api.Schema in project hive by apache.
the class TestCliDriverMethods method testThatCliDriverPrintsNoHeaderForCommandsWithNoSchema.
// If the command has no schema, make sure nothing is printed
@Test
public void testThatCliDriverPrintsNoHeaderForCommandsWithNoSchema() throws CommandProcessorException {
Schema mockSchema = mock(Schema.class);
when(mockSchema.getFieldSchemas()).thenReturn(null);
PrintStream mockOut = headerPrintingTestDriver(mockSchema);
// Should not have tried to print any thing.
verify(mockOut, never()).print(anyString());
}
use of org.apache.hadoop.hive.metastore.api.Schema in project hive by apache.
the class LlapCacheResourceProcessor method getSchema.
private Schema getSchema() {
Schema sch = new Schema();
sch.addToFieldSchemas(new FieldSchema("hostName", "string", ""));
sch.addToFieldSchemas(new FieldSchema("purgedMemoryBytes", "string", ""));
sch.putToProperties(SERIALIZATION_NULL_FORMAT, defaultNullString);
return sch;
}
use of org.apache.hadoop.hive.metastore.api.Schema in project hive by apache.
the class LlapClusterResourceProcessor method getSchema.
private Schema getSchema() {
Schema sch = new Schema();
sch.addToFieldSchemas(new FieldSchema("applicationId", "string", ""));
sch.addToFieldSchemas(new FieldSchema("workerIdentity", "string", ""));
sch.addToFieldSchemas(new FieldSchema("hostname", "string", ""));
sch.addToFieldSchemas(new FieldSchema("rpcPort", "string", ""));
sch.addToFieldSchemas(new FieldSchema("memory", "string", ""));
sch.addToFieldSchemas(new FieldSchema("vcores", "string", ""));
sch.putToProperties(SERIALIZATION_NULL_FORMAT, defaultNullString);
return sch;
}
use of org.apache.hadoop.hive.metastore.api.Schema in project hive by apache.
the class SetProcessor method getSchema.
// create a Schema object containing the give column
private Schema getSchema() {
Schema sch = new Schema();
FieldSchema tmpFieldSchema = new FieldSchema();
tmpFieldSchema.setName(SET_COLUMN_NAME);
tmpFieldSchema.setType(STRING_TYPE_NAME);
sch.putToProperties(SERIALIZATION_NULL_FORMAT, defaultNullString);
sch.addToFieldSchemas(tmpFieldSchema);
return sch;
}
Aggregations