Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/513#discussion_r65449066
--- 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 --
I'm wondering how this query will behave when there are multi-column
histograms. Will we get extra rows?
---
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.
---