http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
----------------------------------------------------------------------
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
index 4d6075b,aba9600..21f4f74
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionlessQueryServicesImpl.java
@@@ -318,14 -359,12 +359,17 @@@ public class ConnectionlessQueryService
                  }
                  
                  try {
-                    
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_FUNCTION_METADATA);
+                     
metaConnection.createStatement().executeUpdate(getFunctionTableDDL());
                  } catch (NewerTableAlreadyExistsException ignore) {
                  }
-                 
                  try {
-                     
metaConnection.createStatement().executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
-                  } catch (NewerTableAlreadyExistsException ignore) {
-                  }
+                     
metaConnection.createStatement().executeUpdate(getLogTableDDL());
+                 } catch (NewerTableAlreadyExistsException ignore) {}
++                try {
++                    metaConnection.createStatement()
++                            
.executeUpdate(QueryConstants.CREATE_CHILD_LINK_METADATA);
++                } catch (NewerTableAlreadyExistsException ignore) {
++                }
              } catch (SQLException e) {
                  sqlE = e;
              } finally {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
----------------------------------------------------------------------
diff --cc 
phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
index aed22cd,22fa2f4..c7fa438
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java
@@@ -18,98 -18,112 +18,7 @@@
  package org.apache.phoenix.query;
  
  
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.APPEND_ONLY_SCHEMA;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARG_POSITION;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ARRAY_SIZE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.AUTO_PARTITION_SEQ;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BASE_COLUMN_COUNT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BUFFER_LENGTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CACHE_SIZE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CHAR_OCTET_LENGTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CLASS_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_COUNT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_DEF;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_FAMILY;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_NAME;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_QUALIFIER_COUNTER;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.COLUMN_SIZE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CURRENT_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CYCLE_FLAG;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TABLE_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DATA_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DECIMAL_DIGITS;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_COLUMN_FAMILY_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DEFAULT_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.DISABLE_WAL;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ENCODING_SCHEME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.FUNCTION_NAME;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_ROW_COUNT;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POSTS_WIDTH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GUIDE_POST_KEY;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_ROWS;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IMMUTABLE_STORAGE_SCHEME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INCREMENT_BY;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_DISABLE_TIMESTAMP;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_STATE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.INDEX_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_ARRAY;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_AUTOINCREMENT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_CONSTANT;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_NAMESPACE_MAPPED;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_NULLABLE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_ROW_TIMESTAMP;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.IS_VIEW_REFERENCED;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.JAR_PATH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.KEY_SEQ;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LAST_STATS_UPDATE_TIME;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LIMIT_REACHED_FLAG;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.LINK_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.MAX_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.MIN_VALUE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.MULTI_TENANT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NULLABLE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NUM_ARGS;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NUM_PREC_RADIX;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.ORDINAL_POSITION;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.PHYSICAL_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.PK_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.REF_GENERATION;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.REMARKS;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.RETURN_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SALT_BUCKETS;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SCOPE_CATALOG;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SCOPE_SCHEMA;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SCOPE_TABLE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SELF_REFERENCING_COL_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SEQUENCE_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SEQUENCE_SCHEMA;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SORT_ORDER;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SOURCE_DATA_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SQL_DATA_TYPE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SQL_DATETIME_SUB;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.START_WITH;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.STORE_NULLS;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_FUNCTION_TABLE;
- import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CHILD_LINK_TABLE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_STATS_TABLE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SCHEM;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_SEQ_NUM;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TABLE_TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TRANSACTIONAL;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TRANSACTION_PROVIDER;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_NAME;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TYPE_SEQUENCE;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.UPDATE_CACHE_FREQUENCY;
--import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.USE_STATS_FOR_PARALLELIZATION;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_CONSTANT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_INDEX_ID;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_STATEMENT;
--import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.VIEW_TYPE;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BIND_PARAMETERS;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CLIENT_IP;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.EXCEPTION_TRACE;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.EXPLAIN_PLAN;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GLOBAL_SCAN_DETAILS;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NO_OF_RESULTS_ITERATED;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY_ID;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY_STATUS;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SCAN_METRICS_JSON;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.START_TIME;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TOTAL_EXECUTION_TIME;
 -import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.USER;
 -import static 
org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_LOG_TABLE;
++import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.*;
  
  import java.math.BigDecimal;
  

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
----------------------------------------------------------------------
diff --cc phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
index 76160ba,45aca98..7551b4c
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PColumnImpl.java
@@@ -180,22 -137,8 +180,18 @@@ public class PColumnImpl implements PCo
      }
  
      @Override
 +    public long getTimestamp() {
 +        return timestamp;
 +    }
 +
 +    @Override
 +    public boolean isExcluded() {
 +        return dataType == null;
 +    }
 +
 +    @Override
      public boolean isNullable() {
-         // Only PK columns can be NOT NULL. We prevent this in the
-         // CREATE TABLE statement now (PHOENIX-1266), but this extra
-         // check for familyName != null will ensure that for existing
-         // tables we never treat key value columns as NOT NULL.
-         return nullable || familyName != null;
+         return nullable;
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/schema/PTable.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
----------------------------------------------------------------------
diff --cc phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
index 186d4f8,082a58b..fbd7b7a
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/PTableImpl.java
@@@ -296,21 -291,9 +296,21 @@@ public class PTableImpl implements PTab
                  table.getSequenceNumber(), table.getPKName(), 
table.getBucketNum(), columns, table.getParentSchemaName(), 
table.getParentTableName(),
                  table.getIndexes(), table.isImmutableRows(), 
table.getPhysicalNames(), table.getDefaultFamilyName(), 
table.getViewStatement(),
                  table.isWALDisabled(), table.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),
-                 table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), 
table.isTransactional(), table.getUpdateCacheFrequency(),
+                 table.getBaseColumnCount(), table.rowKeyOrderOptimizable(), 
table.getTransactionProvider(), table.getUpdateCacheFrequency(),
                  table.getIndexDisableTimestamp(), table.isNamespaceMapped(), 
table.getAutoPartitionSeqName(), table.isAppendOnlySchema(), 
table.getImmutableStorageScheme(), table.getEncodingScheme(), 
table.getEncodedCQCounter(), table.useStatsForParallelization());
      }
 +
 +    // for views, the basePTable is for attributes we inherit from the 
physical table
 +    public static PTableImpl makePTable(PTable table, PTable basePTable, 
Collection<PColumn> columns, long timestamp, int baseTableColumnCount) throws 
SQLException {
 +        return new PTableImpl(
 +            table.getTenantId(), table.getSchemaName(), table.getTableName(), 
table.getType(), table.getIndexState(), timestamp,
 +            table.getSequenceNumber(), table.getPKName(), 
basePTable.getBucketNum(), columns, table.getParentSchemaName(), 
table.getParentTableName(),
 +            table.getIndexes(), basePTable.isImmutableRows(), 
table.getPhysicalNames(), table.getDefaultFamilyName(), 
table.getViewStatement(),
 +            table.isWALDisabled(), basePTable.isMultiTenant(), 
table.getStoreNulls(), table.getViewType(), table.getViewIndexId(), 
table.getIndexType(),
 +            baseTableColumnCount, table.rowKeyOrderOptimizable(), 
basePTable.isTransactional(), table.getUpdateCacheFrequency(),
 +            table.getIndexDisableTimestamp(), basePTable.isNamespaceMapped(), 
basePTable.getAutoPartitionSeqName(), basePTable.isAppendOnlySchema(),
 +            basePTable.getImmutableStorageScheme(), 
basePTable.getEncodingScheme(), table.getEncodedCQCounter(), 
table.useStatsForParallelization());
 +    }
      
      public static PTableImpl makePTable(PTable table, PTableType type, 
Collection<PColumn> columns) throws SQLException {
          return new PTableImpl(

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/util/SchemaUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/test/java/org/apache/phoenix/execute/CorrelatePlanTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/test/java/org/apache/phoenix/execute/LiteralResultIteratorPlanTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-protocol/src/main/MetaDataService.proto
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d615dc0c/phoenix-protocol/src/main/PTable.proto
----------------------------------------------------------------------

Reply via email to