You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/12/30 21:31:16 UTC

[GitHub] [druid] jnaous commented on a change in pull request #9111: Add HashJoinSegment, a virtual segment for joins.

jnaous commented on a change in pull request #9111: Add HashJoinSegment, a virtual segment for joins.
URL: https://github.com/apache/druid/pull/9111#discussion_r362101065
 
 

 ##########
 File path: processing/src/test/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapterTest.java
 ##########
 @@ -0,0 +1,1361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.druid.segment.join;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+import org.apache.druid.common.config.NullHandling;
+import org.apache.druid.java.util.common.DateTimes;
+import org.apache.druid.java.util.common.Intervals;
+import org.apache.druid.java.util.common.StringUtils;
+import org.apache.druid.java.util.common.granularity.Granularities;
+import org.apache.druid.math.expr.ExprMacroTable;
+import org.apache.druid.query.filter.ExpressionDimFilter;
+import org.apache.druid.query.filter.OrDimFilter;
+import org.apache.druid.query.filter.SelectorDimFilter;
+import org.apache.druid.query.lookup.LookupExtractor;
+import org.apache.druid.segment.QueryableIndexSegment;
+import org.apache.druid.segment.VirtualColumns;
+import org.apache.druid.segment.column.ColumnCapabilities;
+import org.apache.druid.segment.column.ValueType;
+import org.apache.druid.segment.join.lookup.LookupJoinable;
+import org.apache.druid.segment.join.table.IndexedTable;
+import org.apache.druid.segment.join.table.IndexedTableJoinable;
+import org.apache.druid.segment.virtual.ExpressionVirtualColumn;
+import org.apache.druid.timeline.SegmentId;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.TemporaryFolder;
+
+import java.io.IOException;
+import java.util.Collections;
+
+public class HashJoinSegmentStorageAdapterTest
+{
+  private static final String FACT_TO_COUNTRY_ON_ISO_CODE_PREFIX = "c1.";
+  private static final String FACT_TO_COUNTRY_ON_NUMBER_PREFIX = "c2.";
+  private static final String FACT_TO_REGION_PREFIX = "r1.";
+  private static final String REGION_TO_COUNTRY_PREFIX = "rtc.";
+  private static Long NULL_COUNTRY;
+
+  @Rule
+  public ExpectedException expectedException = ExpectedException.none();
+
+  @Rule
+  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+  public QueryableIndexSegment factSegment;
+  public LookupExtractor countryIsoCodeToNameLookup;
+  public LookupExtractor countryNumberToNameLookup;
+  public IndexedTable countriesTable;
+  public IndexedTable regionsTable;
+
+  @BeforeClass
+  public static void setUpStatic()
+  {
+    NullHandling.initializeForTests();
+    NULL_COUNTRY = NullHandling.sqlCompatible() ? null : 0L;
+  }
+
+  @Before
+  public void setUp() throws IOException
+  {
+    factSegment = new QueryableIndexSegment(
+        JoinTestHelper.createFactIndexBuilder(temporaryFolder.newFolder()).buildMMappedIndex(),
+        SegmentId.dummy("facts")
+    );
+    countryIsoCodeToNameLookup = JoinTestHelper.createCountryIsoCodeToNameLookup();
+    countryNumberToNameLookup = JoinTestHelper.createCountryNumberToNameLookup();
+    countriesTable = JoinTestHelper.createCountriesIndexedTable();
+    regionsTable = JoinTestHelper.createRegionsIndexedTable();
+  }
+
+  @After
+  public void tearDown()
+  {
+    if (factSegment != null) {
+      factSegment.close();
+    }
+  }
+
+  @Test
+  public void test_getInterval_factToCountry()
 
 Review comment:
   `factToCountry` isn't really a condition for the test. Is this testing a normal or error case? What kind? I would add also add an expected section to the name like `shouldBeReturned`. Something like `test_getInterval_intervalWithinJoinedSegment_shouldBeReturned()`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org