You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ji...@apache.org on 2017/10/11 18:38:58 UTC
[34/41] incubator-quickstep git commit: Type as first class citizen
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/parser/preprocessed/SqlParser_gen.hpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp
index 69b78e7..037f697 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -72,117 +72,103 @@ extern int quickstep_yydebug;
TOKEN_ALTER = 282,
TOKEN_AS = 283,
TOKEN_ASC = 284,
- TOKEN_BIGINT = 285,
- TOKEN_BIT = 286,
- TOKEN_BITWEAVING = 287,
- TOKEN_BLOCKPROPERTIES = 288,
- TOKEN_BLOCKSAMPLE = 289,
- TOKEN_BLOOM_FILTER = 290,
- TOKEN_CSB_TREE = 291,
- TOKEN_BY = 292,
- TOKEN_CASE = 293,
- TOKEN_CAST = 294,
- TOKEN_CHARACTER = 295,
- TOKEN_CHECK = 296,
- TOKEN_COLUMN = 297,
- TOKEN_CONSTRAINT = 298,
- TOKEN_COPY = 299,
- TOKEN_CREATE = 300,
- TOKEN_CURRENT = 301,
- TOKEN_DATE = 302,
- TOKEN_DATETIME = 303,
- TOKEN_DAY = 304,
- TOKEN_DECIMAL = 305,
- TOKEN_DEFAULT = 306,
- TOKEN_DELETE = 307,
- TOKEN_DESC = 308,
- TOKEN_DISTINCT = 309,
- TOKEN_DOUBLE = 310,
- TOKEN_DOUBLECOLON = 311,
- TOKEN_DROP = 312,
- TOKEN_ELSE = 313,
- TOKEN_END = 314,
- TOKEN_EXISTS = 315,
- TOKEN_EXTRACT = 316,
- TOKEN_FALSE = 317,
- TOKEN_FIRST = 318,
- TOKEN_FLOAT = 319,
- TOKEN_FOLLOWING = 320,
- TOKEN_FOR = 321,
- TOKEN_FOREIGN = 322,
- TOKEN_FROM = 323,
- TOKEN_FULL = 324,
- TOKEN_GROUP = 325,
- TOKEN_HASH = 326,
- TOKEN_HAVING = 327,
- TOKEN_HOUR = 328,
- TOKEN_IN = 329,
- TOKEN_INDEX = 330,
- TOKEN_INNER = 331,
- TOKEN_INSERT = 332,
- TOKEN_INTEGER = 333,
- TOKEN_INTERVAL = 334,
- TOKEN_INTO = 335,
- TOKEN_JOIN = 336,
- TOKEN_KEY = 337,
- TOKEN_LAST = 338,
- TOKEN_LBRACE = 339,
- TOKEN_LEFT = 340,
- TOKEN_LIMIT = 341,
- TOKEN_LONG = 342,
- TOKEN_MINUTE = 343,
- TOKEN_MONTH = 344,
- TOKEN_NULL = 345,
- TOKEN_NULLS = 346,
- TOKEN_OFF = 347,
- TOKEN_ON = 348,
- TOKEN_ORDER = 349,
- TOKEN_OUTER = 350,
- TOKEN_OVER = 351,
- TOKEN_PARTITION = 352,
- TOKEN_PARTITIONS = 353,
- TOKEN_PERCENT = 354,
- TOKEN_PRECEDING = 355,
- TOKEN_PRIMARY = 356,
- TOKEN_PRIORITY = 357,
- TOKEN_QUIT = 358,
- TOKEN_RANGE = 359,
- TOKEN_RBRACE = 360,
- TOKEN_REAL = 361,
- TOKEN_REFERENCES = 362,
- TOKEN_RIGHT = 363,
- TOKEN_ROW = 364,
- TOKEN_ROW_DELIMITER = 365,
- TOKEN_ROWS = 366,
- TOKEN_SECOND = 367,
- TOKEN_SELECT = 368,
- TOKEN_SET = 369,
- TOKEN_SMA = 370,
- TOKEN_SMALLINT = 371,
- TOKEN_STDERR = 372,
- TOKEN_STDOUT = 373,
- TOKEN_SUBSTRING = 374,
- TOKEN_TABLE = 375,
- TOKEN_THEN = 376,
- TOKEN_TIME = 377,
- TOKEN_TIMESTAMP = 378,
- TOKEN_TO = 379,
- TOKEN_TRUE = 380,
- TOKEN_TUPLESAMPLE = 381,
- TOKEN_UNBOUNDED = 382,
- TOKEN_UNIQUE = 383,
- TOKEN_UPDATE = 384,
- TOKEN_USING = 385,
- TOKEN_VALUES = 386,
- TOKEN_VARCHAR = 387,
- TOKEN_WHEN = 388,
- TOKEN_WHERE = 389,
- TOKEN_WINDOW = 390,
- TOKEN_WITH = 391,
- TOKEN_YEAR = 392,
- TOKEN_YEARMONTH = 393,
- TOKEN_EOF = 394,
- TOKEN_LEX_ERROR = 395
+ TOKEN_BIT = 285,
+ TOKEN_BITWEAVING = 286,
+ TOKEN_BLOCKPROPERTIES = 287,
+ TOKEN_BLOCKSAMPLE = 288,
+ TOKEN_BLOOM_FILTER = 289,
+ TOKEN_CSB_TREE = 290,
+ TOKEN_BY = 291,
+ TOKEN_CASE = 292,
+ TOKEN_CAST = 293,
+ TOKEN_CHECK = 294,
+ TOKEN_COLUMN = 295,
+ TOKEN_CONSTRAINT = 296,
+ TOKEN_COPY = 297,
+ TOKEN_CREATE = 298,
+ TOKEN_CURRENT = 299,
+ TOKEN_DAY = 300,
+ TOKEN_DEFAULT = 301,
+ TOKEN_DELETE = 302,
+ TOKEN_DESC = 303,
+ TOKEN_DISTINCT = 304,
+ TOKEN_DOUBLECOLON = 305,
+ TOKEN_DROP = 306,
+ TOKEN_ELSE = 307,
+ TOKEN_END = 308,
+ TOKEN_EXISTS = 309,
+ TOKEN_EXTRACT = 310,
+ TOKEN_FALSE = 311,
+ TOKEN_FIRST = 312,
+ TOKEN_FOLLOWING = 313,
+ TOKEN_FOR = 314,
+ TOKEN_FOREIGN = 315,
+ TOKEN_FROM = 316,
+ TOKEN_FULL = 317,
+ TOKEN_GROUP = 318,
+ TOKEN_HASH = 319,
+ TOKEN_HAVING = 320,
+ TOKEN_HOUR = 321,
+ TOKEN_IN = 322,
+ TOKEN_INDEX = 323,
+ TOKEN_INNER = 324,
+ TOKEN_INSERT = 325,
+ TOKEN_INTERVAL = 326,
+ TOKEN_INTO = 327,
+ TOKEN_JOIN = 328,
+ TOKEN_KEY = 329,
+ TOKEN_LAST = 330,
+ TOKEN_LBRACE = 331,
+ TOKEN_LEFT = 332,
+ TOKEN_LIMIT = 333,
+ TOKEN_MINUTE = 334,
+ TOKEN_MONTH = 335,
+ TOKEN_NULL = 336,
+ TOKEN_NULLS = 337,
+ TOKEN_OFF = 338,
+ TOKEN_ON = 339,
+ TOKEN_ORDER = 340,
+ TOKEN_OUTER = 341,
+ TOKEN_OVER = 342,
+ TOKEN_PARTITION = 343,
+ TOKEN_PARTITIONS = 344,
+ TOKEN_PERCENT = 345,
+ TOKEN_PRECEDING = 346,
+ TOKEN_PRIMARY = 347,
+ TOKEN_PRIORITY = 348,
+ TOKEN_QUIT = 349,
+ TOKEN_RANGE = 350,
+ TOKEN_RBRACE = 351,
+ TOKEN_REAL = 352,
+ TOKEN_REFERENCES = 353,
+ TOKEN_RIGHT = 354,
+ TOKEN_ROW = 355,
+ TOKEN_ROW_DELIMITER = 356,
+ TOKEN_ROWS = 357,
+ TOKEN_SECOND = 358,
+ TOKEN_SELECT = 359,
+ TOKEN_SET = 360,
+ TOKEN_SMA = 361,
+ TOKEN_STDERR = 362,
+ TOKEN_STDOUT = 363,
+ TOKEN_SUBSTRING = 364,
+ TOKEN_TABLE = 365,
+ TOKEN_THEN = 366,
+ TOKEN_TO = 367,
+ TOKEN_TRUE = 368,
+ TOKEN_TUPLESAMPLE = 369,
+ TOKEN_UNBOUNDED = 370,
+ TOKEN_UNIQUE = 371,
+ TOKEN_UPDATE = 372,
+ TOKEN_USING = 373,
+ TOKEN_VALUES = 374,
+ TOKEN_WHEN = 375,
+ TOKEN_WHERE = 376,
+ TOKEN_WINDOW = 377,
+ TOKEN_WITH = 378,
+ TOKEN_YEAR = 379,
+ TOKEN_EOF = 380,
+ TOKEN_LEX_ERROR = 381
};
#endif
@@ -191,7 +177,7 @@ extern int quickstep_yydebug;
union YYSTYPE
{
-#line 115 "../SqlParser.ypp" /* yacc.c:1915 */
+#line 116 "../SqlParser.ypp" /* yacc.c:1915 */
quickstep::ParseString *string_value_;
@@ -293,7 +279,7 @@ union YYSTYPE
quickstep::ParsePriority *opt_priority_clause_;
-#line 297 "SqlParser_gen.hpp" /* yacc.c:1915 */
+#line 283 "SqlParser_gen.hpp" /* yacc.c:1915 */
};
typedef union YYSTYPE YYSTYPE;
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/query_optimizer/resolver/Resolver.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/Resolver.cpp b/query_optimizer/resolver/Resolver.cpp
index d4ff5c6..694d741 100644
--- a/query_optimizer/resolver/Resolver.cpp
+++ b/query_optimizer/resolver/Resolver.cpp
@@ -639,13 +639,14 @@ L::LogicalPtr Resolver::resolveCreateTable(
<< "Column " << attribute_definition.name()->value()
<< " is specified more than once";
}
- attributes.emplace_back(
- E::AttributeReference::Create(context_->nextExprId(),
- attribute_definition.name()->value(),
- attribute_definition.name()->value(),
- relation_name,
- attribute_definition.data_type().getType(),
- E::AttributeReferenceScope::kLocal));
+ LOG(FATAL) << "TODO(refactor-type): To implement";
+// attributes.emplace_back(
+// E::AttributeReference::Create(context_->nextExprId(),
+// attribute_definition.name()->value(),
+// attribute_definition.name()->value(),
+// relation_name,
+// attribute_definition.data_type().getType(),
+// E::AttributeReferenceScope::kLocal));
attribute_name_set.insert(lower_attribute_name);
}
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/types/CMakeLists.txt b/types/CMakeLists.txt
index d4bc26e..0ee4f26 100644
--- a/types/CMakeLists.txt
+++ b/types/CMakeLists.txt
@@ -49,7 +49,7 @@ add_library(quickstep_types_IntervalLit ../empty_src.cpp IntervalLit.hpp)
add_library(quickstep_types_IntervalParser IntervalParser.cpp IntervalParser.hpp)
add_library(quickstep_types_LongType LongType.cpp LongType.hpp)
add_library(quickstep_types_MetaType MetaType.cpp MetaType.hpp)
-add_library(quickstep_types_MetaTypeLite MetaTypeLite.cpp MetaTypeLite.hpp)
+add_library(quickstep_types_MetaType-decl ../empty_src.cpp MetaType-decl.hpp)
add_library(quickstep_types_NullCoercibilityCheckMacro ../empty_src.cpp NullCoercibilityCheckMacro.hpp)
add_library(quickstep_types_NullLit ../empty_src.cpp NullLit.hpp)
add_library(quickstep_types_NullType ../empty_src.cpp NullType.hpp)
@@ -59,8 +59,8 @@ add_library(quickstep_types_NumericTypeUnifier ../empty_src.cpp NumericTypeUnifi
add_library(quickstep_types_TextType TextType.cpp TextType.hpp)
add_library(quickstep_types_Type Type.cpp Type.hpp)
add_library(quickstep_types_TypeErrors ../empty_src.cpp TypeErrors.hpp)
-add_library(quickstep_types_TypeFactory ../empty_src.cpp TypeFactory.hpp)
-add_library(quickstep_types_TypeFactoryLite TypeFactoryLite.cpp TypeFactoryLite.hpp)
+add_library(quickstep_types_TypeFactory TypeFactory.cpp TypeFactory.hpp)
+add_library(quickstep_types_TypeFactory-decl ../empty_src.cpp TypeFactory-decl.hpp)
add_library(quickstep_types_TypeID TypeID.cpp TypeID.hpp)
add_library(quickstep_types_TypeIDSelectors ../empty_src.cpp TypeIDSelectors.hpp)
add_library(quickstep_types_TypeRegistrar ../empty_src.cpp TypeRegistrar.hpp)
@@ -76,6 +76,7 @@ add_library(quickstep_types_YearMonthIntervalType YearMonthIntervalType.cpp Year
target_link_libraries(quickstep_types_ArrayType
quickstep_types_Type
quickstep_types_TypeID
+ quickstep_types_TypeRegistrar
quickstep_types_TypeSynthesizer
quickstep_types_Type_proto
quickstep_utility_Macros)
@@ -175,10 +176,12 @@ target_link_libraries(quickstep_types_LongType
quickstep_types_TypedValue
quickstep_utility_Macros)
target_link_libraries(quickstep_types_MetaType
- quickstep_types_MetaTypeLite
- quickstep_types_TypeFactoryLite
+ quickstep_types_MetaType-decl
+ quickstep_types_TypeFactory-decl
+ quickstep_types_TypeID
+ quickstep_types_TypedValue
quickstep_types_Type_proto)
-target_link_libraries(quickstep_types_MetaTypeLite
+target_link_libraries(quickstep_types_MetaType-decl
quickstep_types_Type
quickstep_types_TypeID
quickstep_types_TypeSynthesizer
@@ -204,7 +207,6 @@ target_link_libraries(quickstep_types_NumericTypeSafeCoercibility
target_link_libraries(quickstep_types_NumericTypeUnifier
quickstep_types_NumericTypeSafeCoercibility)
target_link_libraries(quickstep_types_TextType
- quickstep_types_TextType
quickstep_types_Type
quickstep_types_TypeID
quickstep_types_TypeSynthesizer
@@ -214,19 +216,24 @@ target_link_libraries(quickstep_types_Type
glog
quickstep_types_Type_proto
quickstep_types_TypeID
+ quickstep_types_TypeRegistrar
quickstep_types_TypedValue
quickstep_utility_Macros)
-target_link_libraries(quickstep_types_TypeFactoryLite
- glog
+target_link_libraries(quickstep_types_TypeFactory
quickstep_types_GenericValue
+ quickstep_types_MetaType
quickstep_types_Type
+ quickstep_types_TypeFactory-decl
quickstep_types_TypeID
+ quickstep_types_TypeSynthesizer
quickstep_types_TypeUtil
quickstep_types_Type_proto
quickstep_utility_Macros)
-target_link_libraries(quickstep_types_TypeFactory
- quickstep_types_MetaType
- quickstep_types_TypeFactoryLite)
+target_link_libraries(quickstep_types_TypeFactory-decl
+ glog
+ quickstep_types_GenericValue
+ quickstep_types_TypeID
+ quickstep_utility_Macros)
target_link_libraries(quickstep_types_TypeID
quickstep_types_Type_proto
quickstep_utility_Macros)
@@ -237,7 +244,6 @@ target_link_libraries(quickstep_types_TypeRegistrar
quickstep_types_DatetimeLit
quickstep_types_IntervalLit
quickstep_types_NullLit
- quickstep_types_Type
quickstep_types_TypeID
quickstep_types_TypeIDSelectors
quickstep_utility_meta_Common)
@@ -250,7 +256,6 @@ target_link_libraries(quickstep_types_TypeSynthesizer
quickstep_types_Type_proto
quickstep_utility_HashPair
quickstep_utility_Macros
- quickstep_utility_PtrMap
quickstep_utility_meta_Common)
target_link_libraries(quickstep_types_TypeUtil
quickstep_types_ArrayType
@@ -263,7 +268,7 @@ target_link_libraries(quickstep_types_TypeUtil
quickstep_types_FloatType
quickstep_types_IntType
quickstep_types_LongType
- quickstep_types_MetaTypeLite
+ quickstep_types_MetaType-decl
quickstep_types_NullType
quickstep_types_TextType
quickstep_types_Type
@@ -329,7 +334,7 @@ target_link_libraries(quickstep_types
quickstep_types_IntervalParser
quickstep_types_LongType
quickstep_types_MetaType
- quickstep_types_MetaTypeLite
+ quickstep_types_MetaType-decl
quickstep_types_NullCoercibilityCheckMacro
quickstep_types_NullLit
quickstep_types_NullType
@@ -342,7 +347,7 @@ target_link_libraries(quickstep_types
quickstep_types_Type_proto
quickstep_types_TypeErrors
quickstep_types_TypeFactory
- quickstep_types_TypeFactoryLite
+ quickstep_types_TypeFactory-decl
quickstep_types_TypeID
quickstep_types_TypeIDSelectors
quickstep_types_TypeRegistrar
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/MetaType-decl.hpp
----------------------------------------------------------------------
diff --git a/types/MetaType-decl.hpp b/types/MetaType-decl.hpp
new file mode 100644
index 0000000..6942338
--- /dev/null
+++ b/types/MetaType-decl.hpp
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ **/
+
+#ifndef QUICKSTEP_TYPES_META_TYPE_DECL_HPP_
+#define QUICKSTEP_TYPES_META_TYPE_DECL_HPP_
+
+#include <cstddef>
+#include <string>
+
+#include "types/Type.hpp"
+#include "types/TypeID.hpp"
+#include "types/TypeSynthesizer.hpp"
+#include "utility/Macros.hpp"
+
+#include "glog/logging.h"
+
+namespace quickstep {
+
+class TypedValue;
+
+/** \addtogroup Types
+ * @{
+ */
+
+class MetaType : public TypeSynthesizer<kMetaType> {
+ public:
+ int getPrintWidth() const override {
+ return 16;
+ }
+
+ bool checkValuesEqual(const UntypedLiteral *lhs,
+ const UntypedLiteral *rhs,
+ const Type &rhs_type) const override;
+
+ TypedValue marshallValue(const UntypedLiteral *value) const override;
+
+ UntypedLiteral* unmarshallValue(const void *data,
+ const std::size_t length) const override;
+
+ std::string printValueToString(const UntypedLiteral *value) const override;
+
+ bool parseTypedValueFromString(const std::string &value_string,
+ TypedValue *value) const override {
+ return false;
+ }
+
+ private:
+ MetaType(const bool nullable)
+ : TypeSynthesizer<kMetaType>(nullable, sizeof(TypeID), 0x100) {
+ // TODO(refactor-type): Possibly infinite maximum size.
+ }
+
+ QUICKSTEP_SYNTHESIZE_TYPE(MetaType);
+};
+
+/** @} */
+
+} // namespace quickstep
+
+#endif // QUICKSTEP_TYPES_META_TYPE_DECL_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/MetaType.cpp
----------------------------------------------------------------------
diff --git a/types/MetaType.cpp b/types/MetaType.cpp
index f6e44ba..16a86c2 100644
--- a/types/MetaType.cpp
+++ b/types/MetaType.cpp
@@ -23,7 +23,9 @@
#include <string>
#include "types/Type.pb.h"
-#include "types/TypeFactoryLite.hpp"
+#include "types/TypeFactory-decl.hpp"
+#include "types/TypeID.hpp"
+#include "types/TypedValue.hpp"
namespace quickstep {
@@ -36,6 +38,15 @@ bool MetaType::checkValuesEqual(const UntypedLiteral *lhs,
return castValueToLiteral(lhs)->equals(*castValueToLiteral(rhs));
}
+TypedValue MetaType::marshallValue(const UntypedLiteral *value) const {
+ const Type *type = castValueToLiteral(value);
+ serialization::Type proto = type->getProto();
+ const std::size_t data_size = proto.ByteSize();
+ void *data = std::malloc(data_size);
+ proto.SerializeToArray(data, data_size);
+ return TypedValue::CreateWithOwnedData(kMetaType, data, data_size);
+}
+
UntypedLiteral* MetaType::unmarshallValue(const void *data,
const std::size_t data_size) const {
serialization::Type proto;
@@ -43,4 +54,10 @@ UntypedLiteral* MetaType::unmarshallValue(const void *data,
return new MetaTypeLiteral(&TypeFactory::ReconstructFromProto(proto));
}
+std::string MetaType::printValueToString(const UntypedLiteral *value) const {
+ DCHECK(value != nullptr);
+
+ return castValueToLiteral(value)->getName();
+}
+
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/MetaType.hpp
----------------------------------------------------------------------
diff --git a/types/MetaType.hpp b/types/MetaType.hpp
index 6edd270..7ccf9f5 100644
--- a/types/MetaType.hpp
+++ b/types/MetaType.hpp
@@ -20,6 +20,6 @@
#ifndef QUICKSTEP_TYPES_META_TYPE_HPP_
#define QUICKSTEP_TYPES_META_TYPE_HPP_
-#include "types/MetaTypeLite.hpp"
+#include "types/MetaType-decl.hpp"
#endif // QUICKSTEP_TYPES_META_TYPE_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/MetaTypeLite.cpp
----------------------------------------------------------------------
diff --git a/types/MetaTypeLite.cpp b/types/MetaTypeLite.cpp
deleted file mode 100644
index 830f364..0000000
--- a/types/MetaTypeLite.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "types/MetaTypeLite.hpp"
-
-#include <cstddef>
-#include <string>
-
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-TypedValue MetaType::marshallValue(const UntypedLiteral *value) const {
- const Type *type = castValueToLiteral(value);
- serialization::Type proto = type->getProto();
- const std::size_t data_size = proto.ByteSize();
- void *data = std::malloc(data_size);
- proto.SerializeToArray(data, data_size);
- return TypedValue::CreateWithOwnedData(kMetaType, data, data_size);
-}
-
-std::string MetaType::printValueToString(const UntypedLiteral *value) const {
- DCHECK(value != nullptr);
-
- return castValueToLiteral(value)->getName();
-}
-
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/MetaTypeLite.hpp
----------------------------------------------------------------------
diff --git a/types/MetaTypeLite.hpp b/types/MetaTypeLite.hpp
deleted file mode 100644
index 09f879f..0000000
--- a/types/MetaTypeLite.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_TYPES_META_TYPE_LITE_HPP_
-#define QUICKSTEP_TYPES_META_TYPE_LITE_HPP_
-
-#include <cstddef>
-#include <string>
-
-#include "types/Type.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypeSynthesizer.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class TypedValue;
-
-/** \addtogroup Types
- * @{
- */
-
-class MetaType : public TypeSynthesizer<kMetaType> {
- public:
- int getPrintWidth() const override {
- return 16;
- }
-
- bool checkValuesEqual(const UntypedLiteral *lhs,
- const UntypedLiteral *rhs,
- const Type &rhs_type) const override;
-
- TypedValue marshallValue(const UntypedLiteral *value) const override;
-
- UntypedLiteral* unmarshallValue(const void *data,
- const std::size_t length) const override;
-
- std::string printValueToString(const UntypedLiteral *value) const override;
-
- bool parseTypedValueFromString(const std::string &value_string,
- TypedValue *value) const override {
- return false;
- }
-
- private:
- MetaType(const bool nullable)
- : TypeSynthesizer<kMetaType>(nullable, sizeof(TypeID), 0x100) {
- // TODO(refactor-type): Possibly infinite maximum size.
- }
-
- QUICKSTEP_SYNTHESIZE_TYPE(MetaType);
-};
-
-/** @} */
-
-} // namespace quickstep
-
-#endif // QUICKSTEP_TYPES_META_TYPE_LITE_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeFactory-decl.hpp
----------------------------------------------------------------------
diff --git a/types/TypeFactory-decl.hpp b/types/TypeFactory-decl.hpp
new file mode 100644
index 0000000..6edc05b
--- /dev/null
+++ b/types/TypeFactory-decl.hpp
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ **/
+
+#ifndef QUICKSTEP_TYPES_TYPE_FACTORY_DECL_HPP_
+#define QUICKSTEP_TYPES_TYPE_FACTORY_DECL_HPP_
+
+#include <cstddef>
+
+#include "types/GenericValue.hpp"
+#include "types/TypeID.hpp"
+#include "utility/Macros.hpp"
+
+namespace quickstep {
+
+class Type;
+
+namespace serialization { class Type; }
+
+/** \addtogroup Types
+ * @{
+ */
+
+/**
+ * @brief All-static factory object that provides access to Types, as well as
+ * methods for determining coercibility of Types.
+ **/
+class TypeFactory {
+ public:
+ /**
+ * @brief Determine if a length parameter is required when getting a Type of
+ * the specified TypeID.
+ *
+ * @param id The id of the desired Type.
+ * @return Whether a length must be specified for Types of the given id.
+ **/
+ static bool TypeRequiresLengthParameter(const TypeID id);
+
+ /**
+ * @brief Factory method to get a Type by its TypeID.
+ * @note This version is for Types without a length parameter (currently
+ * IntType, LongType, FloatType, and DoubleType). It is an error to
+ * call this with a Type which requires a length parameter.
+ *
+ * @param id The id of the desired Type.
+ * @param nullable Whether to get the nullable version of the Type.
+ * @return The Type corresponding to id.
+ **/
+ static const Type& GetType(const TypeID id, const bool nullable = false);
+
+ /**
+ * @brief Factory method to get a Type by its TypeID and length.
+ * @note This version is for Types with a length parameter (currently
+ * CharType and VarCharType). It is an error to call this with a Type
+ * which does not require a length parameter.
+ *
+ * @param id The id of the desired Type.
+ * @param length The length parameter of the desired Type.
+ * @param nullable Whether to get the nullable version of the Type.
+ * @return The Type corresponding to id and length.
+ **/
+ static const Type& GetType(const TypeID id,
+ const std::size_t length,
+ const bool nullable = false);
+
+ static const Type& GetType(const TypeID id,
+ const std::vector<GenericValue> ¶meters,
+ const bool nullable = false);
+
+ /**
+ * @brief Get a reference to a Type from that Type's serialized Protocol Buffer
+ * representation.
+ *
+ * @param proto A serialized Protocol Buffer representation of a Type,
+ * originally generated by getProto().
+ * @return The Type described by proto.
+ **/
+ static const Type& ReconstructFromProto(const serialization::Type &proto);
+
+ static GenericValue ReconstructValueFromProto(const serialization::GenericValue &proto);
+
+ /**
+ * @brief Check whether a serialization::Type is fully-formed and
+ * all parts are valid.
+ *
+ * @param proto A serialized Protocol Buffer representation of a Type,
+ * originally generated by getProto().
+ * @return Whether proto is fully-formed and valid.
+ **/
+ static bool ProtoIsValid(const serialization::Type &proto);
+
+ /**
+ * @brief Determine which of two types is most specific, i.e. which
+ * isSafelyCoercibleFrom() the other.
+ *
+ * @param first The first type to check.
+ * @param second The second type to check.
+ * @return The most precise type, or NULL if neither Type
+ * isSafelyCoercibleFrom() the other.
+ **/
+ static const Type* GetMostSpecificType(const Type &first, const Type &second);
+
+ /**
+ * @brief Determine a type, if any exists, which both arguments can be safely
+ * coerced to. It is possible that the resulting type may not be
+ * either argument.
+ *
+ * @param first The first type to check.
+ * @param second The second type to check.
+ * @return The unifying type, or NULL if none exists.
+ **/
+ static const Type* GetUnifyingType(const Type &first, const Type &second);
+
+ private:
+ // Undefined default constructor. Class is all-static and should not be
+ // instantiated.
+ TypeFactory();
+
+ DISALLOW_COPY_AND_ASSIGN(TypeFactory);
+};
+
+/** @} */
+
+} // namespace quickstep
+
+#endif // QUICKSTEP_TYPES_TYPE_FACTORY_DECL_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeFactory.cpp
----------------------------------------------------------------------
diff --git a/types/TypeFactory.cpp b/types/TypeFactory.cpp
index e69de29..45202f1 100644
--- a/types/TypeFactory.cpp
+++ b/types/TypeFactory.cpp
@@ -0,0 +1,171 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ **/
+
+#include "types/TypeFactory.hpp"
+
+#include <cstddef>
+#include <string>
+#include <vector>
+
+#include "types/GenericValue.hpp"
+#include "types/Type.hpp"
+#include "types/Type.pb.h"
+#include "types/TypeID.hpp"
+#include "types/TypeSynthesizer.hpp"
+#include "types/TypeUtil.hpp"
+#include "utility/Macros.hpp"
+
+#include "glog/logging.h"
+
+namespace quickstep {
+
+bool TypeFactory::TypeRequiresLengthParameter(const TypeID id) {
+ return TypeUtil::IsParameterizedPod(id);
+}
+
+const Type& TypeFactory::GetType(const TypeID id,
+ const bool nullable) {
+ DCHECK(TypeUtil::GetMemoryLayout(id) == kCxxInlinePod)
+ << "Called TypeFactory::GetType() with incorrect parameters.";
+
+ return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kCxxInlinePod>>(
+ id,
+ [&](auto id) -> const Type* { // NOLINT(build/c++11)
+ return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable);
+ });
+}
+
+const Type& TypeFactory::GetType(const TypeID id,
+ const std::size_t length,
+ const bool nullable) {
+ DCHECK(TypeRequiresLengthParameter(id))
+ << "Called TypeFactory::GetType() with incorrect parameters.";
+
+ return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kParInlinePod, kParOutOfLinePod>>(
+ id,
+ [&](auto id) -> const Type* { // NOLINT(build/c++11)
+ return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable, length);
+ });
+}
+
+const Type& TypeFactory::GetType(const TypeID id,
+ const std::vector<GenericValue> ¶meters,
+ const bool nullable) {
+ DCHECK(TypeUtil::GetMemoryLayout(id) == kCxxGeneric)
+ << "Called TypeFactory::GetType() with incorrect parameters.";
+
+ return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kCxxGeneric>>(
+ id,
+ [&](auto id) -> const Type* { // NOLINT(build/c++11)
+ return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable, parameters);
+ });
+}
+
+bool TypeFactory::ProtoIsValid(const serialization::Type &proto) {
+ // Check that proto is fully initialized.
+ if (!proto.IsInitialized()) {
+ return false;
+ }
+
+ // Check that the type_id is valid, and has length if parameterized.
+ const TypeID type_id = TypeIDFactory::ReconstructFromProto(proto.type_id());
+
+ if (type_id == kNullType) {
+ return proto.nullable();
+ }
+
+ if (TypeRequiresLengthParameter(type_id)) {
+ return proto.has_length();
+ }
+
+ return true;
+}
+
+const Type& TypeFactory::ReconstructFromProto(const serialization::Type &proto) {
+ DCHECK(ProtoIsValid(proto))
+ << "Attempted to create Type from an invalid proto description:\n"
+ << proto.DebugString();
+
+ const TypeID type_id = TypeIDFactory::ReconstructFromProto(proto.type_id());
+
+ switch (TypeUtil::GetMemoryLayout(type_id)) {
+ case kCxxInlinePod:
+ return GetType(type_id, proto.nullable());
+ case kParInlinePod: // Fall through
+ case kParOutOfLinePod:
+ return GetType(type_id, proto.length(), proto.nullable());
+ case kCxxGeneric: {
+ std::vector<GenericValue> parameters;
+ for (int i = 0; i < proto.parameters_size(); ++i) {
+ parameters.emplace_back(ReconstructValueFromProto(proto.parameters(i)));
+ }
+ return GetType(type_id, parameters, proto.nullable());
+ }
+ }
+}
+
+GenericValue TypeFactory::ReconstructValueFromProto(
+ const serialization::GenericValue &proto) {
+ const Type &type = ReconstructFromProto(proto.type());
+ if (proto.has_data()) {
+ return GenericValue(type,
+ type.unmarshallValue(proto.data().c_str(),
+ proto.data().size()),
+ true /* take_ownership */);
+ } else {
+ return GenericValue(type);
+ }
+}
+
+const Type* TypeFactory::GetMostSpecificType(const Type &first, const Type &second) {
+ if (first.isSafelyCoercibleFrom(second)) {
+ return &first;
+ } else if (second.isSafelyCoercibleFrom(first)) {
+ return &second;
+ } else {
+ return nullptr;
+ }
+}
+
+const Type* TypeFactory::GetUnifyingType(const Type &first, const Type &second) {
+ // TODO: cache
+ const Type *unifier = nullptr;
+ if (first.isNullable() || second.isNullable()) {
+ unifier = GetMostSpecificType(first.getNullableVersion(),
+ second.getNullableVersion());
+ if (unifier == nullptr) {
+ if (((first.getTypeID() == kLong) && (second.getTypeID() == kFloat))
+ || ((first.getTypeID() == kFloat) && (second.getTypeID() == kLong))) {
+ unifier = &(DoubleType::Instance(true));
+ }
+ }
+ } else {
+ unifier = GetMostSpecificType(first, second);
+ if (unifier == nullptr) {
+ if (((first.getTypeID() == kLong) && (second.getTypeID() == kFloat))
+ || ((first.getTypeID() == kFloat) && (second.getTypeID() == kLong))) {
+ unifier = &(DoubleType::Instance(false));
+ }
+ }
+ }
+
+ return unifier;
+}
+
+} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeFactory.hpp
----------------------------------------------------------------------
diff --git a/types/TypeFactory.hpp b/types/TypeFactory.hpp
index 3992b6c..1b997f6 100644
--- a/types/TypeFactory.hpp
+++ b/types/TypeFactory.hpp
@@ -20,7 +20,6 @@
#ifndef QUICKSTEP_TYPES_TYPE_FACTORY_HPP_
#define QUICKSTEP_TYPES_TYPE_FACTORY_HPP_
-#include "types/MetaType.hpp"
-#include "types/TypeFactoryLite.hpp"
+#include "types/TypeFactory-decl.hpp"
#endif // QUICKSTEP_TYPES_TYPE_FACTORY_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeFactoryLite.cpp
----------------------------------------------------------------------
diff --git a/types/TypeFactoryLite.cpp b/types/TypeFactoryLite.cpp
deleted file mode 100644
index c7c6b3b..0000000
--- a/types/TypeFactoryLite.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "types/TypeFactoryLite.hpp"
-
-#include <cstddef>
-#include <string>
-#include <vector>
-
-#include "types/GenericValue.hpp"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypeID.hpp"
-#include "types/TypeUtil.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool TypeFactory::TypeRequiresLengthParameter(const TypeID id) {
- return TypeUtil::IsParameterizedPod(id);
-}
-
-const Type& TypeFactory::GetType(const TypeID id,
- const bool nullable) {
- DCHECK(TypeUtil::GetMemoryLayout(id) == kCxxInlinePod)
- << "Called TypeFactory::GetType() with incorrect parameters.";
-
- return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kCxxInlinePod>>(
- id,
- [&](auto id) -> const Type* { // NOLINT(build/c++11)
- return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable);
- });
-}
-
-const Type& TypeFactory::GetType(const TypeID id,
- const std::size_t length,
- const bool nullable) {
- DCHECK(TypeRequiresLengthParameter(id))
- << "Called TypeFactory::GetType() with incorrect parameters.";
-
- return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kParInlinePod, kParOutOfLinePod>>(
- id,
- [&](auto id) -> const Type* { // NOLINT(build/c++11)
- return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable, length);
- });
-}
-
-const Type& TypeFactory::GetType(const TypeID id,
- const std::vector<GenericValue> ¶meters,
- const bool nullable) {
- DCHECK(TypeUtil::GetMemoryLayout(id) == kCxxGeneric)
- << "Called TypeFactory::GetType() with incorrect parameters.";
-
- return *InvokeOnTypeID<TypeIDSelectorMemoryLayout<kCxxGeneric>>(
- id,
- [&](auto id) -> const Type* { // NOLINT(build/c++11)
- return &TypeIDTrait<decltype(id)::value>::TypeClass::Instance(nullable, parameters);
- });
-}
-
-bool TypeFactory::ProtoIsValid(const serialization::Type &proto) {
- // Check that proto is fully initialized.
- if (!proto.IsInitialized()) {
- return false;
- }
-
- // Check that the type_id is valid, and has length if parameterized.
- const TypeID type_id = TypeIDFactory::ReconstructFromProto(proto.type_id());
-
- if (type_id == kNullType) {
- return proto.nullable();
- }
-
- if (TypeRequiresLengthParameter(type_id)) {
- return proto.has_length();
- }
-
- return true;
-}
-
-const Type& TypeFactory::ReconstructFromProto(const serialization::Type &proto) {
- DCHECK(ProtoIsValid(proto))
- << "Attempted to create Type from an invalid proto description:\n"
- << proto.DebugString();
-
- const TypeID type_id = TypeIDFactory::ReconstructFromProto(proto.type_id());
-
- switch (TypeUtil::GetMemoryLayout(type_id)) {
- case kCxxInlinePod:
- return GetType(type_id, proto.nullable());
- case kParInlinePod: // Fall through
- case kParOutOfLinePod:
- return GetType(type_id, proto.length(), proto.nullable());
- case kCxxGeneric: {
- std::vector<GenericValue> parameters;
- for (int i = 0; i < proto.parameters_size(); ++i) {
- parameters.emplace_back(ReconstructValueFromProto(proto.parameters(i)));
- }
- return GetType(type_id, parameters, proto.nullable());
- }
- }
-}
-
-GenericValue TypeFactory::ReconstructValueFromProto(
- const serialization::GenericValue &proto) {
- const Type &type = ReconstructFromProto(proto.type());
- if (proto.has_data()) {
- return GenericValue(type,
- type.unmarshallValue(proto.data().c_str(),
- proto.data().size()),
- true /* take_ownership */);
- } else {
- return GenericValue(type);
- }
-}
-
-const Type* TypeFactory::GetMostSpecificType(const Type &first, const Type &second) {
- if (first.isSafelyCoercibleFrom(second)) {
- return &first;
- } else if (second.isSafelyCoercibleFrom(first)) {
- return &second;
- } else {
- return nullptr;
- }
-}
-
-const Type* TypeFactory::GetUnifyingType(const Type &first, const Type &second) {
- // TODO: cache
- const Type *unifier = nullptr;
- if (first.isNullable() || second.isNullable()) {
- unifier = GetMostSpecificType(first.getNullableVersion(),
- second.getNullableVersion());
- if (unifier == nullptr) {
- if (((first.getTypeID() == kLong) && (second.getTypeID() == kFloat))
- || ((first.getTypeID() == kFloat) && (second.getTypeID() == kLong))) {
- unifier = &(DoubleType::Instance(true));
- }
- }
- } else {
- unifier = GetMostSpecificType(first, second);
- if (unifier == nullptr) {
- if (((first.getTypeID() == kLong) && (second.getTypeID() == kFloat))
- || ((first.getTypeID() == kFloat) && (second.getTypeID() == kLong))) {
- unifier = &(DoubleType::Instance(false));
- }
- }
- }
-
- return unifier;
-}
-
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeFactoryLite.hpp
----------------------------------------------------------------------
diff --git a/types/TypeFactoryLite.hpp b/types/TypeFactoryLite.hpp
deleted file mode 100644
index eeafbf2..0000000
--- a/types/TypeFactoryLite.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_TYPES_TYPE_FACTORY_LITE_HPP_
-#define QUICKSTEP_TYPES_TYPE_FACTORY_LITE_HPP_
-
-#include <cstddef>
-
-#include "types/GenericValue.hpp"
-#include "types/TypeID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-
-namespace serialization { class Type; }
-
-/** \addtogroup Types
- * @{
- */
-
-/**
- * @brief All-static factory object that provides access to Types, as well as
- * methods for determining coercibility of Types.
- **/
-class TypeFactory {
- public:
- /**
- * @brief Determine if a length parameter is required when getting a Type of
- * the specified TypeID.
- *
- * @param id The id of the desired Type.
- * @return Whether a length must be specified for Types of the given id.
- **/
- static bool TypeRequiresLengthParameter(const TypeID id);
-
- /**
- * @brief Factory method to get a Type by its TypeID.
- * @note This version is for Types without a length parameter (currently
- * IntType, LongType, FloatType, and DoubleType). It is an error to
- * call this with a Type which requires a length parameter.
- *
- * @param id The id of the desired Type.
- * @param nullable Whether to get the nullable version of the Type.
- * @return The Type corresponding to id.
- **/
- static const Type& GetType(const TypeID id, const bool nullable = false);
-
- /**
- * @brief Factory method to get a Type by its TypeID and length.
- * @note This version is for Types with a length parameter (currently
- * CharType and VarCharType). It is an error to call this with a Type
- * which does not require a length parameter.
- *
- * @param id The id of the desired Type.
- * @param length The length parameter of the desired Type.
- * @param nullable Whether to get the nullable version of the Type.
- * @return The Type corresponding to id and length.
- **/
- static const Type& GetType(const TypeID id,
- const std::size_t length,
- const bool nullable = false);
-
- static const Type& GetType(const TypeID id,
- const std::vector<GenericValue> ¶meters,
- const bool nullable = false);
-
- /**
- * @brief Get a reference to a Type from that Type's serialized Protocol Buffer
- * representation.
- *
- * @param proto A serialized Protocol Buffer representation of a Type,
- * originally generated by getProto().
- * @return The Type described by proto.
- **/
- static const Type& ReconstructFromProto(const serialization::Type &proto);
-
- static GenericValue ReconstructValueFromProto(const serialization::GenericValue &proto);
-
- /**
- * @brief Check whether a serialization::Type is fully-formed and
- * all parts are valid.
- *
- * @param proto A serialized Protocol Buffer representation of a Type,
- * originally generated by getProto().
- * @return Whether proto is fully-formed and valid.
- **/
- static bool ProtoIsValid(const serialization::Type &proto);
-
- /**
- * @brief Determine which of two types is most specific, i.e. which
- * isSafelyCoercibleFrom() the other.
- *
- * @param first The first type to check.
- * @param second The second type to check.
- * @return The most precise type, or NULL if neither Type
- * isSafelyCoercibleFrom() the other.
- **/
- static const Type* GetMostSpecificType(const Type &first, const Type &second);
-
- /**
- * @brief Determine a type, if any exists, which both arguments can be safely
- * coerced to. It is possible that the resulting type may not be
- * either argument.
- *
- * @param first The first type to check.
- * @param second The second type to check.
- * @return The unifying type, or NULL if none exists.
- **/
- static const Type* GetUnifyingType(const Type &first, const Type &second);
-
- private:
- // Undefined default constructor. Class is all-static and should not be
- // instantiated.
- TypeFactory();
-
- DISALLOW_COPY_AND_ASSIGN(TypeFactory);
-};
-
-/** @} */
-
-} // namespace quickstep
-
-#endif // QUICKSTEP_TYPES_TYPE_FACTORY_LITE_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeIDSelectors.hpp
----------------------------------------------------------------------
diff --git a/types/TypeIDSelectors.hpp b/types/TypeIDSelectors.hpp
index 6e4a2b0..bb1cf80 100644
--- a/types/TypeIDSelectors.hpp
+++ b/types/TypeIDSelectors.hpp
@@ -23,7 +23,6 @@
#include <type_traits>
#include "types/TypeID.hpp"
-#include "types/TypeRegistrar.hpp"
#include "utility/meta/Common.hpp"
#include "glog/logging.h"
@@ -139,36 +138,6 @@ struct TypeIDSelectorMemoryLayout<candidates...>::Implementation<
}
};
-//namespace internal {
-//
-//template <bool require_parameterized>
-//struct TypeIDSelectorParameterizedHelper {
-// template <typename TypeIDConstant, typename FunctorT, typename EnableT = void>
-// struct Implementation {
-//#pragma GCC diagnostic push
-//#pragma GCC diagnostic ignored "-Wreturn-type"
-// inline static auto Invoke(const FunctorT &functor)
-// -> decltype(functor(TypeIDConstant())) {
-// DLOG(FATAL) << "Unexpected TypeID: "
-// << kTypeNames[static_cast<int>(TypeIDConstant::value)];
-// }
-//#pragma GCC diagnostic pop
-// };
-//};
-//
-//template <bool require_non_parameterized>
-//template <typename TypeIDConstant, typename FunctorT>
-//struct TypeIDSelectorParameterizedHelper<require_non_parameterized>::Implementation<
-// TypeIDConstant, FunctorT,
-// std::enable_if_t<TypeIDTrait<TypeIDConstant::value>::kIsParPod
-// ^ require_non_parameterized>> {
-// inline static auto Invoke(const FunctorT &functor) {
-// return functor(TypeIDConstant());
-// }
-//};
-//
-//} // namespace internal
-
/** @} */
} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/0957264b/types/TypeUtil.hpp
----------------------------------------------------------------------
diff --git a/types/TypeUtil.hpp b/types/TypeUtil.hpp
index 52fe9ae..ca88456 100644
--- a/types/TypeUtil.hpp
+++ b/types/TypeUtil.hpp
@@ -32,7 +32,7 @@
#include "types/FloatType.hpp"
#include "types/IntType.hpp"
#include "types/LongType.hpp"
-#include "types/MetaTypeLite.hpp"
+#include "types/MetaType-decl.hpp"
#include "types/NullType.hpp"
#include "types/TextType.hpp"
#include "types/Type.hpp"