MCPcopy Create free account
hub / github.com/apache/arrow / AnnotateForRandomGeneration

Function AnnotateForRandomGeneration

cpp/src/arrow/compute/row/grouper_test.cc:1123–1141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121}
1122
1123FieldVector AnnotateForRandomGeneration(FieldVector fields) {
1124 for (auto& field : fields) {
1125 // For each field, constrain random generation to ensure that group ids
1126 // can appear more than once.
1127 if (is_integer(*field->type())) {
1128 field =
1129 field->WithMergedMetadata(key_value_metadata({"min", "max"}, {"100", "10000"}));
1130 } else if (is_binary_like(*field->type())) {
1131 // (note this is unsupported for large binary types)
1132 field = field->WithMergedMetadata(key_value_metadata({"unique"}, {"100"}));
1133 } else if (is_binary_view_like(*field->type())) {
1134 // Views don't support the "unique" knob; small lengths keep cardinality low.
1135 field = field->WithMergedMetadata(
1136 key_value_metadata({"min_length", "max_length"}, {"0", "5"}));
1137 }
1138 field = field->WithMergedMetadata(key_value_metadata({"null_probability"}, {"0.1"}));
1139 }
1140 return fields;
1141}
1142
1143void TestRandomConsume(TestGrouper g) {
1144 // Exercise Consume

Callers 2

TestRandomConsumeFunction · 0.85
TestRandomLookupFunction · 0.85

Calls 6

key_value_metadataFunction · 0.85
is_binary_likeFunction · 0.85
is_binary_view_likeFunction · 0.85
WithMergedMetadataMethod · 0.80
is_integerFunction · 0.50
typeMethod · 0.45

Tested by

no test coverage detected