Skip to content

Commit 4dc5790

Browse files
mdesmetebyhr
authored andcommitted
Add operationMetrics to CommitInfoEntry
1 parent 62d77f7 commit 4dc5790

File tree

4 files changed

+35
-32
lines changed

4 files changed

+35
-32
lines changed

plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/DeltaLakeMetadata.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3090,7 +3090,8 @@ private CommitInfoEntry getCommitInfoEntry(
30903090
"trino-" + nodeVersion + "-" + nodeId,
30913091
readVersion,
30923092
isolationLevel.getValue(),
3093-
Optional.of(isBlindAppend));
3093+
Optional.of(isBlindAppend),
3094+
ImmutableMap.of());
30943095
}
30953096

30963097
@Override

plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/CommitInfoEntry.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public record CommitInfoEntry(
3030
String clusterId,
3131
long readVersion,
3232
String isolationLevel,
33-
Optional<Boolean> isBlindAppend)
33+
Optional<Boolean> isBlindAppend,
34+
Map<String, String> operationMetrics)
3435
{
3536
public CommitInfoEntry
3637
{
@@ -39,7 +40,7 @@ public record CommitInfoEntry(
3940

4041
public CommitInfoEntry withVersion(long version)
4142
{
42-
return new CommitInfoEntry(version, timestamp, userId, userName, operation, operationParameters, job, notebook, clusterId, readVersion, isolationLevel, isBlindAppend);
43+
return new CommitInfoEntry(version, timestamp, userId, userName, operation, operationParameters, job, notebook, clusterId, readVersion, isolationLevel, isBlindAppend, operationMetrics);
4344
}
4445

4546
public record Job(String jobId, String jobName, String runId, String jobOwnerId, String triggerType) {}

plugin/trino-delta-lake/src/main/java/io/trino/plugin/deltalake/transactionlog/checkpoint/CheckpointEntryIterator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ private DeltaLakeTransactionLogEntry buildCommitInfoEntry(ConnectorSession sessi
454454
commitInfo.getString("clusterId"),
455455
commitInfo.getInt("readVersion"),
456456
commitInfo.getString("isolationLevel"),
457-
Optional.of(commitInfo.getBoolean("isBlindAppend")));
457+
Optional.of(commitInfo.getBoolean("isBlindAppend")),
458+
commitInfo.getMap(stringMap, "operationMetrics"));
458459
log.debug("Result: %s", result);
459460
return DeltaLakeTransactionLogEntry.commitInfoEntry(result);
460461
}

plugin/trino-delta-lake/src/test/java/io/trino/plugin/deltalake/TestDeltaLakeAlluxioCacheFileOperations.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ public void testCacheFileOperations()
8484
assertFileSystemAccesses(
8585
"SELECT * FROM test_cache_file_operations",
8686
ImmutableMultiset.<CacheOperation>builder()
87-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 794))
87+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 816))
8888
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
89-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 636))
89+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 658))
9090
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))
91-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 636))
91+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 658))
9292
.add(new CacheOperation("InputFile.length", "00000000000000000002.json"))
93-
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000002.json", 0, 636))
93+
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000002.json", 0, 658))
9494
.add(new CacheOperation("InputFile.newStream", "00000000000000000002.json"))
95-
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000002.json", 0, 636))
95+
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000002.json", 0, 658))
9696
.add(new CacheOperation("InputFile.length", "00000000000000000003.json"))
9797
.add(new CacheOperation("InputFile.newStream", "_last_checkpoint"))
9898
.add(new CacheOperation("Alluxio.readCached", "key=p1/", 0, 220))
@@ -105,11 +105,11 @@ public void testCacheFileOperations()
105105
assertFileSystemAccesses(
106106
"SELECT * FROM test_cache_file_operations",
107107
ImmutableMultiset.<CacheOperation>builder()
108-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 794))
108+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 816))
109109
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
110-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 636))
110+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 658))
111111
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))
112-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 636))
112+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 658))
113113
.add(new CacheOperation("InputFile.length", "00000000000000000002.json"))
114114
.add(new CacheOperation("InputFile.length", "00000000000000000003.json"))
115115
.add(new CacheOperation("InputFile.newStream", "_last_checkpoint"))
@@ -122,19 +122,19 @@ public void testCacheFileOperations()
122122
assertFileSystemAccesses(
123123
"SELECT * FROM test_cache_file_operations",
124124
ImmutableMultiset.<CacheOperation>builder()
125-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 794))
125+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 816))
126126
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
127-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 636))
127+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 658))
128128
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))
129-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 636))
129+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 658))
130130
.add(new CacheOperation("InputFile.length", "00000000000000000002.json"))
131-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000003.json", 0, 636))
131+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000003.json", 0, 658))
132132
.add(new CacheOperation("InputFile.length", "00000000000000000003.json"))
133-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000004.json", 0, 636))
133+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000004.json", 0, 658))
134134
.add(new CacheOperation("InputFile.length", "00000000000000000004.json"))
135-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000005.json", 0, 636))
136-
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000005.json", 0, 636))
137-
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000005.json", 0, 636))
135+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000005.json", 0, 658))
136+
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000005.json", 0, 658))
137+
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000005.json", 0, 658))
138138
.add(new CacheOperation("InputFile.newStream", "00000000000000000005.json"))
139139
.add(new CacheOperation("InputFile.length", "00000000000000000005.json"))
140140
.add(new CacheOperation("InputFile.length", "00000000000000000006.json"))
@@ -154,17 +154,17 @@ public void testCacheFileOperations()
154154
assertFileSystemAccesses(
155155
"SELECT * FROM test_cache_file_operations",
156156
ImmutableMultiset.<CacheOperation>builder()
157-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 794))
157+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 816))
158158
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
159-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 636))
159+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000001.json", 0, 658))
160160
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))
161-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 636))
161+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000002.json", 0, 658))
162162
.add(new CacheOperation("InputFile.length", "00000000000000000002.json"))
163-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000003.json", 0, 636))
163+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000003.json", 0, 658))
164164
.add(new CacheOperation("InputFile.length", "00000000000000000003.json"))
165-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000004.json", 0, 636))
165+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000004.json", 0, 658))
166166
.add(new CacheOperation("InputFile.length", "00000000000000000004.json"))
167-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000005.json", 0, 636))
167+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000005.json", 0, 658))
168168
.add(new CacheOperation("InputFile.length", "00000000000000000005.json"))
169169
.add(new CacheOperation("InputFile.length", "00000000000000000006.json"))
170170
.add(new CacheOperation("InputFile.newStream", "_last_checkpoint"))
@@ -488,10 +488,10 @@ public void testCreateOrReplaceTable()
488488

489489
assertFileSystemAccesses("CREATE OR REPLACE TABLE test_create_or_replace (id VARCHAR, age INT)",
490490
ImmutableMultiset.<CacheOperation>builder()
491-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 799))
492-
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000000.json", 0, 799))
491+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 821))
492+
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000000.json", 0, 821))
493493
.add(new CacheOperation("InputFile.newStream", "00000000000000000000.json"))
494-
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000000.json", 0, 799))
494+
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000000.json", 0, 821))
495495
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
496496
.add(new CacheOperation("InputFile.exists", "00000000000000000001.json"))
497497
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))
@@ -515,9 +515,9 @@ public void testCreateOrReplaceTableAsSelect()
515515
assertFileSystemAccesses(
516516
"CREATE OR REPLACE TABLE test_create_or_replace_as_select AS SELECT 1 col_name",
517517
ImmutableMultiset.<CacheOperation>builder()
518-
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 1041))
519-
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000000.json", 0, 1041))
520-
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000000.json", 0, 1041))
518+
.add(new CacheOperation("Alluxio.readCached", "00000000000000000000.json", 0, 1063))
519+
.add(new CacheOperation("Alluxio.readExternalStream", "00000000000000000000.json", 0, 1063))
520+
.add(new CacheOperation("Alluxio.writeCache", "00000000000000000000.json", 0, 1063))
521521
.add(new CacheOperation("InputFile.newStream", "00000000000000000000.json"))
522522
.add(new CacheOperation("InputFile.length", "00000000000000000000.json"))
523523
.add(new CacheOperation("InputFile.length", "00000000000000000001.json"))

0 commit comments

Comments
 (0)