Class ElasticSearchAdapterTest


  • public class ElasticSearchAdapterTest
    extends java.lang.Object
    Set of tests for ES adapter. Uses real instance via EmbeddedElasticsearchPolicy. Document source is local zips-mini.json file (located in test classpath).
    • Constructor Detail

      • ElasticSearchAdapterTest

        public ElasticSearchAdapterTest()
    • Method Detail

      • setupInstance

        public static void setupInstance()
                                  throws java.lang.Exception
        Used to create zips index and insert zip data in bulk.
        Throws:
        java.lang.Exception - when instance setup failed
      • view

        public void view()
        Tests using calcite view
      • emptyResult

        public void emptyResult()
      • basic

        public void basic()
      • testSort

        public void testSort()
      • testSortLimit

        public void testSortLimit()
      • sortedResultSetChecker

        private static java.util.function.Consumer<java.sql.ResultSet> sortedResultSetChecker​(java.lang.String column,
                                                                                              org.apache.calcite.rel.RelFieldCollation.Direction direction)
        Throws AssertionError if result set is not sorted by column. nulls are ignored.
        Parameters:
        column - column to be extracted (as comparable object).
        direction - ascending / descending
        Returns:
        consumer which throws exception
      • testSortNoSchema

        public void testSortNoSchema()
        Sorting (and aggregating) directly on items without a view.

        Queries of type: select _MAP['a'] from elastic order by _MAP['b']

      • sortAscDesc

        public void sortAscDesc()
        Sort by multiple fields (in different direction: asc/desc)
      • testOffsetLimit

        public void testOffsetLimit()
      • testLimit

        public void testLimit()
      • limit2

        public void limit2()
      • testFilterSort

        public void testFilterSort()
      • testFilterSortDesc

        public void testFilterSortDesc()
      • testInPlan

        public void testInPlan()
      • testZips

        public void testZips()
      • testProject

        public void testProject()
      • testFilter

        public void testFilter()
      • testFilterReversed

        public void testFilterReversed()
      • agg1

        public void agg1()
      • groupBy

        public void groupBy()
      • notOperator

        public void notOperator()
        Testing NOT operator
      • approximateCount

        public void approximateCount()
                              throws java.lang.Exception
        Test of SqlStdOperatorTable.APPROX_COUNT_DISTINCT which will be translated to Cardinality Aggregation (approximate counts using HyperLogLog++ algorithm).
        Throws:
        java.lang.Exception