You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/07/30 17:31:58 UTC
[GitHub] [phoenix] Qinrui98 commented on a change in pull request #848: Phoenix-5947 Add tests and extensions to Schema Extraction Tool utility
Qinrui98 commented on a change in pull request #848:
URL: https://github.com/apache/phoenix/pull/848#discussion_r463158802
##########
File path: phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -250,12 +247,31 @@ private void setHTableProperties(HTableDescriptor htd) {
}
}
- private void setHColumnFamilyProperties(HColumnDescriptor columnDescriptor) {
- Map<ImmutableBytesWritable, ImmutableBytesWritable> propsMap = columnDescriptor.getValues();
- for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : propsMap.entrySet()) {
+ private void setHColumnFamilyProperties(HColumnDescriptor[] columnDescriptors) {
+ Map<ImmutableBytesWritable, ImmutableBytesWritable> propsMap = columnDescriptors[0].getValues();
+ for(Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : propsMap.entrySet()){
ImmutableBytesWritable key = entry.getKey();
- ImmutableBytesWritable value = entry.getValue();
- definedProps.put(Bytes.toString(key.get()), Bytes.toString(value.get()));
+ ImmutableBytesWritable defaultValue = entry.getValue();
+ Map<String, String> CFMap = new HashMap<String, String>();
+ Set<ImmutableBytesWritable> set = new HashSet<ImmutableBytesWritable>();
+ for(HColumnDescriptor columnDescriptor: columnDescriptors){
+ String columnFamilyName = Bytes.toString(columnDescriptor.getName());
+ ImmutableBytesWritable value = columnDescriptor.getValues().get(key);
+ // check if it is universal properties
+ if (SYNCED_DATA_TABLE_AND_INDEX_COL_FAM_PROPERTIES.contains(Bytes.toString(key.get()))){
+ definedProps.put(Bytes.toString(key.get()), Bytes.toString(value.get()));
+ continue;
+ }
+ CFMap.put(columnFamilyName, Bytes.toString(value.get()));
+ set.add(value);
+ }
+ if (set.size() > 1){
Review comment:
Yes it's working with only 2 of them having VERSIONS=2. The size of the set will be 2 in this case. I'll add a test to cover this scenario.
----------------------------------------------------------------
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