You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/03/30 08:35:42 UTC
[GitHub] [lucene] iverase opened a new pull request #52: LUCENE-9705: Create Lucene90PointsFormat
iverase opened a new pull request #52:
URL: https://github.com/apache/lucene/pull/52
For now this is just a copy of Lucene86PointsFormat. The existing Lucene86PointsFormat is moved to backwards-codecs.
This is actually the last codec that needs to be moved to Lucene90 :)
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene] jtibshirani commented on a change in pull request #52: LUCENE-9705: Create Lucene90PointsFormat
Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #52:
URL: https://github.com/apache/lucene/pull/52#discussion_r604216342
##########
File path: lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90PointsFormat.java
##########
@@ -0,0 +1,425 @@
+/*
+ * 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.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import java.util.Arrays;
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.FilterCodec;
+import org.apache.lucene.codecs.PointsFormat;
+import org.apache.lucene.codecs.PointsReader;
+import org.apache.lucene.codecs.PointsWriter;
+import org.apache.lucene.document.BinaryPoint;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.BasePointsFormatTestCase;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.MockRandomMergePolicy;
+import org.apache.lucene.index.PointValues;
+import org.apache.lucene.index.PointValues.IntersectVisitor;
+import org.apache.lucene.index.PointValues.Relation;
+import org.apache.lucene.index.SegmentReadState;
+import org.apache.lucene.index.SegmentWriteState;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.bkd.BKDConfig;
+
+public class TestLucene90PointsFormat extends BasePointsFormatTestCase {
+
+ private final Codec codec;
+ private final int maxPointsInLeafNode;
+
+ public TestLucene90PointsFormat() {
+ // standard issue
+ Codec defaultCodec = TestUtil.getDefaultCodec();
+ if (random().nextBoolean()) {
+ // randomize parameters
+ maxPointsInLeafNode = TestUtil.nextInt(random(), 50, 500);
+ double maxMBSortInHeap = 3.0 + (3 * random().nextDouble());
+ if (VERBOSE) {
+ System.out.println(
+ "TEST: using Lucene60PointsFormat with maxPointsInLeafNode="
+ + maxPointsInLeafNode
+ + " and maxMBSortInHeap="
+ + maxMBSortInHeap);
+ }
+
+ // sneaky impersonation!
+ codec =
+ new FilterCodec(defaultCodec.getName(), defaultCodec) {
+ @Override
+ public PointsFormat pointsFormat() {
+ return new PointsFormat() {
+ @Override
+ public PointsWriter fieldsWriter(SegmentWriteState writeState) throws IOException {
+ return new Lucene90PointsWriter(writeState, maxPointsInLeafNode, maxMBSortInHeap);
+ }
+
+ @Override
+ public PointsReader fieldsReader(SegmentReadState readState) throws IOException {
+ return new Lucene90PointsReader(readState);
+ }
+ };
+ }
+ };
+ } else {
+ // standard issue
+ codec = defaultCodec;
+ maxPointsInLeafNode = BKDConfig.DEFAULT_MAX_POINTS_IN_LEAF_NODE;
+ }
+ }
+
+ @Override
+ protected Codec getCodec() {
+ return codec;
+ }
+
+ @Override
+ public void testMergeStability() throws Exception {
+ assumeFalse(
+ "TODO: mess with the parameters and test gets angry!", codec instanceof FilterCodec);
+ super.testMergeStability();
+ }
+
+ public void testEstimatePointCount() throws IOException {
Review comment:
Is it possible to move these methods to `BasePointsFormatTestCase`? It'd be nice to cut down on duplicated test cases.
##########
File path: lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/Lucene86PointsWriter.java
##########
@@ -60,40 +60,40 @@ public Lucene86PointsWriter(
IndexFileNames.segmentFileName(
writeState.segmentInfo.name,
writeState.segmentSuffix,
- Lucene86PointsFormat.DATA_EXTENSION);
+ Lucene86RWPointsFormat.DATA_EXTENSION);
Review comment:
Small comment, seems clearer to reference `Lucene86PointsFormat` here.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene] iverase merged pull request #52: LUCENE-9705: Create Lucene90PointsFormat
Posted by GitBox <gi...@apache.org>.
iverase merged pull request #52:
URL: https://github.com/apache/lucene/pull/52
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene] iverase commented on pull request #52: LUCENE-9705: Create Lucene90PointsFormat
Posted by GitBox <gi...@apache.org>.
iverase commented on pull request #52:
URL: https://github.com/apache/lucene/pull/52#issuecomment-810898971
> How does this affect your planned work in LUCENE-9047, which was a big motivation for creating these new codecs? Will you just add another 'internal version' for the endianness change?
I don't think we will need to add a new internal version. I think for backwards codecs we can wrap the IndexInputs so it would be transparent for the BKD reader.
> Confirming my understanding, we plan to follow up with something like LUCENE-9820 to avoid having to share so many classes with older codecs in the future?
I hope so :). What I am trying to avoid is to have to rewrite many BKD readers if we decide to change the Points API (for example [LUCENE-9619](https://issues.apache.org/jira/browse/LUCENE-9619)). So separating reading a specific Index format from the API should help.
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
[GitHub] [lucene] iverase commented on a change in pull request #52: LUCENE-9705: Create Lucene90PointsFormat
Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #52:
URL: https://github.com/apache/lucene/pull/52#discussion_r604701702
##########
File path: lucene/core/src/test/org/apache/lucene/codecs/lucene90/TestLucene90PointsFormat.java
##########
@@ -0,0 +1,425 @@
+/*
+ * 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.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import java.util.Arrays;
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.codecs.FilterCodec;
+import org.apache.lucene.codecs.PointsFormat;
+import org.apache.lucene.codecs.PointsReader;
+import org.apache.lucene.codecs.PointsWriter;
+import org.apache.lucene.document.BinaryPoint;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.index.BasePointsFormatTestCase;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.LeafReader;
+import org.apache.lucene.index.MockRandomMergePolicy;
+import org.apache.lucene.index.PointValues;
+import org.apache.lucene.index.PointValues.IntersectVisitor;
+import org.apache.lucene.index.PointValues.Relation;
+import org.apache.lucene.index.SegmentReadState;
+import org.apache.lucene.index.SegmentWriteState;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.util.TestUtil;
+import org.apache.lucene.util.bkd.BKDConfig;
+
+public class TestLucene90PointsFormat extends BasePointsFormatTestCase {
+
+ private final Codec codec;
+ private final int maxPointsInLeafNode;
+
+ public TestLucene90PointsFormat() {
+ // standard issue
+ Codec defaultCodec = TestUtil.getDefaultCodec();
+ if (random().nextBoolean()) {
+ // randomize parameters
+ maxPointsInLeafNode = TestUtil.nextInt(random(), 50, 500);
+ double maxMBSortInHeap = 3.0 + (3 * random().nextDouble());
+ if (VERBOSE) {
+ System.out.println(
+ "TEST: using Lucene60PointsFormat with maxPointsInLeafNode="
+ + maxPointsInLeafNode
+ + " and maxMBSortInHeap="
+ + maxMBSortInHeap);
+ }
+
+ // sneaky impersonation!
+ codec =
+ new FilterCodec(defaultCodec.getName(), defaultCodec) {
+ @Override
+ public PointsFormat pointsFormat() {
+ return new PointsFormat() {
+ @Override
+ public PointsWriter fieldsWriter(SegmentWriteState writeState) throws IOException {
+ return new Lucene90PointsWriter(writeState, maxPointsInLeafNode, maxMBSortInHeap);
+ }
+
+ @Override
+ public PointsReader fieldsReader(SegmentReadState readState) throws IOException {
+ return new Lucene90PointsReader(readState);
+ }
+ };
+ }
+ };
+ } else {
+ // standard issue
+ codec = defaultCodec;
+ maxPointsInLeafNode = BKDConfig.DEFAULT_MAX_POINTS_IN_LEAF_NODE;
+ }
+ }
+
+ @Override
+ protected Codec getCodec() {
+ return codec;
+ }
+
+ @Override
+ public void testMergeStability() throws Exception {
+ assumeFalse(
+ "TODO: mess with the parameters and test gets angry!", codec instanceof FilterCodec);
+ super.testMergeStability();
+ }
+
+ public void testEstimatePointCount() throws IOException {
Review comment:
I moved some test but the ones that relay on knowing the maxPointsInLeafNode cannot be moved as the information is not expose through the PointValues API.
##########
File path: lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene86/Lucene86PointsWriter.java
##########
@@ -60,40 +60,40 @@ public Lucene86PointsWriter(
IndexFileNames.segmentFileName(
writeState.segmentInfo.name,
writeState.segmentSuffix,
- Lucene86PointsFormat.DATA_EXTENSION);
+ Lucene86RWPointsFormat.DATA_EXTENSION);
Review comment:
good catch
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org