Skip to content

Commit 3bddc90

Browse files
committed
merge from snappy/master
2 parents 618ed86 + a76164b commit 3bddc90

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/ExternalTableMetaData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public ExternalTableMetaData(String entityName,
6464
public String dataSourcePath;
6565
public String driverClass;
6666
public String columnTableSortOrder;
67+
public String viewText;
6768
// columns for metadata queries
6869
public List<Column> columns;
6970

gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/engine/diag/HiveTablesVTI.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.pivotal.gemfirexd.internal.engine.diag;
1919

20+
import java.sql.Clob;
2021
import java.sql.ResultSetMetaData;
2122
import java.sql.SQLException;
2223
import java.sql.Types;
@@ -32,8 +33,11 @@
3233
import com.pivotal.gemfirexd.internal.engine.Misc;
3334
import com.pivotal.gemfirexd.internal.engine.jdbc.GemFireXDRuntimeException;
3435
import com.pivotal.gemfirexd.internal.iapi.sql.ResultColumnDescriptor;
36+
import com.pivotal.gemfirexd.internal.iapi.types.HarmonySerialClob;
3537
import com.pivotal.gemfirexd.internal.impl.jdbc.EmbedResultSetMetaData;
38+
import com.pivotal.gemfirexd.internal.impl.jdbc.Util;
3639
import com.pivotal.gemfirexd.internal.shared.common.reference.Limits;
40+
import com.pivotal.gemfirexd.internal.shared.common.reference.SQLState;
3741
import org.slf4j.Logger;
3842
import org.slf4j.LoggerFactory;
3943

@@ -138,12 +142,30 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException {
138142
return this.currentTableColumn.maxWidth;
139143
case 14: // NULLABLE
140144
return this.currentTableColumn.nullable;
145+
case 15: // VIEWTEXT
146+
// only show for ordinal 0 and avoid repetition
147+
if (this.currentTableColumns.nextIndex() == 1) {
148+
return this.currentTableMeta.viewText;
149+
} else return null;
141150
default:
142151
throw new GemFireXDRuntimeException("unexpected column=" +
143152
columnNumber + " for HiveTablesVTI");
144153
}
145154
}
146155

156+
@Override
157+
public Clob getClob(int columnNumber) throws SQLException {
158+
switch (columnNumber) {
159+
case 15: // VIEWTEXT
160+
String viewText = getString(columnNumber);
161+
return viewText != null ? new HarmonySerialClob(viewText) : null;
162+
163+
default:
164+
throw Util.generateCsSQLException(SQLState.LANG_VTI_BLOB_CLOB_UNSUPPORTED,
165+
"HIVETABLES", columnNumber);
166+
}
167+
}
168+
147169
/**
148170
* Metadata
149171
*/
@@ -176,6 +198,8 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException {
176198

177199
private static final String NULLABLE = "NULLABLE";
178200

201+
private static final String VIEWTEXT = "VIEWTEXT";
202+
179203
private static final ResultColumnDescriptor[] columnInfo = {
180204
EmbedResultSetMetaData.getResultColumnDescriptor(SCHEMA,
181205
Types.VARCHAR, false, 128),
@@ -205,6 +229,8 @@ protected Object getObjectForColumn(int columnNumber) throws SQLException {
205229
Types.INTEGER, false),
206230
EmbedResultSetMetaData.getResultColumnDescriptor(NULLABLE,
207231
Types.BOOLEAN, false),
232+
EmbedResultSetMetaData.getResultColumnDescriptor(VIEWTEXT,
233+
Types.CLOB, true),
208234
};
209235

210236
private static final ResultSetMetaData metadata = new EmbedResultSetMetaData(

0 commit comments

Comments
 (0)