ColumnValidation (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.document.column, class: ColumnValidation

Package org.apache.lucene.document.column

# Class ColumnValidation

java.lang.Object
org.apache.lucene.document.column.ColumnValidation

public final class ColumnValidation extends Object
Static validation and bounds-checking helpers for the columnar indexing path. These helpers are pure functions over the public column API and `IndexableFieldType`; they do not touch any indexing-chain state.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `checkDenseCount(Column column, int consumed, int numDocs)`
  Throws if a dense column did not produce exactly `numDocs` values.
  `static void`
  `checkDocID(Column column, int batchDocID, int numDocs)`
  Throws if `batchDocID` is outside `[0, numDocs)`.
  `static void`
  `checkVectorDimension(VectorColumn<?> column, int actual, int expected, int batchDocID)`
  Throws if a vector value's length does not match the field's declared dimension.
  `static void`
  `checkVectorDocIDStrictlyIncreasing(VectorColumn<?> column, int batchDocID, int prevBatchDocID)`
  Throws if a vector cursor doc-id is not strictly greater than the previous one.
  `static int`
  `featureMask(IndexableFieldType fieldType)`
  Returns a bitmask of the indexing features (`FEATURE_*`) declared by `fieldType`.
  `static String`
  `featureNames(int mask)`
  Returns a human-readable comma-separated list of the feature names set in `mask`.
  `static void`
  `validateBinaryColumn(BinaryColumn column, IndexableFieldType fieldType)`
  Validates a `BinaryColumn` against the field type it will feed.
  `static void`
  `validateColumnHasIndexingFeature(String fieldName, IndexableFieldType fieldType)`
  Throws `IllegalArgumentException` if `fieldType` declares no indexing feature (no doc values, no points, not stored, no index options, no vectors).
  `static void`
  `validateDictionaryColumn(DictionaryColumn column, IndexableFieldType fieldType)`
  Validates a `DictionaryColumn` against the field type it will feed.
  `static void`
  `validateLongColumn(LongColumn column, IndexableFieldType fieldType)`
  Validates a `LongColumn` against the field type it will feed.
  `static void`
  `validateTokenStreamColumn(TokenStreamColumn column, IndexableFieldType fieldType)`
  Validates a `TokenStreamColumn` against the field type it will feed.
  `static void`
  `validateVectorColumn(VectorColumn<?> column, IndexableFieldType fieldType)`
  Validates a `VectorColumn` against the field type it will feed.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### featureMask

    public static int featureMask(IndexableFieldType fieldType)
    Returns a bitmask of the indexing features (`FEATURE_*`) declared by `fieldType`. Used by the column-batch path to enforce that, when several columns share a field name, each feature is carried by at most one column.

  - ### featureNames

    public static String featureNames(int mask)
    Returns a human-readable comma-separated list of the feature names set in `mask`.

  - ### validateColumnHasIndexingFeature

    public static void validateColumnHasIndexingFeature(String fieldName, IndexableFieldType fieldType)
    Throws `IllegalArgumentException` if `fieldType` declares no indexing feature (no doc values, no points, not stored, no index options, no vectors).

  - ### validateLongColumn

    public static void validateLongColumn(LongColumn column, IndexableFieldType fieldType)
    Validates a `LongColumn` against the field type it will feed.

  - ### validateBinaryColumn

    public static void validateBinaryColumn(BinaryColumn column, IndexableFieldType fieldType)
    Validates a `BinaryColumn` against the field type it will feed.

  - ### validateDictionaryColumn

    public static void validateDictionaryColumn(DictionaryColumn column, IndexableFieldType fieldType)
    Validates a `DictionaryColumn` against the field type it will feed.

  - ### validateTokenStreamColumn

    public static void validateTokenStreamColumn(TokenStreamColumn column, IndexableFieldType fieldType)
    Validates a `TokenStreamColumn` against the field type it will feed.

  - ### validateVectorColumn

    public static void validateVectorColumn(VectorColumn<?> column, IndexableFieldType fieldType)
    Validates a `VectorColumn` against the field type it will feed.

  - ### checkDocID

    public static void checkDocID(Column column, int batchDocID, int numDocs)
    Throws if `batchDocID` is outside `[0, numDocs)`.

  - ### checkDenseCount

    public static void checkDenseCount(Column column, int consumed, int numDocs)
    Throws if a dense column did not produce exactly `numDocs` values.

  - ### checkVectorDocIDStrictlyIncreasing

    public static void checkVectorDocIDStrictlyIncreasing(VectorColumn<?> column, int batchDocID, int prevBatchDocID)
    Throws if a vector cursor doc-id is not strictly greater than the previous one.

  - ### checkVectorDimension

    public static void checkVectorDimension(VectorColumn<?> column, int actual, int expected, int batchDocID)
    Throws if a vector value's length does not match the field's declared dimension.