Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/74#discussion_r38950251
  
    --- Diff: core/sql/common/ComMisc.cpp ---
    @@ -99,17 +100,74 @@ NABoolean ComIsTrafodionReservedSchemaName(
       return FALSE;
     }
     
    -// schema names of pattern "_HV ... _" and "_HB_ ... _" are reserved to 
store
    +// schema names of pattern "_HV_ ... _" and "_HB_ ... _" are reserved to 
store
     // external hive and hbase tables
     NABoolean ComIsTrafodionExternalSchemaName (
                                         const NAString &schName)
     {
       Int32 len (schName.length());
    +
    +  // check for HIVE
       Int32 prefixLen = sizeof(HIVE_EXT_SCHEMA_PREFIX);
       if (len > prefixLen && 
    -      (schName(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX || 
    -       schName(0,prefixLen-1) == HBASE_EXT_SCHEMA_PREFIX) && 
    -      schName(len-1) == '_' )
    +     (schName(0,prefixLen-1) == HIVE_EXT_SCHEMA_PREFIX && 
    +      schName(len-1) == '_' ))
         return TRUE;
    +
    +  // check for HBASE
    +  prefixLen = sizeof(HBASE_EXT_SCHEMA_PREFIX);
    +  if (len > prefixLen && 
    +     (schName(0,prefixLen-1) == HBASE_EXT_SCHEMA_PREFIX && 
    +      schName(len-1) == '_' ))
    +    return TRUE;
    +
       return FALSE;
     }
    +
    +// 
----------------------------------------------------------------------------
    +// function: ComConvertNativeNameToTrafName
    +//
    +// this fuction converts the native HIVE or HBASE object name into its
    +// Trafodion external name format.
    +//
    +// params:
    +//    catalogName - catalog name to identify HBASE or HIVE native table
    +//    schemaName - external name of the HBASE or HIVE schema
    +//    objectName - external name of the HBASE of HIVE table
    +//
    +// If it is not HIVE or HBASE, just return the qualified name
    +// 
----------------------------------------------------------------------------
    +NAString ComConvertNativeNameToTrafName ( 
    +  const NAString &catalogName,
    +  const NAString &schemaName,
    +  const NAString &objectName)
    +{
    +  // generate new schema name 
    +  NAString tempSchemaName; 
    +  if (catalogName == HIVE_SYSTEM_CATALOG)
    +    tempSchemaName += HIVE_EXT_SCHEMA_PREFIX;
    +  else if(catalogName == HBASE_SYSTEM_CATALOG)
    +    tempSchemaName += HBASE_EXT_SCHEMA_PREFIX;
    +  else
    +    return catalogName + NAString(".") +
    +           schemaName + NAString(".") +
    +           objectName; 
    +
    +  ComAnsiNamePart externalAnsiName(schemaName, 
ComAnsiNamePart::EXTERNAL_FORMAT);
    +  tempSchemaName += externalAnsiName.getInternalName();
    +  tempSchemaName.append ("_");
    +
    +  // Catalog name is "TRAFODION"
    +  NAString convertedName (CmpSeabaseDDL::getSystemCatalogStatic());
    +  convertedName += ".";
    +
    +  // append transformed schema name, convert internal name to external 
format
    +  ComAnsiNamePart internalAnsiName(tempSchemaName, 
ComAnsiNamePart::INTERNAL_FORMAT);
    +  convertedName += internalAnsiName.getExternalName();
    +
    +  // object  name is appended without change
    --- End diff --
    
    A question: Do we know that object names always conform to regular 
identifier syntax? Or if they don't, are they already in delimited form when we 
enter this method?



---
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.
---

Reply via email to