builder.day(source, name); } else if (type.equals("hour")) { builder.hour(source, name); } else if (type.equals("minute")) { builder.minute(source, name);
strategyBuilder.day(fieldName); } else if ("hour".equals(partitionerType)) { strategyBuilder.hour(fieldName); } else if ("minute".equals(partitionerType)) { strategyBuilder.minute(fieldName);
.month("timestamp") .day("timestamp") .hour("timestamp") .minute("timestamp") .identity("message", "message_copy")
@Test public void testMultipleFields() { checkParser(new PartitionStrategy.Builder() .provided("version") .hash("username", 64) .identity("username", "u") .year("time") .month("time") .day("time") .hour("time") .minute("time") .dateFormat("time", "datetime", "yyyy_MM_dd_HHmmss") .build(), "[ " + "{\"type\": \"provided\", \"name\": \"version\"}," + "{\"type\": \"hash\", \"source\": \"username\", \"buckets\": 64}," + "{\"type\": \"identity\"," + "\"source\": \"username\", \"name\": \"u\"}," + "{\"type\": \"year\", \"source\": \"time\"}," + "{\"type\": \"month\", \"source\": \"time\"}," + "{\"type\": \"day\", \"source\": \"time\"}," + "{\"type\": \"hour\", \"source\": \"time\"}," + "{\"type\": \"minute\", \"source\": \"time\"}," + "{\"type\": \"dateFormat\", \"source\": \"time\", " + "\"name\": \"datetime\", \"format\": \"yyyy_MM_dd_HHmmss\"}" + " ]"); }
@Test public void testAllowedPartitionSchemaCombinations() { Compatibility.checkDescriptor( new DatasetDescriptor.Builder() .schema(schema) .partitionStrategy(new PartitionStrategy.Builder() .year("timestamp") .month("timestamp") .day("timestamp") .hour("timestamp") .minute("timestamp") .identity("message", "message_copy") .identity("timestamp", "ts") .identity("number", "num") .hash("message", 48) .hash("timestamp", 48) .hash("number", 48) .hash("payload", 48) .hash("float", 48) .hash("double", 48) .hash("bool", 48) .range("number", 5, 10, 15, 20) .range("message", "m", "z", "M", "Z") .build()) .build()); }