Source:
<code>public static ColumnResolver getResolverForCreation(final CreateTableStatement statement, final PhoenixConnection connection) throws SQLException { TableName baseTable = statement.getBaseTableName(); String schemaName; if (baseTable == null) { if (SchemaUtil.isSchemaCheckRequired(statement.getTableType(), connection.getQueryServices().getProps())) { schemaName = statement.getTableName().getSchemaName(); if (schemaName != null) { new SchemaResolver(connection, statement.getTableName().getSchemaName(), true); } else if (connection.getSchema() != null) { new SchemaResolver(connection, connection.getSchema(), true); } } return EMPTY_TABLE_RESOLVER; } NamedTableNode tableNode = NamedTableNode.create(null, baseTable, Collections.<ColumnDef>emptyList()); try { SingleTableColumnResolver visitor = new SingleTableColumnResolver(connection, tableNode, true, true); return visitor; } catch (TableNotFoundException e) { if (connection.getTenantId() == null && statement.getTableType() == PTableType.VIEW) { ConnectionQueryServices services = connection.getQueryServices(); byte[] fullTableName = SchemaUtil.getPhysicalName( SchemaUtil.getTableNameAsBytes(baseTable.getSchemaName(), baseTable.getTableName()), connection.getQueryServices().getProps()).getName(); HTableInterface htable = null; try { htable = services.getTable(fullTableName); } catch (UnsupportedOperationException ignore) { throw e; } finally { if (htable != null) Closeables.closeQuietly(htable); } tableNode = NamedTableNode.create(null, baseTable, statement.getColumnDefs()); <START> boolean isNamespaceMapped = SchemaUtil.isNamespaceMappingEnabled(statement.getTableType(), connection.getQueryServices().getProps()); <END> return new SingleTableColumnResolver(connection, tableNode, e.getTimeStamp(), new HashMap<String, UDFParseNode>(1), isNamespaceMapped); } throw e; } }</code><technical_language>handle view mapped \"NS.TBL\"(without schema) - byte[] fullTableName = SchemaUtil.getPhysicalName( - SchemaUtil.getTableNameAsBytes(baseTable.getSchemaName(), baseTable.getTableName()), - connection.getQueryServices().getProps()).getName(); + byte[] fullTableName = SchemaUtil + .getPhysicalName(Bytes.toBytes(baseTable.toString()), + connection.getQueryServices().getProps()) + .getName();</technical_language>

Target:
public static ColumnResolver getResolverForCreation(final CreateTableStatement statement, final PhoenixConnection connection) throws SQLException { TableName baseTable = statement.getBaseTableName(); String schemaName; if (baseTable == null) { if (SchemaUtil.isSchemaCheckRequired(statement.getTableType(), connection.getQueryServices().getProps())) { schemaName = statement.getTableName().getSchemaName(); if (schemaName != null) { new SchemaResolver(connection, statement.getTableName().getSchemaName(), true); } else if (connection.getSchema() != null) { new SchemaResolver(connection, connection.getSchema(), true); } } return EMPTY_TABLE_RESOLVER; } NamedTableNode tableNode = NamedTableNode.create(null, baseTable, Collections.<ColumnDef>emptyList()); try { SingleTableColumnResolver visitor = new SingleTableColumnResolver(connection, tableNode, true, true); return visitor; } catch (TableNotFoundException e) { if (connection.getTenantId() == null && statement.getTableType() == PTableType.VIEW) { ConnectionQueryServices services = connection.getQueryServices(); boolean isNamespaceMapped = SchemaUtil.isNamespaceMappingEnabled(statement.getTableType(), connection.getQueryServices().getProps()); byte[] fullTableName = SchemaUtil.getPhysicalHBaseTableName( baseTable.getSchemaName(), baseTable.getTableName(), isNamespaceMapped).getBytes(); HTableInterface htable = null; try { htable = services.getTable(fullTableName); } catch (UnsupportedOperationException ignore) { throw e; } finally { if (htable != null) Closeables.closeQuietly(htable); } tableNode = NamedTableNode.create(null, baseTable, statement.getColumnDefs()); return new SingleTableColumnResolver(connection, tableNode, e.getTimeStamp(), new HashMap<String, UDFParseNode>(1), isNamespaceMapped); } throw e; } }