Github user ankitsinghal commented on a diff in the pull request: https://github.com/apache/phoenix/pull/261#discussion_r123153895 --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java --- @@ -710,6 +714,27 @@ public void testCreateViewWithUpdateCacheFrquency() throws Exception { assertTrue(rs.next()); } + @Test + public void testCreateViewMappedToExistingHbaseTableWithNamespaceMappingEnabled() throws Exception { + Properties props = new Properties(); + props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, "true"); + Connection conn = DriverManager.getConnection(getUrl(),props); + + String ns = "NS_" + generateUniqueName(); + String table = "TABLE_" + generateUniqueName(); + String fam = "CF"; + + HBaseAdmin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin(); + admin.createNamespace(NamespaceDescriptor.create(ns).build()); + HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(ns, table)); + desc.addFamily(new HColumnDescriptor(fam)); + admin.createTable(desc); + + conn.createStatement().execute("CREATE SCHEMA " + ns); + conn.createStatement().execute("CREATE VIEW " + ns + "." + table + " " + + "(PK VARCHAR PRIMARY KEY, " + fam + ".COL VARCHAR)"); --- End diff -- can you update a test to include a case where user has "NS.TBL" in default namespace and he wants to map a view.(\"NS.TBL\")(for backward compatibility). ``` desc = new HTableDescriptor(TableName.valueOf(ns+"."+table)); desc.addFamily(new HColumnDescriptor(fam)); admin.createTable(desc); conn.createStatement().execute("CREATE VIEW \"" + ns + "." + table + "\"" + "(PK VARCHAR PRIMARY KEY, " + fam + ".COL VARCHAR)"); ```
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---