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 Tue, 07 Jun 2016 07:05:59 GMT
Github user xwq commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/513#discussion_r66019295
  
    --- 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 from your comments. Now I know what is multi-columns histograms.
    
    From the ODBC standard , I think it only need return the signal-column histogram now.
I thinks I can use "colcount=1" to filter signal-column histogram out . 
    
    I want to know whether "COLCOUNT=1" is right or not here?


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