@@ -97,8 +97,8 @@ private List<Attribute> output(boolean odbcCompatible) {
97
97
98
98
@ Override
99
99
public void execute (SqlSession session , ActionListener <SchemaRowSet > listener ) {
100
- boolean isOdbcClient = session .configuration ().mode () == Mode . ODBC ;
101
- List <Attribute > output = output (isOdbcClient );
100
+ Mode mode = session .configuration ().mode ();
101
+ List <Attribute > output = output (mode == Mode . ODBC );
102
102
String cluster = session .indexResolver ().clusterName ();
103
103
104
104
// bail-out early if the catalog is present but differs
@@ -115,16 +115,17 @@ public void execute(SqlSession session, ActionListener<SchemaRowSet> listener) {
115
115
session .indexResolver ().resolveAsSeparateMappings (idx , regex , ActionListener .wrap (esIndices -> {
116
116
List <List <?>> rows = new ArrayList <>();
117
117
for (EsIndex esIndex : esIndices ) {
118
- fillInRows (cluster , esIndex .name (), esIndex .mapping (), null , rows , columnMatcher , isOdbcClient );
118
+ fillInRows (cluster , esIndex .name (), esIndex .mapping (), null , rows , columnMatcher , mode );
119
119
}
120
120
121
121
listener .onResponse (Rows .of (output , rows ));
122
122
}, listener ::onFailure ));
123
123
}
124
124
125
125
static void fillInRows (String clusterName , String indexName , Map <String , EsField > mapping , String prefix , List <List <?>> rows ,
126
- Pattern columnMatcher , boolean isOdbcClient ) {
126
+ Pattern columnMatcher , Mode mode ) {
127
127
int pos = 0 ;
128
+ boolean isOdbcClient = mode == Mode .ODBC ;
128
129
for (Map .Entry <String , EsField > entry : mapping .entrySet ()) {
129
130
pos ++; // JDBC is 1-based so we start with 1 here
130
131
@@ -133,9 +134,8 @@ static void fillInRows(String clusterName, String indexName, Map<String, EsField
133
134
EsField field = entry .getValue ();
134
135
DataType type = field .getDataType ();
135
136
136
- // skip the nested and object types only for ODBC
137
- // https://github.com/elastic/elasticsearch/issues/35376
138
- if (type .isPrimitive () || !isOdbcClient ) {
137
+ // skip the nested, object and unsupported types for JDBC and ODBC
138
+ if (type .isPrimitive () || false == Mode .isDriver (mode )) {
139
139
if (columnMatcher == null || columnMatcher .matcher (name ).matches ()) {
140
140
rows .add (asList (clusterName ,
141
141
// schema is not supported
@@ -175,7 +175,7 @@ static void fillInRows(String clusterName, String indexName, Map<String, EsField
175
175
}
176
176
}
177
177
if (field .getProperties () != null ) {
178
- fillInRows (clusterName , indexName , field .getProperties (), name , rows , columnMatcher , isOdbcClient );
178
+ fillInRows (clusterName , indexName , field .getProperties (), name , rows , columnMatcher , mode );
179
179
}
180
180
}
181
181
}
0 commit comments