-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add memory optimized dimension table (#9802)
* Add mem optimized dim table * rename config and remove template variable * Add dimensionTable config to table config builder and serializers * fix linting * WIP: close segments after memtable is done * Do not close segments when data is not preLoaded * Fix segment close logic * closing segment data manager inside dimension table * Fix linting Co-authored-by: Kartik Khare <[email protected]>
- Loading branch information
Showing
10 changed files
with
420 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...re/src/main/java/org/apache/pinot/core/data/manager/offline/FastLookupDimensionTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** | ||
* 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.pinot.core.data.manager.offline; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.apache.pinot.spi.data.FieldSpec; | ||
import org.apache.pinot.spi.data.Schema; | ||
import org.apache.pinot.spi.data.readers.GenericRow; | ||
import org.apache.pinot.spi.data.readers.PrimaryKey; | ||
|
||
|
||
class FastLookupDimensionTable implements DimensionTable { | ||
|
||
private Map<PrimaryKey, GenericRow> _lookupTable; | ||
private final Schema _tableSchema; | ||
private final List<String> _primaryKeyColumns; | ||
|
||
FastLookupDimensionTable(Schema tableSchema, List<String> primaryKeyColumns, | ||
Map<PrimaryKey, GenericRow> lookupTable) { | ||
_lookupTable = lookupTable; | ||
_tableSchema = tableSchema; | ||
_primaryKeyColumns = primaryKeyColumns; | ||
} | ||
|
||
@Override | ||
public List<String> getPrimaryKeyColumns() { | ||
return _primaryKeyColumns; | ||
} | ||
|
||
@Override | ||
public GenericRow get(PrimaryKey pk) { | ||
return _lookupTable.get(pk); | ||
} | ||
|
||
@Override | ||
public boolean isEmpty() { | ||
return _lookupTable.isEmpty(); | ||
} | ||
|
||
@Override | ||
public FieldSpec getFieldSpecFor(String columnName) { | ||
return _tableSchema.getFieldSpecFor(columnName); | ||
} | ||
|
||
@Override | ||
public void close() | ||
throws IOException { | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...t-core/src/main/java/org/apache/pinot/core/data/manager/offline/LookupRecordLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* 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.pinot.core.data.manager.offline; | ||
|
||
import org.apache.pinot.segment.local.segment.readers.PinotSegmentRecordReader; | ||
import org.apache.pinot.spi.data.readers.GenericRow; | ||
|
||
|
||
public class LookupRecordLocation { | ||
private final PinotSegmentRecordReader _pinotSegmentRecordReader; | ||
private final int _docId; | ||
|
||
public LookupRecordLocation(PinotSegmentRecordReader pinotSegmentRecordReader, int docId) { | ||
_pinotSegmentRecordReader = pinotSegmentRecordReader; | ||
_docId = docId; | ||
} | ||
|
||
public PinotSegmentRecordReader getPinotSegmentRecordReader() { | ||
return _pinotSegmentRecordReader; | ||
} | ||
|
||
public int getDocId() { | ||
return _docId; | ||
} | ||
|
||
public GenericRow getRecord(GenericRow reuse) { | ||
_pinotSegmentRecordReader.getRecord(_docId, reuse); | ||
return reuse; | ||
} | ||
} |
Oops, something went wrong.