Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ static void runOneGraph(OnDiskGraphIndexCache cache,
buildCompressorObj = getCompressor(buildCompressor, ds, constructionMetrics, Phase.INDEX, buildQuantType);
}

// Used in logging
String buildCompressorString =
(buildCompressorObj == null) ? "None" : String.valueOf(buildCompressorObj);

Map<Set<FeatureId>, ImmutableGraphIndex> indexes = new HashMap<>();
if (buildCompressorObj == null) {
indexes = buildInMemory(featureSets, M, efConstruction, neighborOverflow, addHierarchy, refineFinalGraph, ds, workDirectory);
Expand Down Expand Up @@ -323,7 +327,7 @@ static void runOneGraph(OnDiskGraphIndexCache cache,

try (var cs = new ConfiguredSystem(ds, index, cv, featureSetForIndex)) {
testConfiguration(cs, topKGrid, usePruningGrid, M, efConstruction, neighborOverflow, addHierarchy, refineFinalGraph, featureSetForIndex,
artifacts, constructionMetrics, workDirectory);
buildCompressorString, artifacts, constructionMetrics, workDirectory);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down Expand Up @@ -606,6 +610,7 @@ private static void testConfiguration(ConfiguredSystem cs,
boolean addHierarchy,
boolean refineFinalGraph,
Set<FeatureId> featureSetForIndex,
String buildCompressorString,
RunArtifacts artifacts,
ConstructionMetrics constructionMetrics,
Path testDirectory) {
Expand Down Expand Up @@ -674,6 +679,7 @@ private static void testConfiguration(ConfiguredSystem cs,
printer.printRow(overquery, displayResults);

// Apply log selection and write CSV row
String searchCompressorString = (cs.cv == null) ? "None" : String.valueOf(cs.cv.getCompressor());
var logOutputs = logSel.apply(results, logResolved);
artifacts.logRow(
cs.ds.getName(),
Expand All @@ -683,6 +689,8 @@ private static void testConfiguration(ConfiguredSystem cs,
addHierarchy,
refineFinalGraph,
featureSetForIndex,
buildCompressorString,
searchCompressorString,
usePruning,
topK,
overquery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@
public final class ExperimentsSchemaV1 {
private ExperimentsSchemaV1() {}

static String csvEscape(String s) {
if (s == null) return "";
boolean needsQuotes =
s.indexOf(',') >= 0 ||
s.indexOf('"') >= 0 ||
s.indexOf('\n') >= 0 ||
s.indexOf('\r') >= 0;

if (!needsQuotes) return s;
return "\"" + s.replace("\"", "\"\"") + "\"";
}

public static List<String> fixedColumns() {
return List.of(
"schema_version",
Expand All @@ -45,6 +57,8 @@ public static List<String> fixedColumns() {
"addHierarchy",
"refineFinalGraph",
"feature_set",
"build_compressor",
"search_compressor",
"usePruning",
"topK",
"overquery",
Expand All @@ -65,6 +79,8 @@ public static Map<String, String> fixedValues(RunContext run,
boolean addHierarchy,
boolean refineFinalGraph,
Set<FeatureId> featureSet,
String buildCompressorString,
String searchCompressorString,
boolean usePruning,
int topK,
double overquery,
Expand All @@ -82,6 +98,8 @@ public static Map<String, String> fixedValues(RunContext run,
fixed.put("addHierarchy", Boolean.toString(addHierarchy));
fixed.put("refineFinalGraph", Boolean.toString(refineFinalGraph));
fixed.put("feature_set", featureSet == null ? "" : featureSet.toString());
fixed.put("build_compressor", csvEscape(buildCompressorString));
fixed.put("search_compressor", csvEscape(searchCompressorString));

fixed.put("usePruning", Boolean.toString(usePruning));
fixed.put("topK", Integer.toString(topK));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public void logRow(String datasetName,
boolean addHierarchy,
boolean refineFinalGraph,
Set<FeatureId> featureSetForIndex,
String buildCompressorString,
String searchCompressorString,
boolean usePruning,
int topK,
double overquery,
Expand All @@ -210,6 +212,8 @@ public void logRow(String datasetName,
addHierarchy,
refineFinalGraph,
featureSetForIndex,
buildCompressorString,
searchCompressorString,
usePruning,
topK,
overquery,
Expand Down