-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make dimension column extensible with COMPLEX type #10277
Changes from 9 commits
bb93426
ef550dc
a9eb0f8
7535e3d
4998a0c
026ca40
3cc4de7
a2a7d9e
aef7890
5ccbf40
fa365ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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; | ||
|
||
public interface DimensionHandlerProvider | ||
<EncodedType extends Comparable<EncodedType>, EncodedKeyComponentType, ActualType extends Comparable<ActualType>> | ||
{ | ||
DimensionHandler<EncodedType, EncodedKeyComponentType, ActualType> get(String dimensionName); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,7 +289,12 @@ protected IncrementalIndex( | |
for (DimensionSchema dimSchema : dimensionsSpec.getDimensions()) { | ||
ValueType type = dimSchema.getValueType(); | ||
String dimName = dimSchema.getName(); | ||
ColumnCapabilitiesImpl capabilities = makeDefaultCapabilitiesFromValueType(type); | ||
|
||
// Note: Things might be simpler if DimensionSchema had a method "getColumnCapabilities()" which could return | ||
// type specific capabilities by itself. However, for various reasons, DimensionSchema currently lives in druid-core | ||
// while ColumnCapabilities lives in druid-processing which makes that approach difficult. | ||
ColumnCapabilitiesImpl capabilities = makeDefaultCapabilitiesFromValueType(type, dimSchema.getTypeName()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apologies for the conflicts here, I made some semi disruptive changes to push There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be alright, I will update this PR later when I have my MapStringString extension ready/deployed and tested with changes in this patch. thanks for the heads up. |
||
|
||
capabilities.setHasBitmapIndexes(dimSchema.hasBitmapIndex()); | ||
|
||
if (dimSchema.getTypeName().equals(DimensionSchema.SPATIAL_TYPE_NAME)) { | ||
|
@@ -588,7 +593,7 @@ IncrementalIndexRowResult toIncrementalIndexRow(InputRow row) | |
dimension, | ||
// for schemaless type discovery, everything is a String. this should probably try to autodetect | ||
// based on the value to use a better handler | ||
makeDefaultCapabilitiesFromValueType(ValueType.STRING), | ||
makeDefaultCapabilitiesFromValueType(ValueType.STRING, null), | ||
null | ||
) | ||
); | ||
|
@@ -839,7 +844,7 @@ public List<String> getDimensionOrder() | |
} | ||
} | ||
|
||
private ColumnCapabilitiesImpl makeDefaultCapabilitiesFromValueType(ValueType type) | ||
private ColumnCapabilitiesImpl makeDefaultCapabilitiesFromValueType(ValueType type, String typeName) | ||
{ | ||
switch (type) { | ||
case STRING: | ||
|
@@ -850,7 +855,7 @@ private ColumnCapabilitiesImpl makeDefaultCapabilitiesFromValueType(ValueType ty | |
.setDictionaryValuesUnique(true) | ||
.setDictionaryValuesSorted(false); | ||
case COMPLEX: | ||
return ColumnCapabilitiesImpl.createSimpleNumericColumnCapabilities(type).setHasNulls(true); | ||
return ColumnCapabilitiesImpl.createSimpleNumericColumnCapabilities(type).setHasNulls(true).setComplexTypeName(typeName); | ||
default: | ||
return ColumnCapabilitiesImpl.createSimpleNumericColumnCapabilities(type); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this should be
setComplexTypeName
probably to match capabilitiesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, yeah updated, I missed it.