Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/12#discussion_r17709713
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java ---
@@ -335,11 +364,33 @@ private void init(PName tenantId, PName schemaName,
PName tableName, PTableType
estimatedSize += rowKeySchema.getEstimatedSize();
Iterator<Map.Entry<PName,List<PColumn>>> iterator =
familyMap.entrySet().iterator();
PColumnFamily[] families = new PColumnFamily[familyMap.size()];
+ if (families.length == 0) {
+ if(stats != null) {
+ byte[] defaultFamilyNameBytes = null;
+ if(defaultFamilyName == null) {
+ defaultFamilyNameBytes =
QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES;
+ } else {
+ defaultFamilyNameBytes = defaultFamilyName.getBytes();
+ }
+ guidePosts =
stats.getGuidePosts().get(defaultFamilyNameBytes);
+ }
+ }
ImmutableMap.Builder<String, PColumnFamily> familyByString =
ImmutableMap.builder();
ImmutableSortedMap.Builder<byte[], PColumnFamily> familyByBytes =
ImmutableSortedMap.orderedBy(Bytes.BYTES_COMPARATOR);
for (int i = 0; i < families.length; i++) {
Map.Entry<PName,List<PColumn>> entry = iterator.next();
- PColumnFamily family = new PColumnFamilyImpl(entry.getKey(),
entry.getValue());
--- End diff --
This will stay the same if you just serialize the info to create a
PTableStats object instead. Just serialize the columnFamily byte[] name and the
guideposts (as you're already doing). Then build/instantiate a PTableStats
object and pass it through init.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---