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 2020/01/10 19:03:26 UTC

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

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

 ##########
 File path: processing/src/main/java/org/apache/druid/segment/join/Joinable.java
 ##########
 @@ -0,0 +1,74 @@
+/*
+ * 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 org.apache.druid.segment.ColumnSelectorFactory;
+import org.apache.druid.segment.column.ColumnCapabilities;
+
+import javax.annotation.Nullable;
+import java.util.List;
+
+/**
+ * Represents something that can be the right-hand side of a join.
+ *
+ * This class's most important method is {@link #makeJoinMatcher}. Its main user is
+ * {@link HashJoinEngine#makeJoinCursor}.
+ */
+public interface Joinable
+{
+  int CARDINALITY_UNKNOWN = -1;
+
+  /**
+   * Returns the list of columns that this Joinable offers.
+   */
+  List<String> getAvailableColumns();
+
+  /**
+   * Returns the cardinality of "columnName", or {@link #CARDINALITY_UNKNOWN} if not known. May be used at query
+   * time to trigger optimizations.
+   */
+  int getCardinality(String columnName);
+
+  /**
+   * Returns capabilities for one of this Joinable's columns.
+   *
+   * @param columnName column name
+   *
+   * @return capabilities, or null if the columnName is not one of this Joinable's columns
+   */
+  @Nullable
+  ColumnCapabilities getColumnCapabilities(String columnName);
 
 Review comment:
   I made this one nullable since it mirrors a lot of other methods with identical signature in other interfaces. I didn't want to change them all and I thought it'd be nice for them to echo each other.
   
   I still think changing them all in this PR is a bad idea, but maybe the echoing is _also_ a bad idea, and the right thing would be to make this one an Optional.
   
   What do you think?

----------------------------------------------------------------
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