Class AbstractColumnarArrayOrderFieldDataTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase

public abstract class AbstractColumnarArrayOrderFieldDataTestCase extends MapperServiceTestCase
Shared fielddata coverage for high-cardinality fields in strictly columnar mode that store their values in document order with inline nulls (MultiValuedBinaryDocValuesField.ArrayOrderInlineNull) instead of a sidecar .offsets field. Loads values through the mapper's fielddata builder (so the mapper-to-fielddata wiring is exercised), which sorts within a document, drops nulls and keeps duplicates. Concrete subclasses supply the field type (keyword, text, match_only_text).
  • Constructor Details

    • AbstractColumnarArrayOrderFieldDataTestCase

      public AbstractColumnarArrayOrderFieldDataTestCase()
  • Method Details

    • fieldTypeName

      protected abstract String fieldTypeName()
    • setUp

      public final void setUp() throws Exception
      Overrides:
      setUp in class org.apache.lucene.tests.util.LuceneTestCase
      Throws:
      Exception
    • readFielddataValues

      protected List<String> readFielddataValues(MapperService mapperService, CheckedConsumer<XContentBuilder,IOException> doc) throws IOException
      Indexes a single document and returns the fielddata values exposed for it, or null when the field has no non-null values for that document (an all-null or empty array, which fielddata reports as no values via advanceExact == false).
      Throws:
      IOException
    • randomDistinctValues

      protected List<String> randomDistinctValues(int n)
      Generates n distinct values for the field under test. The default produces fixed-length alphanumerics; subclasses whose values aren't plain strings (ex. ip) override this together with decode(org.apache.lucene.util.BytesRef) and expectedFielddataOrder(java.util.List<java.lang.String>).
    • decode

      protected String decode(org.apache.lucene.util.BytesRef value)
      Decodes a raw fielddata BytesRef into the value's textual form. The default reads utf8; subclasses whose doc values store a non-utf8 encoding (ex. the IpFieldMapper InetAddressPoint encoding) override this.
    • expectedFielddataOrder

      protected List<String> expectedFielddataOrder(List<String> values)
      Returns values in the order fielddata exposes them within a document (sorted, with duplicates kept). The default uses natural string ordering, which matches BytesRef ordering for equal-length alphanumerics; subclasses whose binary ordering differs from string ordering (ex. ip) override this.
    • testMultiValuedReadsBackSorted

      public void testMultiValuedReadsBackSorted() throws IOException
      Throws:
      IOException
    • testDuplicatesKept

      public void testDuplicatesKept() throws IOException
      Throws:
      IOException
    • testNullsDropped

      public void testNullsDropped() throws IOException
      Throws:
      IOException
    • testSingleValue

      public void testSingleValue() throws IOException
      Throws:
      IOException
    • testAllNullArrayHasNoValues

      public void testAllNullArrayHasNoValues() throws IOException
      Throws:
      IOException
    • testEmptyArrayHasNoValues

      public void testEmptyArrayHasNoValues() throws IOException
      Throws:
      IOException