trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xwq <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #513: [TRAFODION-1684]ODBC:preliminary supp...
Date Thu, 02 Jun 2016 13:37:56 GMT
Github user xwq commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/513#discussion_r65540065
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -4811,6 +4811,64 @@ odbc_SQLSvc_GetSQLCatalogs_sme_(
     
     			break;
     
    +        case SQL_API_SQLSTATISTICS:
    +            if (!checkIfWildCard(catalogNm, catalogNmNoEsc) && !metadataId)
    +            {
    +                exception_->exception_nr = odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_;
    +                exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_WILDCARD_NOT_SUPPORTED;
    +            }
    +            if (tableNm[0] != '$' && tableNm[0] != '\\')
    +            {
    +                if (strcmp(catalogNm, "") == 0)
    +                    strcpy(tableName1, SEABASE_MD_CATALOG);
    +                else
    +                    strcpy(tableName1, catalogNm);
    +            }
    +
    +            tableParam[0] = tableName1;
    +            convertWildcard(metadataId, TRUE, schemaNm, expSchemaNm);
    +            convertWildcardNoEsc(metadataId, TRUE, schemaNm, schemaNmNoEsc);
    +            convertWildcard(metadataId, TRUE, tableNm, expTableNm);
    +            convertWildcardNoEsc(metadataId, TRUE, tableNmNoEsc, tableNmNoEsc);
    +            inputParam[0] = schemaNmNoEsc;
    +            inputParam[1] = expSchemaNm;
    +            inputParam[2] = tableNmNoEsc;
    +            inputParam[3] = expTableNm;
    +
    +            snprintf(CatalogQuery, sizeof(CatalogQuery),
    +                    "select "
    +                    "cast('%s' as varchar(128)) TABLE_CAT, "
    +                    "cast(trim(ob.SCHEMA_NAME) as varchar(128)) TABLE_SCHEM, "
    +                    "cast(trim(ob.OBJECT_NAME) as varchar(128)) TABLE_NAME, "
    +                    "cast(0 as smallint) NON_UNIQUE, " // not support
    +                    "cast('' as varchar(128)) INDEX_QUALIFIER, " // not support
    +                    "cast('' as varchar(128)) INDEX_NAME, "
    +                    "cast(0 as smallint) TYPE, " // not support
    +                    "cast((case when (trim(co.COLUMN_CLASS) <> 'S') then co.column_number+1
else "
    +                        "co.column_number end) as smallint) ORDINAL_POSITION, "
    +                    "cast(trim(co.COLUMN_NAME) as varchar(128)) COLUMN_NAME, "
    +                    "cast('' as char(1)) ASC_OR_DES, "
    +                    "cast(sb.rowcount as integer) CARDINALITY, "
    +                    "cast(0 as integer) PAGES, " // not support
    +                    "cast('' as varchar(128)) FILTER_CONDITION " // not support
    +                    "from "
    +                    "TRAFODION.\"_MD_\".OBJECTS ob, "
    +                    "TRAFODION.\"_MD_\".COLUMNS co, "
    +                    "TRAFODION.%s.sb_histograms sb "
    +                    "where "
    +                    "ob.OBJECT_UID = co.OBJECT_UID "
    +                    "and co.COLUMN_NUMBER = sb.COLUMN_NUMBER "
    --- End diff --
    
    Thanks Dave, I miss "co.OBJECT_UID=sb.TABLE_UID", I will add this.
    
    For mutlit-column histograms, I don't known the exactly behavior. I will take some time
to investigate it. 
    
    Actually , I can't find the  document for metadata and histograms. I am studying through
learning the query for other catalog API.  So this question maybe has many issues, and there
are many result it can't support now.  I think your comments will help me studying them.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message