clintropolis commented on a change in pull request #9731:
URL: https://github.com/apache/druid/pull/9731#discussion_r435570351
##########
File path:
processing/src/main/java/org/apache/druid/segment/column/ColumnCapabilitiesImpl.java
##########
@@ -31,23 +31,66 @@
*/
public class ColumnCapabilitiesImpl implements ColumnCapabilities
{
- public static ColumnCapabilitiesImpl copyOf(final ColumnCapabilities other)
+ public static ColumnCapabilitiesImpl copyOf(@Nullable final
ColumnCapabilities other)
{
final ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl();
- capabilities.merge(other);
- capabilities.setFilterable(other.isFilterable());
- capabilities.setIsComplete(other.isComplete());
+ if (other != null) {
+ capabilities.type = other.getType();
+ capabilities.dictionaryEncoded = other.isDictionaryEncoded();
+ capabilities.runLengthEncoded = other.isRunLengthEncoded();
+ capabilities.hasInvertedIndexes = other.hasBitmapIndexes();
+ capabilities.hasSpatialIndexes = other.hasSpatialIndexes();
+ capabilities.hasMultipleValues = other.hasMultipleValues();
+ capabilities.dictionaryValuesSorted = other.areDictionaryValuesSorted();
+ capabilities.dictionaryValuesUnique = other.areDictionaryValuesUnique();
+ capabilities.filterable = other.isFilterable();
+ }
return capabilities;
}
+ /**
+ * Used at indexing time to finalize all {@link
ColumnCapabilities.Capable#UNKNOWN} values to
+ * {@link ColumnCapabilities.Capable#FALSE}, in order to present a snapshot
of the state of the this column
+ */
+ @Nullable
+ public static ColumnCapabilitiesImpl complete(
+ @Nullable final ColumnCapabilities capabilities,
+ boolean convertUnknownToTrue
+ )
+ {
+ if (capabilities == null) {
+ return null;
+ }
+ ColumnCapabilitiesImpl copy = copyOf(capabilities);
+ copy.hasMultipleValues =
copy.hasMultipleValues.complete(convertUnknownToTrue);
+ copy.dictionaryValuesSorted =
copy.dictionaryValuesSorted.complete(convertUnknownToTrue);
+ copy.dictionaryValuesUnique =
copy.dictionaryValuesUnique.complete(convertUnknownToTrue);
+ return copy;
+ }
+
+
+ /**
+ * Create a no frills, simple column with {@link ValueType} set and
everything else false
+ */
+ public static ColumnCapabilitiesImpl createSimpleNumericColumn(ValueType
valueType)
Review comment:
renamed, except to `createSimpleNumericColumnCapabilities` because i
wasn't paying enough attention to the suggestion i guess, but also ok i think
:shrug:
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]