Jackie-Jiang commented on a change in pull request #5115: Refactor the data
source to include all information needed for query execution
URL: https://github.com/apache/incubator-pinot/pull/5115#discussion_r390566766
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/common/DataSourceMetadata.java
##########
@@ -18,24 +18,79 @@
*/
package org.apache.pinot.core.common;
-import org.apache.pinot.spi.data.FieldSpec.DataType;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.apache.pinot.core.data.partition.PartitionFunction;
+import org.apache.pinot.spi.data.FieldSpec;
+/**
+ * The {@code DataSourceMetadata} class contains all the metadata for a column
for query execution purpose.
+ */
public interface DataSourceMetadata {
- DataType getDataType();
+ /**
+ * Returns the field spec of the column.
+ */
+ FieldSpec getFieldSpec();
+
+ /**
+ * Returns the data type of the column.
+ */
+ default FieldSpec.DataType getDataType() {
+ return getFieldSpec().getDataType();
+ }
- boolean isSingleValue();
+ /**
+ * Returns {@code true} if the column is single-valued, {@code false}
otherwise.
+ */
+ default boolean isSingleValue() {
+ return getFieldSpec().isSingleValueField();
+ }
+ /**
+ * Returns {@code true} if the column is sorted, {@code false} otherwise.
+ */
boolean isSorted();
+ /**
+ * Returns the number of documents of the column.
+ */
int getNumDocs();
- int getMaxNumMultiValues();
+ /**
+ * Returns the number of values of the column. For single-value column,
number of values always equals to number of
+ * documents; for multi-value column, each document (multi-value entry) may
contain multiple values.
+ */
+ int getNumValues();
+
+ /**
+ * Returns the maximum number of values for each multi-value entry of the
multi-value column. For single-value column,
+ * the value is undefined.
Review comment:
Want to avoid the if check for every call. Make it return -1 for
single-value column
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]