Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UDF in plan generator #3040

Draft
wants to merge 73 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3a5a44b
save
pengpeng-lu Jul 28, 2023
53416bf
Revert "save"
pengpeng-lu Jul 28, 2023
3f88bb4
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jul 28, 2023
773e0dd
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 11, 2023
fa472d7
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 18, 2023
4c32432
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 25, 2023
ccd8e8d
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Oct 17, 2023
403a4a2
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Nov 30, 2023
cada59a
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Nov 30, 2023
3b02019
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jan 16, 2024
138a7fc
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jan 17, 2024
f8b3658
Merge branch 'main' of github.com:pengpeng-lu/fdb-record-layer
pengpeng-lu Feb 13, 2024
b4edc0a
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Feb 20, 2024
c42c0ce
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Feb 21, 2024
a570479
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Feb 27, 2024
f4e5cac
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Mar 4, 2024
c10ec5b
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Apr 2, 2024
0d9cc50
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Apr 12, 2024
057fee0
Merge remote-tracking branch 'upstream/main'
pengpeng-lu May 8, 2024
37c8641
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jun 7, 2024
a52d15a
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jun 11, 2024
74c24fb
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jul 11, 2024
2f33668
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jul 17, 2024
01c4d01
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 7, 2024
8c70b2a
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 13, 2024
5d59fa2
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 15, 2024
7e84176
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 26, 2024
0d54f1e
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Aug 29, 2024
543a79c
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 5, 2024
8fd8208
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 11, 2024
f5b3314
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 13, 2024
9956a9f
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Sep 19, 2024
5476bb4
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Nov 20, 2024
f9fd6a9
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Nov 20, 2024
651816c
save
pengpeng-lu Nov 20, 2024
2c886c8
save
pengpeng-lu Dec 5, 2024
38a8004
save
pengpeng-lu Dec 11, 2024
4f7a23f
save
pengpeng-lu Dec 12, 2024
25eb6cf
save
pengpeng-lu Dec 12, 2024
6ebd19b
reformat
pengpeng-lu Dec 13, 2024
f8088f5
replace
pengpeng-lu Dec 16, 2024
157ab0c
put keyexpression in separate proto
pengpeng-lu Dec 18, 2024
0daa4ce
checkstyle
pengpeng-lu Dec 18, 2024
9a325bf
checksylte
pengpeng-lu Dec 19, 2024
bffaca4
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Dec 19, 2024
b3589d2
Merge branch 'main' into udf
pengpeng-lu Dec 19, 2024
46eaaf1
checkstyle
pengpeng-lu Dec 19, 2024
523859e
save
pengpeng-lu Jan 9, 2025
18312ed
Merge remote-tracking branch 'upstream/main'
pengpeng-lu Jan 9, 2025
0a70d6e
merge main
pengpeng-lu Jan 9, 2025
d058c09
MacroFunction
pengpeng-lu Jan 10, 2025
67fad06
save
pengpeng-lu Jan 10, 2025
3adcce3
save
pengpeng-lu Nov 18, 2024
74602e7
first clean
pengpeng-lu Dec 5, 2024
fa28a85
save
pengpeng-lu Dec 11, 2024
b0e5b37
store value
pengpeng-lu Dec 12, 2024
91322a2
project work
pengpeng-lu Dec 12, 2024
eee22fc
reformat
pengpeng-lu Dec 13, 2024
41112ed
fix parser
pengpeng-lu Dec 20, 2024
df4235e
clean
pengpeng-lu Dec 20, 2024
c343ed3
more test
pengpeng-lu Dec 20, 2024
6aaae1d
save
pengpeng-lu Jan 10, 2025
4f2b546
move code
pengpeng-lu Jan 10, 2025
e11b315
add test
pengpeng-lu Jan 11, 2025
29b9cb2
pmd
pengpeng-lu Jan 13, 2025
52b3ba4
comments
pengpeng-lu Jan 14, 2025
1cc89a6
save
pengpeng-lu Jan 14, 2025
91e6117
change package
pengpeng-lu Jan 14, 2025
262f03b
fix test compile error
pengpeng-lu Jan 15, 2025
4015220
Merge branch 'udf' into udo
pengpeng-lu Jan 15, 2025
e8c4dfc
change
pengpeng-lu Jan 15, 2025
8076737
save
pengpeng-lu Feb 3, 2025
cea7e31
clean
pengpeng-lu Feb 3, 2025
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
18 changes: 9 additions & 9 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.apple.foundationdb.record.metadata.MetaDataException;
import com.apple.foundationdb.record.metadata.RecordType;
import com.apple.foundationdb.record.metadata.SyntheticRecordType;
import com.apple.foundationdb.record.metadata.ScalarValuedFunction;
import com.apple.foundationdb.record.metadata.UnnestedRecordType;
import com.apple.foundationdb.record.metadata.expressions.KeyExpression;
import com.apple.foundationdb.record.metadata.expressions.LiteralKeyExpression;
Expand All @@ -48,6 +49,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -83,6 +85,8 @@ public class RecordMetaData implements RecordMetaDataProvider {
@Nonnull
private final Map<Object, SyntheticRecordType<?>> recordTypeKeyToSyntheticTypeMap;
@Nonnull
private final Set<ScalarValuedFunction> scalarValuedFunctions;
@Nonnull
private final Map<String, Index> indexes;
@Nonnull
private final Map<String, Index> universalIndexes;
Expand Down Expand Up @@ -112,6 +116,7 @@ protected RecordMetaData(@Nonnull RecordMetaData orig) {
Collections.unmodifiableMap(orig.indexes),
Collections.unmodifiableMap(orig.universalIndexes),
Collections.unmodifiableList(orig.formerIndexes),
Collections.unmodifiableSet(orig.scalarValuedFunctions),
orig.splitLongRecords,
orig.storeRecordVersions,
orig.version,
Expand All @@ -131,6 +136,7 @@ protected RecordMetaData(@Nonnull Descriptors.FileDescriptor recordsDescriptor,
@Nonnull Map<String, Index> indexes,
@Nonnull Map<String, Index> universalIndexes,
@Nonnull List<FormerIndex> formerIndexes,
@Nonnull Set<ScalarValuedFunction> scalarValuedFunctions,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few different comments further down in this PR around this. Let me just point out here that this structure is persisted and long-lived. In fact, modifying its contents and layout may be impossible or very hard once this is used. One thing I would like to avoid is to get ourselves into a dead end here.
We most likely want to support other functions-like objects than macros. For instance, we would like to use full SQL-bodied functions or table functions. This attribute here should potentially be able to contain all of these. Using my naming from a files down, this should be something named SerializableFunction (because that's all you need here, i.e. a name, a bunch of parameter declarations with their types and a return type). Under the hood it can be any of the particular flavors I mentioned (of which we only have a simple MacroFunction as of yet).

boolean splitLongRecords,
boolean storeRecordVersions,
int version,
Expand All @@ -147,6 +153,7 @@ protected RecordMetaData(@Nonnull Descriptors.FileDescriptor recordsDescriptor,
this.indexes = indexes;
this.universalIndexes = universalIndexes;
this.formerIndexes = formerIndexes;
this.scalarValuedFunctions = scalarValuedFunctions;
this.splitLongRecords = splitLongRecords;
this.storeRecordVersions = storeRecordVersions;
this.version = version;
Expand Down Expand Up @@ -342,6 +349,11 @@ public List<FormerIndex> getFormerIndexes() {
return formerIndexes;
}

@Nonnull
public Collection<ScalarValuedFunction> getAllScalarValuedFunctions() {
return scalarValuedFunctions;
}

public boolean isSplitLongRecords() {
return splitLongRecords;
}
Expand Down Expand Up @@ -693,6 +705,7 @@ public RecordMetaDataProto.MetaData toProto(@Nullable Descriptors.FileDescriptor
}

// Add in the final options.
builder.addAllScalarValuedFunction(scalarValuedFunctions.stream().map(ScalarValuedFunction::toProto).collect(Collectors.toList()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really a final option as the comment suggests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the confusing comment.

builder.setSplitLongRecords(splitLongRecords);
builder.setStoreRecordVersions(storeRecordVersions);
builder.setVersion(version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.apple.foundationdb.record.metadata.RecordTypeIndexesBuilder;
import com.apple.foundationdb.record.metadata.SyntheticRecordType;
import com.apple.foundationdb.record.metadata.SyntheticRecordTypeBuilder;
import com.apple.foundationdb.record.metadata.ScalarValuedFunction;
import com.apple.foundationdb.record.metadata.UnnestedRecordTypeBuilder;
import com.apple.foundationdb.record.metadata.expressions.FieldKeyExpression;
import com.apple.foundationdb.record.metadata.expressions.KeyExpression;
Expand Down Expand Up @@ -110,6 +111,8 @@ public class RecordMetaDataBuilder implements RecordMetaDataProvider {
@Nonnull
private final Map<String, SyntheticRecordTypeBuilder<?>> syntheticRecordTypes;
@Nonnull
private final Set<ScalarValuedFunction> scalarValuedFunctions;
@Nonnull
private final Map<String, Index> indexes;
@Nonnull
private final Map<String, Index> universalIndexes;
Expand Down Expand Up @@ -144,6 +147,7 @@ public class RecordMetaDataBuilder implements RecordMetaDataProvider {
indexMaintainerRegistry = IndexMaintainerRegistryImpl.instance();
evolutionValidator = MetaDataEvolutionValidator.getDefaultInstance();
syntheticRecordTypes = new HashMap<>();
scalarValuedFunctions = new HashSet<>();
}

private void processSchemaOptions(boolean processExtensionOptions) {
Expand Down Expand Up @@ -222,6 +226,9 @@ private void loadProtoExceptRecords(@Nonnull RecordMetaDataProto.MetaData metaDa
typeBuilder.setRecordTypeKey(LiteralKeyExpression.fromProtoValue(typeProto.getExplicitKey()));
}
}
for (RecordMetaDataProto.ScalarValuedFunction scalarValuedFunction: metaDataProto.getScalarValuedFunctionList()) {
scalarValuedFunctions.add(ScalarValuedFunction.fromProto(scalarValuedFunction));
}
if (metaDataProto.hasSplitLongRecords()) {
splitLongRecords = metaDataProto.getSplitLongRecords();
}
Expand Down Expand Up @@ -1179,6 +1186,14 @@ public void addFormerIndex(@Nonnull FormerIndex formerIndex) {
formerIndexes.add(formerIndex);
}

public void addScalarValuedFunction(@Nonnull ScalarValuedFunction scalarValuedFunction) {
scalarValuedFunctions.add(scalarValuedFunction);
}

public void addScalarValuedFunctions(@Nonnull Iterable<? extends ScalarValuedFunction> scalarValuedFunctions) {
scalarValuedFunctions.forEach(this.scalarValuedFunctions::add);
}

public boolean isSplitLongRecords() {
return splitLongRecords;
}
Expand Down Expand Up @@ -1420,7 +1435,7 @@ public RecordMetaData build(boolean validate) {
Map<Object, SyntheticRecordType<?>> recordTypeKeyToSyntheticRecordTypeMap = Maps.newHashMapWithExpectedSize(syntheticRecordTypes.size());
RecordMetaData metaData = new RecordMetaData(recordsDescriptor, getUnionDescriptor(), unionFields,
builtRecordTypes, builtSyntheticRecordTypes, recordTypeKeyToSyntheticRecordTypeMap,
indexes, universalIndexes, formerIndexes,
indexes, universalIndexes, formerIndexes, scalarValuedFunctions,
splitLongRecords, storeRecordVersions, version, subspaceKeyCounter, usesSubspaceKeyCounter, recordCountKey, localFileDescriptor != null);
for (RecordTypeBuilder recordTypeBuilder : recordTypes.values()) {
KeyExpression primaryKey = recordTypeBuilder.getPrimaryKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import com.apple.foundationdb.annotation.API;
import com.apple.foundationdb.annotation.SpotBugsSuppressWarnings;
import com.apple.foundationdb.record.RecordMetaDataProto;
import com.apple.foundationdb.record.expressions.RecordKeyExpressionProto;
import com.apple.foundationdb.record.logging.LogMessageKeys;
import com.apple.foundationdb.record.metadata.expressions.EmptyKeyExpression;
import com.apple.foundationdb.record.metadata.expressions.FieldKeyExpression;
Expand Down Expand Up @@ -392,21 +392,21 @@ public static class Evaluated {
* Values used in index keys in place of missing fields.
*/
public enum NullStandin {
NULL(RecordMetaDataProto.Field.NullInterpretation.NOT_UNIQUE), // Missing field here skips uniqueness checks.
NULL_UNIQUE(RecordMetaDataProto.Field.NullInterpretation.UNIQUE), // Missing field here like ordinary value, but null, for uniqueness.
NOT_NULL(RecordMetaDataProto.Field.NullInterpretation.NOT_NULL); // Missing field has type's ordinary default value.
NULL(RecordKeyExpressionProto.Field.NullInterpretation.NOT_UNIQUE), // Missing field here skips uniqueness checks.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static imports may make this more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately this file also has metadata.expressions.KeyExpression.

NULL_UNIQUE(RecordKeyExpressionProto.Field.NullInterpretation.UNIQUE), // Missing field here like ordinary value, but null, for uniqueness.
NOT_NULL(RecordKeyExpressionProto.Field.NullInterpretation.NOT_NULL); // Missing field has type's ordinary default value.

private RecordMetaDataProto.Field.NullInterpretation proto;
private RecordKeyExpressionProto.Field.NullInterpretation proto;

NullStandin(RecordMetaDataProto.Field.NullInterpretation nullInterpretation) {
NullStandin(RecordKeyExpressionProto.Field.NullInterpretation nullInterpretation) {
proto = nullInterpretation;
}

public RecordMetaDataProto.Field.NullInterpretation toProto() {
public RecordKeyExpressionProto.Field.NullInterpretation toProto() {
return proto;
}

public static NullStandin valueOf(RecordMetaDataProto.Field.NullInterpretation nullInterpretation) throws KeyExpression.DeserializationException {
public static NullStandin valueOf(RecordKeyExpressionProto.Field.NullInterpretation nullInterpretation) throws KeyExpression.DeserializationException {
switch (nullInterpretation) {
case NOT_UNIQUE:
return NULL;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* UDF.java
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* UDF.java
* ScalarValuedFunction.java

*
* This source file is part of the FoundationDB open source project
*
* Copyright 2015-2025 Apple Inc. and the FoundationDB project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.apple.foundationdb.record.metadata;

import com.apple.foundationdb.record.PlanHashable;
import com.apple.foundationdb.record.PlanSerializationContext;
import com.apple.foundationdb.record.RecordMetaDataProto;
import com.apple.foundationdb.record.query.plan.cascades.MacroFunction;
import com.apple.foundationdb.record.query.plan.serialization.DefaultPlanSerializationRegistry;

import javax.annotation.Nonnull;

/**
* Defines a scalar User-defined-function.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand on the documentation.

*/
public class ScalarValuedFunction {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just make a trait-like interface called SerializableFunction that makes this proto-serializable? MacroFunction can then implement SerializableFunction Then we don't have to wrap the MacroFunction here. It would also allow us to
support other functions in the future that are not MacroFunction. It's pretty straightforward for toProto(...), slightly less so on the way back. Please look how the plan serialization achieves the same thing by using:

  1. oneof in the proto declarations
  2. PlanDeserializer using AutoService to get the dispatch of the from proto part right

@Nonnull
private final MacroFunction macroFunction;

public ScalarValuedFunction(@Nonnull MacroFunction functionValue) {
this.macroFunction = functionValue;
}

@Nonnull
public MacroFunction getMacroFunction() {
return macroFunction;
}

@Nonnull
public String getFunctionName() {
return macroFunction.getFunctionName();
}

@Nonnull
public RecordMetaDataProto.ScalarValuedFunction toProto() {
PlanSerializationContext serializationContext = new PlanSerializationContext(DefaultPlanSerializationRegistry.INSTANCE,
PlanHashable.CURRENT_FOR_CONTINUATION);
return RecordMetaDataProto.ScalarValuedFunction.newBuilder()
.setFunctionValue(macroFunction.toProto(serializationContext))
.build();
}

@Nonnull
public static ScalarValuedFunction fromProto(RecordMetaDataProto.ScalarValuedFunction proto) {
PlanSerializationContext serializationContext = new PlanSerializationContext(DefaultPlanSerializationRegistry.INSTANCE,
PlanHashable.CURRENT_FOR_CONTINUATION);
return new ScalarValuedFunction(MacroFunction.fromProto(serializationContext, proto.getFunctionValue()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.apple.foundationdb.annotation.API;
import com.apple.foundationdb.record.ObjectPlanHash;
import com.apple.foundationdb.record.PlanHashable;
import com.apple.foundationdb.record.RecordMetaDataProto;
import com.apple.foundationdb.record.expressions.RecordKeyExpressionProto;
import com.apple.foundationdb.record.metadata.Key;
import com.apple.foundationdb.record.provider.foundationdb.FDBRecord;
import com.apple.foundationdb.record.query.plan.cascades.KeyExpressionVisitor;
Expand Down Expand Up @@ -63,7 +63,7 @@ private DimensionsKeyExpression(@Nonnull final KeyExpression wholeKey,
this.dimensionsSize = dimensionsSize;
}

DimensionsKeyExpression(@Nonnull final RecordMetaDataProto.Dimensions dimensions) throws DeserializationException {
DimensionsKeyExpression(@Nonnull final RecordKeyExpressionProto.Dimensions dimensions) throws DeserializationException {
this(KeyExpression.fromProto(dimensions.getWholeKey()), dimensions.getPrefixSize(), dimensions.getDimensionsSize());
}

Expand Down Expand Up @@ -114,8 +114,8 @@ public boolean needsCopyingToPartialRecord() {

@Nonnull
@Override
public RecordMetaDataProto.Dimensions toProto() throws SerializationException {
final RecordMetaDataProto.Dimensions.Builder builder = RecordMetaDataProto.Dimensions.newBuilder();
public RecordKeyExpressionProto.Dimensions toProto() throws SerializationException {
final RecordKeyExpressionProto.Dimensions.Builder builder = RecordKeyExpressionProto.Dimensions.newBuilder();
builder.setWholeKey(getWholeKey().toKeyExpression());
builder.setPrefixSize(prefixSize);
builder.setDimensionsSize(dimensionsSize);
Expand All @@ -124,8 +124,8 @@ public RecordMetaDataProto.Dimensions toProto() throws SerializationException {

@Nonnull
@Override
public RecordMetaDataProto.KeyExpression toKeyExpression() {
return RecordMetaDataProto.KeyExpression.newBuilder().setDimensions(toProto()).build();
public RecordKeyExpressionProto.KeyExpression toKeyExpression() {
return RecordKeyExpressionProto.KeyExpression.newBuilder().setDimensions(toProto()).build();
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.apple.foundationdb.annotation.API;
import com.apple.foundationdb.record.ObjectPlanHash;
import com.apple.foundationdb.record.PlanHashable;
import com.apple.foundationdb.record.RecordMetaDataProto;
import com.apple.foundationdb.record.expressions.RecordKeyExpressionProto;
import com.apple.foundationdb.record.metadata.Key;
import com.apple.foundationdb.record.provider.foundationdb.FDBRecord;
import com.apple.foundationdb.record.query.plan.cascades.KeyExpressionVisitor;
Expand All @@ -45,8 +45,8 @@ public class EmptyKeyExpression extends BaseKeyExpression implements KeyExpressi
private static final ObjectPlanHash BASE_HASH = new ObjectPlanHash("Empty-Key-Expression");

public static final EmptyKeyExpression EMPTY = new EmptyKeyExpression();
public static final RecordMetaDataProto.KeyExpression EMPTY_PROTO =
RecordMetaDataProto.KeyExpression.newBuilder().setEmpty(EMPTY.toProto()).build();
public static final RecordKeyExpressionProto.KeyExpression EMPTY_PROTO =
RecordKeyExpressionProto.KeyExpression.newBuilder().setEmpty(EMPTY.toProto()).build();

private EmptyKeyExpression() {
// nothing to initialize
Expand Down Expand Up @@ -75,8 +75,8 @@ public int getColumnSize() {

@Nonnull
@Override
public RecordMetaDataProto.Empty toProto() throws SerializationException {
return RecordMetaDataProto.Empty.getDefaultInstance();
public RecordKeyExpressionProto.Empty toProto() throws SerializationException {
return RecordKeyExpressionProto.Empty.getDefaultInstance();
}

@Nonnull
Expand All @@ -87,7 +87,7 @@ public <S extends KeyExpressionVisitor.State, R> R expand(@Nonnull final KeyExpr

@Nonnull
@Override
public RecordMetaDataProto.KeyExpression toKeyExpression() {
public RecordKeyExpressionProto.KeyExpression toKeyExpression() {
return EMPTY_PROTO;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.apple.foundationdb.record.ObjectPlanHash;
import com.apple.foundationdb.record.PlanHashable;
import com.apple.foundationdb.record.RecordCoreException;
import com.apple.foundationdb.record.RecordMetaDataProto;
import com.apple.foundationdb.record.expressions.RecordKeyExpressionProto;
import com.apple.foundationdb.record.logging.LogMessageKeys;
import com.apple.foundationdb.record.metadata.Key;
import com.apple.foundationdb.record.provider.foundationdb.FDBRecord;
Expand Down Expand Up @@ -71,7 +71,7 @@ public FieldKeyExpression(@Nonnull String fieldName, @Nonnull FanType fanType, @
this.nullStandin = nullStandin;
}

public FieldKeyExpression(@Nonnull RecordMetaDataProto.Field field) throws DeserializationException {
public FieldKeyExpression(@Nonnull RecordKeyExpressionProto.Field field) throws DeserializationException {
if (!field.hasFieldName()) {
throw new DeserializationException("Serialized Field is missing field name");
}
Expand Down Expand Up @@ -193,8 +193,8 @@ public int getColumnSize() {

@Nonnull
@Override
public RecordMetaDataProto.Field toProto() throws SerializationException {
return RecordMetaDataProto.Field.newBuilder()
public RecordKeyExpressionProto.Field toProto() throws SerializationException {
return RecordKeyExpressionProto.Field.newBuilder()
.setFieldName(fieldName)
.setFanType(fanType.toProto())
.setNullInterpretation(nullStandin.toProto())
Expand All @@ -203,8 +203,8 @@ public RecordMetaDataProto.Field toProto() throws SerializationException {

@Nonnull
@Override
public RecordMetaDataProto.KeyExpression toKeyExpression() {
return RecordMetaDataProto.KeyExpression.newBuilder().setField(toProto()).build();
public RecordKeyExpressionProto.KeyExpression toKeyExpression() {
return RecordKeyExpressionProto.KeyExpression.newBuilder().setField(toProto()).build();
}

@Nonnull
Expand Down
Loading