You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/09/08 23:02:50 UTC
[PR] longer compatibility window for nested column format v4 (druid)
clintropolis opened a new pull request, #14955:
URL: https://github.com/apache/druid/pull/14955
### Description
Follow up to #14456, which in retrospect was a bit overly aggressive in removing the ability to serialize v4 of the nested column format in favor of always using the latest and greatest. This PR adds back the serializers, as well as introduces a system config to allow for more flexibility in what versions can be upgraded from.
changes:
* add back nested column v4 serializers
* 'json' schema by default still uses the newer 'nested common format' used by 'auto', but now has an optional 'formatVersion' property which can be specified to override format versions on native ingest jobs
* add system config to specify default column format stuff, 'druid.indexing.formats', and property 'druid.indexing.formats.nestedColumnFormatVersion' to specify system level preferred nested column format for friendly rolling upgrades from versions which do not support the newer 'nested common format' used by 'auto'
#### Release note
Add system level runtime.properties option to specify default column format stuff, with prefix 'druid.indexing.formats', and property 'druid.indexing.formats.nestedColumnFormatVersion' to specify preferred nested column format for friendly rolling upgrades from Druid 25 to Druid 28.
<hr>
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on code in PR #14955:
URL: https://github.com/apache/druid/pull/14955#discussion_r1320982797
##########
processing/src/main/java/org/apache/druid/segment/NestedDataColumnSchema.java:
##########
@@ -0,0 +1,121 @@
+/*
+ * 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;
+
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.segment.column.ColumnType;
+import org.apache.druid.segment.nested.NestedDataComplexTypeSerde;
+
+import javax.annotation.Nullable;
+import java.util.Objects;
+
+public class NestedDataColumnSchema extends DimensionSchema
Review Comment:
can you add some javadocs here? This is where things kinda fork off between v4 and auto.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "clintropolis (via GitHub)" <gi...@apache.org>.
clintropolis merged PR #14955:
URL: https://github.com/apache/druid/pull/14955
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "abhishekagarwal87 (via GitHub)" <gi...@apache.org>.
abhishekagarwal87 commented on code in PR #14955:
URL: https://github.com/apache/druid/pull/14955#discussion_r1322466938
##########
processing/src/main/java/org/apache/druid/segment/DefaultColumnFormatConfig.java:
##########
@@ -21,12 +21,24 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.error.DruidException;
import javax.annotation.Nullable;
import java.util.Objects;
public class DefaultColumnFormatConfig
{
+ public static void validateNestedFormatVersion(@Nullable Integer formatVersion)
+ {
+ if (formatVersion != null) {
+ if (formatVersion < 4 || formatVersion > 5) {
+ throw DruidException.forPersona(DruidException.Persona.USER)
+ .ofCategory(DruidException.Category.INVALID_INPUT)
+ .build("Unsupported nested column format version[%s]", formatVersion);
Review Comment:
Nit - can you add in the error message that supported values are 4 and 5?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "pranavbhole (via GitHub)" <gi...@apache.org>.
pranavbhole commented on PR #14955:
URL: https://github.com/apache/druid/pull/14955#issuecomment-1714219457
need to fix the func tests.
` Run 4: DumpSegmentTest.testDumpNestedColumnPath:196->createSegments:250 ยป ValueInstantiation Cannot construct instance of `org.apache.druid.segment.NestedDataColumnSchema`, problem: No injectable id with value 'org.apache.druid.segment.DefaultColumnFormatConfig' found (for property '')`
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org>.
github-code-scanning[bot] commented on code in PR #14955:
URL: https://github.com/apache/druid/pull/14955#discussion_r1320426982
##########
processing/src/test/java/org/apache/druid/segment/nested/NestedDataColumnSupplierV4Test.java:
##########
@@ -319,36 +475,111 @@
.computeBitmapResult(resultFactory)
.get(rowNumber));
Assert.assertFalse(nullValueIndex.get().computeBitmapResult(resultFactory).get(rowNumber));
-
Assert.assertTrue(dimSelector.makeValueMatcher(theString).matches());
Assert.assertFalse(dimSelector.makeValueMatcher(NO_MATCH).matches());
Assert.assertTrue(dimSelector.makeValueMatcher(x -> Objects.equals(x, theString)).matches());
Assert.assertFalse(dimSelector.makeValueMatcher(x -> Objects.equals(x, NO_MATCH)).matches());
} else {
Assert.assertNull(valueSelector.getObject());
Assert.assertTrue(path, valueSelector.isNull());
-
Assert.assertEquals(0, dimSelector.getRow().get(0));
Assert.assertNull(dimSelector.getObject());
Assert.assertNull(dimSelector.lookupName(dimSelector.getRow().get(0)));
-
Assert.assertTrue(valueSetIndex.forValue(null).computeBitmapResult(resultFactory).get(rowNumber));
Assert.assertTrue(nullValueIndex.get().computeBitmapResult(resultFactory).get(rowNumber));
Assert.assertTrue(predicateIndex.forPredicate(new SelectorPredicateFactory(null))
.computeBitmapResult(resultFactory)
.get(rowNumber));
Assert.assertFalse(valueSetIndex.forValue(NO_MATCH).computeBitmapResult(resultFactory).get(rowNumber));
-
-
Assert.assertFalse(valueSetIndex.forValue(NO_MATCH).computeBitmapResult(resultFactory).get(rowNumber));
Assert.assertFalse(predicateIndex.forPredicate(new SelectorPredicateFactory(NO_MATCH))
.computeBitmapResult(resultFactory)
.get(rowNumber));
-
Assert.assertTrue(dimSelector.makeValueMatcher((String) null).matches());
Assert.assertFalse(dimSelector.makeValueMatcher(NO_MATCH).matches());
Assert.assertTrue(dimSelector.makeValueMatcher(x -> x == null).matches());
Assert.assertFalse(dimSelector.makeValueMatcher(x -> Objects.equals(x, NO_MATCH)).matches());
}
}
+
+ private static class SettableSelector extends ObjectColumnSelector<StructuredData>
+ {
+ private StructuredData data;
+
+ public void setObject(StructuredData o)
+ {
+ this.data = o;
+ }
+
+ @Nullable
+ @Override
+ public StructuredData getObject()
+ {
+ return data;
+ }
+
+ @Override
+ public Class classOfObject()
+ {
+ return StructuredData.class;
+ }
+
+ @Override
+ public void inspectRuntimeShape(RuntimeShapeInspector inspector)
+ {
+
+ }
+ }
+
+ private static class OnlyPositionalReadsTypeStrategy<T> implements TypeStrategy<T>
Review Comment:
## Unused classes and interfaces
Unused class: OnlyPositionalReadsTypeStrategy is not referenced within this codebase. If not used as an external API it should be removed.
[Show more details](https://github.com/apache/druid/security/code-scanning/4827)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org
Re: [PR] longer compatibility window for nested column format v4 (druid)
Posted by "clintropolis (via GitHub)" <gi...@apache.org>.
clintropolis commented on code in PR #14955:
URL: https://github.com/apache/druid/pull/14955#discussion_r1323574477
##########
processing/src/main/java/org/apache/druid/segment/DefaultColumnFormatConfig.java:
##########
@@ -21,12 +21,24 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.error.DruidException;
import javax.annotation.Nullable;
import java.util.Objects;
public class DefaultColumnFormatConfig
{
+ public static void validateNestedFormatVersion(@Nullable Integer formatVersion)
+ {
+ if (formatVersion != null) {
+ if (formatVersion < 4 || formatVersion > 5) {
+ throw DruidException.forPersona(DruidException.Persona.USER)
+ .ofCategory(DruidException.Category.INVALID_INPUT)
+ .build("Unsupported nested column format version[%s]", formatVersion);
Review Comment:
i think im going to skip this for now to not churn through CI again, and also seems like we should find some programmatic way to list what versions are supported so the error messaging doesn't become stale if we add another version. Also the versions are still kind of confusing so idk how I feel about exposing them too much, 4 makes sense, but 5 is a virtual version since 5 is really version 0 of the new nested common format introduced by 'auto'.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org