private void initFromProperties(final Properties properties) throws SerDeException { final List<String> columnNames = new ArrayList<>(Utilities.getColumnNames(properties)); if (!columnNames.contains(DruidConstants.DEFAULT_TIMESTAMP_COLUMN)) { throw new SerDeException("Timestamp column (' " + DruidConstants.DEFAULT_TIMESTAMP_COLUMN + "') not specified in create table; list of columns is : " + properties.getProperty(serdeConstants.LIST_COLUMNS)); } final List<PrimitiveTypeInfo> columnTypes = Utilities.getColumnTypes(properties) .stream() .map(TypeInfoFactory::getPrimitiveTypeInfo) .collect(Collectors.toList()) .stream() .map(e -> e instanceof TimestampLocalTZTypeInfo ? tsTZTypeInfo : e) .collect(Collectors.toList()); final List<ObjectInspector> inspectors = columnTypes.stream() .map(PrimitiveObjectInspectorFactory::getPrimitiveJavaObjectInspector) .collect(Collectors.toList()); columns = columnNames.toArray(new String[0]); types = columnTypes.toArray(new PrimitiveTypeInfo[0]); inspector = ObjectInspectorFactory.getStandardStructObjectInspector(columnNames, inspectors); }
private static void serializeObject(Properties properties, DruidSerDe serDe, Object[] rowObject, DruidWritable druidWritable) throws SerDeException { // Build OI with timestamp granularity column final List<String> columnNames = new ArrayList<>(Utilities.getColumnNames(properties)); columnNames.add(Constants.DRUID_TIMESTAMP_GRANULARITY_COL_NAME); final List<PrimitiveTypeInfo> columnTypes = Utilities.getColumnTypes(properties) .stream() .map(TypeInfoFactory::getPrimitiveTypeInfo) .collect(Collectors.toList()); columnTypes.add(TypeInfoFactory.getPrimitiveTypeInfo("timestamp")); List<ObjectInspector> inspectors = columnTypes.stream() .map(PrimitiveObjectInspectorFactory::getPrimitiveWritableObjectInspector) .collect(Collectors.toList()); ObjectInspector inspector = ObjectInspectorFactory.getStandardStructObjectInspector(columnNames, inspectors); // Serialize DruidWritable writable = (DruidWritable) serDe.serialize(rowObject, inspector); // Check result assertEquals(druidWritable.getValue().size(), writable.getValue().size()); for (Entry<String, Object> e : druidWritable.getValue().entrySet()) { assertEquals(e.getValue(), writable.getValue().get(e.getKey())); } }
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());
List<String> joinKeys = Utilities .getColumnNames(keyTblDesc.getProperties()); List<String> joinKeyTypes = Utilities.getColumnTypes(keyTblDesc .getProperties());