Qinrui98 commented on a change in pull request #848:
URL: https://github.com/apache/phoenix/pull/848#discussion_r463285405
##########
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 globalValue = entry.getValue();
+ Map<String, String> cfToPropertyValueMap = new HashMap<String,
String>();
+ Set<ImmutableBytesWritable> cfPropertyValueSet = 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()));
+ break;
+ }
+ cfToPropertyValueMap.put(columnFamilyName,
Bytes.toString(value.get()));
+ cfPropertyValueSet.add(value);
+ }
+ if (cfPropertyValueSet.size() > 1) {
+ for(Map.Entry<String, String> mapEntry:
cfToPropertyValueMap.entrySet()) {
+ definedProps.put(String.format("%s.%s",
mapEntry.getKey(), Bytes.toString(key.get())), mapEntry.getValue());
Review comment:
@gjacoby126 We are trying to find common CF property so that we don't
need to specify it for every column family in the output string. Are you
suggesting that we could use hashmap instead?
----------------------------------------------------------------
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:
[email protected]