Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

ODBC: Fix for data loading failure in Power BI Desktop #627

Merged

Conversation

rupal-bq
Copy link
Contributor

Issue #595

Description of changes:

  • Added data type & SQL data type values in SQLColumns
  • Tested with Power BI Desktop (using import mode)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -936,7 +937,9 @@ TEST_F(TestSQLDescribeCol, SingleColumnMetadata) {
EXPECT_EQ(single_col, m_column_name);
EXPECT_EQ(single_col_name_length, m_column_name_length);
EXPECT_EQ(single_col_data_type, m_data_type);
EXPECT_EQ(single_col_column_size, m_column_size);
// Value changes according to pagination setup on server

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why. Created an issue #628 to investigate this further since I got one another value as 23 for server 1.9.0.

Will revert changes in this PR and handle this separately as it's not a blocker for fixing the data loading issue in Power BI.


for (size_t i = 0; i < binds.size(); i++) {
// Add tuples for SQLColumns
if (binds.size() > COLUMNS_SQL_DATA_TYPE) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just report the extra columns regardless?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same method is used while adding tuples for SQLTables as well. SQLTables has only 5 columns whereas SQLColumns has 18.
So this check ensures that the data type column is updated for SQLColumns only. If we remove this check then we get Memory Corruption since SQLTables will try to access column which doesn't exist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost wondering if it would be worth it to split some of this logic up, now that we're handling special cases for SQLTables & SQLColumns

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created issue #630 to revisit the logic of assigning data for SQLTables & SQLColumns

@@ -85,6 +85,9 @@ const std::vector< std::string > flights_data_type = {
"float", "keyword", "integer", "keyword", "keyword", "keyword", "date",
"keyword", "keyword", "boolean", "float", "keyword", "keyword", "keyword",
"keyword", "keyword", "keyword", "keyword"};
const std::vector< short > flights_sql_data_type = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use SQL type contstants here instead? (eg. SQLWVARCHAR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@@ -29,6 +29,7 @@
#pragma clang diagnostic pop
#endif // __APPLE__
#include "statement.h"
#include "es_types.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already included on L22 (might need to expand GH code preview)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed


for (size_t i = 0; i < binds.size(); i++) {
// Add tuples for SQLColumns
if (binds.size() > COLUMNS_SQL_DATA_TYPE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost wondering if it would be worth it to split some of this logic up, now that we're handling special cases for SQLTables & SQLColumns

@chloe-zh chloe-zh merged commit bee2ca2 into opendistro-for-elasticsearch:develop Jul 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants