Package com.salesforce.phoenix.schema

Examples of com.salesforce.phoenix.schema.PTable


                    if (plan1.getGroupBy().isOrderPreserving() != plan2.getGroupBy().isOrderPreserving()) {
                        return plan1.getGroupBy().isOrderPreserving() ? -1 : 1;
                    }
                }
                // Use smaller table (table with fewest kv columns)
                PTable table1 = plan1.getTableRef().getTable();
                PTable table2 = plan2.getTableRef().getTable();
                c = (table1.getColumns().size() - table1.getPKColumns().size()) - (table2.getColumns().size() - table2.getPKColumns().size());
                if (c != 0) return c;
               
                // All things being equal, just use the index table
                // TODO: have hint that drives this
                if (plan1.getTableRef().getTable().getType() == PTableType.INDEX) {
View Full Code Here


        ensureTableCreated(getUrl(), TABLE_WITH_ARRAY);
        Properties props = new Properties();
        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(MetaDataProtocol.MIN_TABLE_TIMESTAMP));
        PhoenixConnection conn = DriverManager.getConnection(PHOENIX_CONNECTIONLESS_JDBC_URL, props).unwrap(PhoenixConnection.class);
        try {
            PTable table = conn.getPMetaData().getTable(ATABLE_NAME);
            ATABLE = table;
            ORGANIZATION_ID = table.getColumn("ORGANIZATION_ID");
            ENTITY_ID = table.getColumn("ENTITY_ID");
            A_INTEGER = table.getColumn("A_INTEGER");
            A_STRING = table.getColumn("A_STRING");
            B_STRING = table.getColumn("B_STRING");
            ENTITY_ID = table.getColumn("ENTITY_ID");
            A_DATE = table.getColumn("A_DATE");
            A_TIME = table.getColumn("A_TIME");
            A_TIMESTAMP = table.getColumn("A_TIMESTAMP");
            X_DECIMAL = table.getColumn("X_DECIMAL");
        } finally {
            conn.close();
        }
    }
View Full Code Here

        Connection conn = DriverManager.getConnection(getUrl());
        String fullTableName = SchemaUtil.getTableName(schemaName, tableName) ;
        conn.createStatement().execute("CREATE TABLE " + fullTableName + "(" + dataColumns + " CONSTRAINT pk PRIMARY KEY (" + pk + "))  " + (dataProps.isEmpty() ? "" : dataProps) );
        try {
            conn.createStatement().execute("CREATE INDEX idx ON " + fullTableName + "(" + indexColumns + ") " + (includeColumns.isEmpty() ? "" : "INCLUDE (" + includeColumns + ") ") + (indexProps.isEmpty() ? "" : indexProps));
            PTable table = conn.unwrap(PhoenixConnection.class).getPMetaData().getTable(SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(schemaName),SchemaUtil.normalizeIdentifier(tableName)));
            PTable index = conn.unwrap(PhoenixConnection.class).getPMetaData().getTable(SchemaUtil.getTableName(SchemaUtil.normalizeIdentifier(schemaName),SchemaUtil.normalizeIdentifier("idx")));
            ImmutableBytesWritable ptr = new ImmutableBytesWritable();
            table.getIndexMaintainers(ptr);
            List<IndexMaintainer> c1 = IndexMaintainer.deserialize(ptr, builder);
            assertEquals(1,c1.size());
            IndexMaintainer im1 = c1.get(0);
View Full Code Here

TOP

Related Classes of com.salesforce.phoenix.schema.PTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.