Record Class SchemaCacheEntry
java.lang.Object
java.lang.Record
org.elasticsearch.xpack.esql.datasources.cache.SchemaCacheEntry
public record SchemaCacheEntry(String[] columnNames, DataType[] columnTypes, Nullability[] columnNullabilities, boolean[] columnSynthetics, String sourceType, String location, Map<String,Object> safeMetadata, Map<String,Object> connectorConfig, long cachedAtMillis)
extends Record
Cache entry for schema inference results. Stores raw schema data (names, types,
nullabilities) instead of Attribute objects to avoid NameId sharing across queries.
Each call to
toAttributes() reconstructs fresh ReferenceAttribute instances
with fresh NameIds, ensuring safe concurrent use.-
Constructor Summary
ConstructorsConstructorDescriptionSchemaCacheEntry(String[] columnNames, DataType[] columnTypes, Nullability[] columnNullabilities, boolean[] columnSynthetics, String sourceType, String location, Map<String, Object> safeMetadata, Map<String, Object> connectorConfig, long cachedAtMillis) Creates an instance of aSchemaCacheEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the value of thecachedAtMillisrecord component.String[]Returns the value of thecolumnNamesrecord component.Returns the value of thecolumnNullabilitiesrecord component.boolean[]Returns the value of thecolumnSyntheticsrecord component.DataType[]Returns the value of thecolumnTypesrecord component.Returns the value of theconnectorConfigrecord component.final booleanIndicates whether some other object is "equal to" this one.longstatic SchemaCacheEntryfrom(List<Attribute> schema, String sourceType, String location, Map<String, Object> metadata, Map<String, Object> connectorConfig) static SchemaCacheEntryfrom(SourceMetadata meta) Flattens aSourceMetadata's stats into its metadata map.final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.Returns the value of thesafeMetadatarecord component.Returns the value of thesourceTyperecord component.Reconstructs fresh Attributes with fresh NameIds -- safe for concurrent queriesfinal StringtoString()Returns a string representation of this record class.withSafeMetadata(Map<String, Object> metadata) An identical entry whosesafeMetadatais replaced withmetadata— the schema-cache enrichment helper: entries are immutable, so a stats commit copies the metadata, mutates the copy, and swaps the whole entry.
-
Constructor Details
-
SchemaCacheEntry
public SchemaCacheEntry(String[] columnNames, DataType[] columnTypes, Nullability[] columnNullabilities, boolean[] columnSynthetics, String sourceType, String location, Map<String, Object> safeMetadata, Map<String, Object> connectorConfig, long cachedAtMillis) Creates an instance of aSchemaCacheEntryrecord class.- Parameters:
columnNames- the value for thecolumnNamesrecord componentcolumnTypes- the value for thecolumnTypesrecord componentcolumnNullabilities- the value for thecolumnNullabilitiesrecord componentcolumnSynthetics- the value for thecolumnSyntheticsrecord componentsourceType- the value for thesourceTyperecord componentlocation- the value for thelocationrecord componentsafeMetadata- the value for thesafeMetadatarecord componentconnectorConfig- the value for theconnectorConfigrecord componentcachedAtMillis- the value for thecachedAtMillisrecord component
-
-
Method Details
-
withSafeMetadata
An identical entry whosesafeMetadatais replaced withmetadata— the schema-cache enrichment helper: entries are immutable, so a stats commit copies the metadata, mutates the copy, and swaps the whole entry. -
from
-
toAttributes
Reconstructs fresh Attributes with fresh NameIds -- safe for concurrent queries -
from
Flattens aSourceMetadata's stats into its metadata map. Replaces the inlined flatten-and-build at the cache-loader call sites. -
estimatedBytes
public long estimatedBytes() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
columnNames
Returns the value of thecolumnNamesrecord component.- Returns:
- the value of the
columnNamesrecord component
-
columnTypes
Returns the value of thecolumnTypesrecord component.- Returns:
- the value of the
columnTypesrecord component
-
columnNullabilities
Returns the value of thecolumnNullabilitiesrecord component.- Returns:
- the value of the
columnNullabilitiesrecord component
-
columnSynthetics
public boolean[] columnSynthetics()Returns the value of thecolumnSyntheticsrecord component.- Returns:
- the value of the
columnSyntheticsrecord component
-
sourceType
Returns the value of thesourceTyperecord component.- Returns:
- the value of the
sourceTyperecord component
-
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-
safeMetadata
Returns the value of thesafeMetadatarecord component.- Returns:
- the value of the
safeMetadatarecord component
-
connectorConfig
Returns the value of theconnectorConfigrecord component.- Returns:
- the value of the
connectorConfigrecord component
-
cachedAtMillis
public long cachedAtMillis()Returns the value of thecachedAtMillisrecord component.- Returns:
- the value of the
cachedAtMillisrecord component
-