incubator-quickstep git commit: Updates

2017-08-04 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/copy-to c7bd8c6d1 -> 9eae02253


Updates


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/9eae0225
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/9eae0225
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/9eae0225

Branch: refs/heads/copy-to
Commit: 9eae022534bbb52f784a084c27c9aee360b046d6
Parents: c7bd8c6
Author: Jianqiao Zhu 
Authored: Fri Aug 4 19:59:07 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 19:59:07 2017 -0500

--
 parser/ParseKeyValue.hpp |  4 +--
 parser/ParseStatement.hpp| 23 +-
 query_execution/QueryContext.hpp | 37 ---
 relational_operators/TableExportOperator.cpp |  4 +--
 4 files changed, 45 insertions(+), 23 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9eae0225/parser/ParseKeyValue.hpp
--
diff --git a/parser/ParseKeyValue.hpp b/parser/ParseKeyValue.hpp
index f2564b5..62cba7f 100644
--- a/parser/ParseKeyValue.hpp
+++ b/parser/ParseKeyValue.hpp
@@ -198,7 +198,7 @@ class ParseKeyStringList : public ParseKeyValue {
 };
 
 /**
- * @brief The parsed representation of a key-value pair. Value if of int type.
+ * @brief The parsed representation of a key-value pair. Value is of int type.
  **/
 class ParseKeyIntegerValue : public ParseKeyValue {
  public:
@@ -254,7 +254,7 @@ class ParseKeyIntegerValue : public ParseKeyValue {
 };
 
 /**
- * @brief The parsed representation of a key-value pair. Value if of bool type.
+ * @brief The parsed representation of a key-value pair. Value is of bool type.
  **/
 class ParseKeyBoolValue : public ParseKeyValue {
  public:

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9eae0225/parser/ParseStatement.hpp
--
diff --git a/parser/ParseStatement.hpp b/parser/ParseStatement.hpp
index 60b2a08..c984b92 100644
--- a/parser/ParseStatement.hpp
+++ b/parser/ParseStatement.hpp
@@ -783,7 +783,7 @@ class ParseStatementInsertSelection : public 
ParseStatementInsert {
 class ParseStatementCopy : public ParseStatement {
  public:
   /**
-   * @brief Copy direction (FROM/TO).
+   * @brief Copy direction (FROM text file/TO text file).
*/
   enum CopyDirection {
 kFrom,
@@ -797,7 +797,7 @@ class ParseStatementCopy : public ParseStatement {
* @param column_number Column number of the first token of this node in the 
SQL statement.
* @param direction The copy direction (FROM/TO).
* @param relation_name The name of the relation.
-   * @param file_name The name of the text file.
+   * @param file_name The name of the file.
* @param params The optional parameters of the COPY statement.
**/
   ParseStatementCopy(const int line_number,
@@ -818,9 +818,9 @@ class ParseStatementCopy : public ParseStatement {
*
* @param line_number Line number of the first token of this node in the SQL 
statement.
* @param column_number Column number of the first token of this node in the 
SQL statement.
-   * @param set_operation_query The set operation query
+   * @param set_operation_query The set operation query.
* @param with_clause The WITH clause of common table query expressions.
-   * @param file_name The name of the text file.
+   * @param file_name The name of the file.
* @param params The optional parameters of the COPY statement.
**/
   ParseStatementCopy(const int line_number,
@@ -852,9 +852,9 @@ class ParseStatementCopy : public ParseStatement {
   }
 
   /**
-   * @brief Get the direction (FROM/TO) of the COPY statement.
+   * @brief Get the direction (FROM text file/TO text file) of the COPY 
statement.
*
-   * return The direction (FROM/TO) of the COPY statement.
+   * return The direction of the COPY statement.
*/
   const CopyDirection getCopyDirection() const {
 return direction_;
@@ -899,8 +899,7 @@ class ParseStatementCopy : public ParseStatement {
   /**
* @brief Get the additional COPY parameters.
*
-   * @return The string which terminates individual attribute values in the
-   * input file.
+   * @return The additional COPY parameters.
**/
   const PtrList* params() const {
 return params_.get();
@@ -957,7 +956,15 @@ class ParseStatementCopy : public ParseStatement {
   std::unique_ptr set_operation_query_;
 
   std::unique_ptr with_clause_;
+
+  // NOTE(jianqiao): For convenience of represenation, the file_name_ string
+  // contains a prefix character of '$' or '@' before its actual value, where
+  // (1) '$' indicates 

[4/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/parser/preprocessed/SqlLexer_gen.hpp
--
diff --git a/parser/preprocessed/SqlLexer_gen.hpp 
b/parser/preprocessed/SqlLexer_gen.hpp
index 86e36f0..5fafae5 100644
--- a/parser/preprocessed/SqlLexer_gen.hpp
+++ b/parser/preprocessed/SqlLexer_gen.hpp
@@ -13,88 +13,244 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 3
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
-#define yy_create_buffer quickstep_yy_create_buffer
+#ifdef yy_create_buffer
+#define quickstep_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer quickstep_yy_create_buffer
+#endif
 
-#define yy_delete_buffer quickstep_yy_delete_buffer
+#ifdef yy_delete_buffer
+#define quickstep_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer quickstep_yy_delete_buffer
+#endif
 
-#define yy_scan_buffer quickstep_yy_scan_buffer
+#ifdef yy_scan_buffer
+#define quickstep_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer quickstep_yy_scan_buffer
+#endif
 
-#define yy_scan_string quickstep_yy_scan_string
+#ifdef yy_scan_string
+#define quickstep_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string quickstep_yy_scan_string
+#endif
 
-#define yy_scan_bytes quickstep_yy_scan_bytes
+#ifdef yy_scan_bytes
+#define quickstep_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes quickstep_yy_scan_bytes
+#endif
 
-#define yy_init_buffer quickstep_yy_init_buffer
+#ifdef yy_init_buffer
+#define quickstep_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer quickstep_yy_init_buffer
+#endif
 
-#define yy_flush_buffer quickstep_yy_flush_buffer
+#ifdef yy_flush_buffer
+#define quickstep_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer quickstep_yy_flush_buffer
+#endif
 
-#define yy_load_buffer_state quickstep_yy_load_buffer_state
+#ifdef yy_load_buffer_state
+#define quickstep_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state quickstep_yy_load_buffer_state
+#endif
 
-#define yy_switch_to_buffer quickstep_yy_switch_to_buffer
+#ifdef yy_switch_to_buffer
+#define quickstep_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer quickstep_yy_switch_to_buffer
+#endif
 
-#define yypush_buffer_state quickstep_yypush_buffer_state
+#ifdef yypush_buffer_state
+#define quickstep_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state quickstep_yypush_buffer_state
+#endif
 
-#define yypop_buffer_state quickstep_yypop_buffer_state
+#ifdef yypop_buffer_state
+#define quickstep_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state quickstep_yypop_buffer_state
+#endif
 
-#define yyensure_buffer_stack quickstep_yyensure_buffer_stack
+#ifdef yyensure_buffer_stack
+#define quickstep_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack quickstep_yyensure_buffer_stack
+#endif
 
-#define yylex quickstep_yylex
+#ifdef yylex
+#define quickstep_yylex_ALREADY_DEFINED
+#else
+#define yylex quickstep_yylex
+#endif
 
-#define yyrestart quickstep_yyrestart
+#ifdef yyrestart
+#define quickstep_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart quickstep_yyrestart
+#endif
 
-#define yylex_init quickstep_yylex_init
+#ifdef yylex_init
+#define quickstep_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init quickstep_yylex_init
+#endif
 
-#define yylex_init_extra quickstep_yylex_init_extra
+#ifdef yylex_init_extra
+#define quickstep_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra quickstep_yylex_init_extra
+#endif
 
-#define yylex_destroy quickstep_yylex_destroy
+#ifdef yylex_destroy
+#define quickstep_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy quickstep_yylex_destroy
+#endif
 
-#define yyget_debug quickstep_yyget_debug
+#ifdef yyget_debug
+#define quickstep_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug quickstep_yyget_debug
+#endif
 
-#define yyset_debug quickstep_yyset_debug
+#ifdef yyset_debug
+#define quickstep_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug quickstep_yyset_debug
+#endif
 
-#define yyget_extra quickstep_yyget_extra
+#ifdef yyget_extra
+#define quickstep_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra quickstep_yyget_extra
+#endif
 
-#define yyset_extra quickstep_yyset_extra
+#ifdef yyset_extra
+#define quickstep_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra quickstep_yyset_extra
+#endif
 
-#define yyget_in quickstep_yyget_in
+#ifdef yyget_in
+#define quickstep_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in quickstep_yyget_in
+#endif
 
-#define yyset_in quickstep_yyset_in
+#ifdef yyset_in
+#define quickstep_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in quickstep_yyset_in
+#endif
 
-

[3/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/parser/preprocessed/SqlParser_gen.cpp
--
diff --git a/parser/preprocessed/SqlParser_gen.cpp 
b/parser/preprocessed/SqlParser_gen.cpp
index 5cd7426..72c61dd 100644
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ b/parser/preprocessed/SqlParser_gen.cpp
@@ -237,90 +237,91 @@ extern int quickstep_yydebug;
 TOKEN_DECIMAL = 304,
 TOKEN_DEFAULT = 305,
 TOKEN_DELETE = 306,
-TOKEN_DELIMITER = 307,
-TOKEN_DESC = 308,
-TOKEN_DISTINCT = 309,
-TOKEN_DOUBLE = 310,
-TOKEN_DROP = 311,
-TOKEN_ELSE = 312,
-TOKEN_END = 313,
-TOKEN_ESCAPE_STRINGS = 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_LEFT = 339,
-TOKEN_LIMIT = 340,
-TOKEN_LONG = 341,
-TOKEN_MINUTE = 342,
-TOKEN_MONTH = 343,
-TOKEN_NULL = 344,
-TOKEN_NULLS = 345,
-TOKEN_OFF = 346,
-TOKEN_ON = 347,
-TOKEN_ORDER = 348,
-TOKEN_OUTER = 349,
-TOKEN_OVER = 350,
-TOKEN_PARTITION = 351,
-TOKEN_PARTITIONS = 352,
-TOKEN_PERCENT = 353,
-TOKEN_PRECEDING = 354,
-TOKEN_PRIMARY = 355,
-TOKEN_PRIORITY = 356,
-TOKEN_QUIT = 357,
-TOKEN_RANGE = 358,
-TOKEN_REAL = 359,
-TOKEN_REFERENCES = 360,
-TOKEN_RIGHT = 361,
-TOKEN_ROW = 362,
-TOKEN_ROW_DELIMITER = 363,
-TOKEN_ROWS = 364,
-TOKEN_SECOND = 365,
-TOKEN_SELECT = 366,
-TOKEN_SET = 367,
-TOKEN_SMA = 368,
-TOKEN_SMALLINT = 369,
+TOKEN_DESC = 307,
+TOKEN_DISTINCT = 308,
+TOKEN_DOUBLE = 309,
+TOKEN_DROP = 310,
+TOKEN_ELSE = 311,
+TOKEN_END = 312,
+TOKEN_EXISTS = 313,
+TOKEN_EXTRACT = 314,
+TOKEN_FALSE = 315,
+TOKEN_FIRST = 316,
+TOKEN_FLOAT = 317,
+TOKEN_FOLLOWING = 318,
+TOKEN_FOR = 319,
+TOKEN_FOREIGN = 320,
+TOKEN_FROM = 321,
+TOKEN_FULL = 322,
+TOKEN_GROUP = 323,
+TOKEN_HASH = 324,
+TOKEN_HAVING = 325,
+TOKEN_HOUR = 326,
+TOKEN_IN = 327,
+TOKEN_INDEX = 328,
+TOKEN_INNER = 329,
+TOKEN_INSERT = 330,
+TOKEN_INTEGER = 331,
+TOKEN_INTERVAL = 332,
+TOKEN_INTO = 333,
+TOKEN_JOIN = 334,
+TOKEN_KEY = 335,
+TOKEN_LAST = 336,
+TOKEN_LEFT = 337,
+TOKEN_LIMIT = 338,
+TOKEN_LONG = 339,
+TOKEN_MINUTE = 340,
+TOKEN_MONTH = 341,
+TOKEN_NULL = 342,
+TOKEN_NULLS = 343,
+TOKEN_OFF = 344,
+TOKEN_ON = 345,
+TOKEN_ORDER = 346,
+TOKEN_OUTER = 347,
+TOKEN_OVER = 348,
+TOKEN_PARTITION = 349,
+TOKEN_PARTITIONS = 350,
+TOKEN_PERCENT = 351,
+TOKEN_PRECEDING = 352,
+TOKEN_PRIMARY = 353,
+TOKEN_PRIORITY = 354,
+TOKEN_QUIT = 355,
+TOKEN_RANGE = 356,
+TOKEN_REAL = 357,
+TOKEN_REFERENCES = 358,
+TOKEN_RIGHT = 359,
+TOKEN_ROW = 360,
+TOKEN_ROW_DELIMITER = 361,
+TOKEN_ROWS = 362,
+TOKEN_SECOND = 363,
+TOKEN_SELECT = 364,
+TOKEN_SET = 365,
+TOKEN_SMA = 366,
+TOKEN_SMALLINT = 367,
+TOKEN_STDERR = 368,
+TOKEN_STDOUT = 369,
 TOKEN_SUBSTRING = 370,
 TOKEN_TABLE = 371,
 TOKEN_THEN = 372,
 TOKEN_TIME = 373,
 TOKEN_TIMESTAMP = 374,
-TOKEN_TRUE = 375,
-TOKEN_TUPLESAMPLE = 376,
-TOKEN_UNBOUNDED = 377,
-TOKEN_UNIQUE = 378,
-TOKEN_UPDATE = 379,
-TOKEN_USING = 380,
-TOKEN_VALUES = 381,
-TOKEN_VARCHAR = 382,
-TOKEN_WHEN = 383,
-TOKEN_WHERE = 384,
-TOKEN_WINDOW = 385,
-TOKEN_WITH = 386,
-TOKEN_YEAR = 387,
-TOKEN_YEARMONTH = 388,
-TOKEN_EOF = 389,
-TOKEN_LEX_ERROR = 390
+TOKEN_TO = 375,
+TOKEN_TRUE = 376,
+TOKEN_TUPLESAMPLE = 377,
+TOKEN_UNBOUNDED = 378,
+TOKEN_UNIQUE = 379,
+TOKEN_UPDATE = 380,
+TOKEN_USING = 381,
+TOKEN_VALUES = 382,
+TOKEN_VARCHAR = 383,
+TOKEN_WHEN = 384,
+TOKEN_WHERE = 385,
+TOKEN_WINDOW = 386,
+TOKEN_WITH = 387,
+TOKEN_YEAR = 388,
+TOKEN_YEARMONTH = 389,
+TOKEN_EOF = 390,
+TOKEN_LEX_ERROR = 391
   };
 #endif
 
@@ -380,8 +381,7 @@ union YYSTYPE
   quickstep::ParseKeyStringValue *key_string_value_;
   quickstep::ParseKeyStringList *key_string_list_;
   quickstep::ParseKeyIntegerValue *key_integer_value_;
-
-  quickstep::ParseCopyFromParams *copy_from_params_;
+  quickstep::ParseKeyBoolValue *key_bool_value_;
 
   quickstep::ParseAssignment *assignment_;
   quickstep::PtrList *assignment_list_;
@@ -394,7 +394,7 @@ union YYSTYPE
   

[6/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
Initial commit


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/c7bd8c6d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/c7bd8c6d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/c7bd8c6d

Branch: refs/heads/copy-to
Commit: c7bd8c6d19adf21a468aacd9b6c04b839158f5d4
Parents: 6792570
Author: Jianqiao Zhu 
Authored: Fri Aug 4 16:49:45 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 16:50:21 2017 -0500

--
 parser/ParseKeyValue.hpp |   75 +-
 parser/ParseStatement.hpp|  229 +-
 parser/SqlLexer.lpp  |9 +-
 parser/SqlParser.ypp |   93 +-
 parser/preprocessed/SqlLexer_gen.cpp | 1889 ++-
 parser/preprocessed/SqlLexer_gen.hpp |  467 ++-
 parser/preprocessed/SqlParser_gen.cpp| 3633 +++--
 parser/preprocessed/SqlParser_gen.hpp|  164 +-
 query_execution/CMakeLists.txt   |1 +
 query_execution/QueryContext.hpp |   19 +
 query_optimizer/CMakeLists.txt   |2 +
 query_optimizer/ExecutionGenerator.cpp   |   42 +-
 query_optimizer/ExecutionGenerator.hpp   |8 +
 query_optimizer/logical/CMakeLists.txt   |   12 +
 query_optimizer/logical/CopyFrom.cpp |6 +-
 query_optimizer/logical/CopyFrom.hpp |   43 +-
 query_optimizer/logical/CopyTo.cpp   |   75 +
 query_optimizer/logical/CopyTo.hpp   |  141 +
 query_optimizer/logical/LogicalType.hpp  |1 +
 query_optimizer/physical/CMakeLists.txt  |   15 +-
 query_optimizer/physical/CopyFrom.cpp|6 +-
 query_optimizer/physical/CopyFrom.hpp|   33 +-
 query_optimizer/physical/CopyTo.cpp  |   75 +
 query_optimizer/physical/CopyTo.hpp  |  148 +
 query_optimizer/physical/PhysicalType.hpp|1 +
 query_optimizer/resolver/CMakeLists.txt  |2 +
 query_optimizer/resolver/Resolver.cpp|  267 +-
 query_optimizer/resolver/Resolver.hpp|   21 +-
 query_optimizer/strategy/CMakeLists.txt  |2 +
 query_optimizer/strategy/OneToOne.cpp|   27 +-
 relational_operators/.Rhistory   |0
 relational_operators/CMakeLists.txt  |   20 +
 relational_operators/RelationalOperator.hpp  |1 +
 relational_operators/TableExportOperator.cpp |  303 ++
 relational_operators/TableExportOperator.hpp |  211 ++
 relational_operators/TextScanOperator.cpp|   19 +-
 relational_operators/TextScanOperator.hpp|   10 +-
 relational_operators/WorkOrder.proto |3 +-
 utility/BulkIOConfiguration.cpp  |   50 +
 utility/BulkIOConfiguration.hpp  |  114 +
 utility/CMakeLists.txt   |4 +
 validate_cmakelists.py   |6 +-
 42 files changed, 5167 insertions(+), 3080 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/parser/ParseKeyValue.hpp
--
diff --git a/parser/ParseKeyValue.hpp b/parser/ParseKeyValue.hpp
index 9d6d511..f2564b5 100644
--- a/parser/ParseKeyValue.hpp
+++ b/parser/ParseKeyValue.hpp
@@ -37,10 +37,11 @@ namespace quickstep {
  */
 class ParseKeyValue : public ParseTreeNode {
  public:
-  enum class KeyValueType {
+  enum KeyValueType {
+kStringBool,
+kStringInteger,
 kStringString,
-kStringStringList,
-kStringInteger
+kStringStringList
   };
 
   /**
@@ -102,7 +103,7 @@ class ParseKeyStringValue : public ParseKeyValue {
 value_(value) { }
 
   KeyValueType getKeyValueType() const override {
-return ParseKeyValue::KeyValueType::kStringString;
+return kStringString;
   }
 
   /**
@@ -155,10 +156,10 @@ class ParseKeyStringList : public ParseKeyValue {
  ParseString *key,
  PtrList *value)
   : ParseKeyValue(line_number, column_number, key),
-value_(value) { }
+value_(value) {}
 
   KeyValueType getKeyValueType() const override {
-return ParseKeyValue::KeyValueType::kStringStringList;
+return kStringStringList;
   }
 
   /**
@@ -197,7 +198,7 @@ class ParseKeyStringList : public ParseKeyValue {
 };
 
 /**
- * @brief The parsed representation of a key-value pair.
+ * @brief The parsed representation of a key-value pair. Value if of int type.
  **/
 class ParseKeyIntegerValue : public ParseKeyValue {
  public:
@@ -214,10 +215,10 @@ class ParseKeyIntegerValue : public ParseKeyValue {
ParseString *key,
NumericParseLiteralValue *value)
   : ParseKeyValue(line_number, column_number, key),
-value_(value) { }
+ 

[2/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/parser/preprocessed/SqlParser_gen.hpp
--
diff --git a/parser/preprocessed/SqlParser_gen.hpp 
b/parser/preprocessed/SqlParser_gen.hpp
index a6d12e2..f6b5247 100644
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ b/parser/preprocessed/SqlParser_gen.hpp
@@ -94,90 +94,91 @@ extern int quickstep_yydebug;
 TOKEN_DECIMAL = 304,
 TOKEN_DEFAULT = 305,
 TOKEN_DELETE = 306,
-TOKEN_DELIMITER = 307,
-TOKEN_DESC = 308,
-TOKEN_DISTINCT = 309,
-TOKEN_DOUBLE = 310,
-TOKEN_DROP = 311,
-TOKEN_ELSE = 312,
-TOKEN_END = 313,
-TOKEN_ESCAPE_STRINGS = 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_LEFT = 339,
-TOKEN_LIMIT = 340,
-TOKEN_LONG = 341,
-TOKEN_MINUTE = 342,
-TOKEN_MONTH = 343,
-TOKEN_NULL = 344,
-TOKEN_NULLS = 345,
-TOKEN_OFF = 346,
-TOKEN_ON = 347,
-TOKEN_ORDER = 348,
-TOKEN_OUTER = 349,
-TOKEN_OVER = 350,
-TOKEN_PARTITION = 351,
-TOKEN_PARTITIONS = 352,
-TOKEN_PERCENT = 353,
-TOKEN_PRECEDING = 354,
-TOKEN_PRIMARY = 355,
-TOKEN_PRIORITY = 356,
-TOKEN_QUIT = 357,
-TOKEN_RANGE = 358,
-TOKEN_REAL = 359,
-TOKEN_REFERENCES = 360,
-TOKEN_RIGHT = 361,
-TOKEN_ROW = 362,
-TOKEN_ROW_DELIMITER = 363,
-TOKEN_ROWS = 364,
-TOKEN_SECOND = 365,
-TOKEN_SELECT = 366,
-TOKEN_SET = 367,
-TOKEN_SMA = 368,
-TOKEN_SMALLINT = 369,
+TOKEN_DESC = 307,
+TOKEN_DISTINCT = 308,
+TOKEN_DOUBLE = 309,
+TOKEN_DROP = 310,
+TOKEN_ELSE = 311,
+TOKEN_END = 312,
+TOKEN_EXISTS = 313,
+TOKEN_EXTRACT = 314,
+TOKEN_FALSE = 315,
+TOKEN_FIRST = 316,
+TOKEN_FLOAT = 317,
+TOKEN_FOLLOWING = 318,
+TOKEN_FOR = 319,
+TOKEN_FOREIGN = 320,
+TOKEN_FROM = 321,
+TOKEN_FULL = 322,
+TOKEN_GROUP = 323,
+TOKEN_HASH = 324,
+TOKEN_HAVING = 325,
+TOKEN_HOUR = 326,
+TOKEN_IN = 327,
+TOKEN_INDEX = 328,
+TOKEN_INNER = 329,
+TOKEN_INSERT = 330,
+TOKEN_INTEGER = 331,
+TOKEN_INTERVAL = 332,
+TOKEN_INTO = 333,
+TOKEN_JOIN = 334,
+TOKEN_KEY = 335,
+TOKEN_LAST = 336,
+TOKEN_LEFT = 337,
+TOKEN_LIMIT = 338,
+TOKEN_LONG = 339,
+TOKEN_MINUTE = 340,
+TOKEN_MONTH = 341,
+TOKEN_NULL = 342,
+TOKEN_NULLS = 343,
+TOKEN_OFF = 344,
+TOKEN_ON = 345,
+TOKEN_ORDER = 346,
+TOKEN_OUTER = 347,
+TOKEN_OVER = 348,
+TOKEN_PARTITION = 349,
+TOKEN_PARTITIONS = 350,
+TOKEN_PERCENT = 351,
+TOKEN_PRECEDING = 352,
+TOKEN_PRIMARY = 353,
+TOKEN_PRIORITY = 354,
+TOKEN_QUIT = 355,
+TOKEN_RANGE = 356,
+TOKEN_REAL = 357,
+TOKEN_REFERENCES = 358,
+TOKEN_RIGHT = 359,
+TOKEN_ROW = 360,
+TOKEN_ROW_DELIMITER = 361,
+TOKEN_ROWS = 362,
+TOKEN_SECOND = 363,
+TOKEN_SELECT = 364,
+TOKEN_SET = 365,
+TOKEN_SMA = 366,
+TOKEN_SMALLINT = 367,
+TOKEN_STDERR = 368,
+TOKEN_STDOUT = 369,
 TOKEN_SUBSTRING = 370,
 TOKEN_TABLE = 371,
 TOKEN_THEN = 372,
 TOKEN_TIME = 373,
 TOKEN_TIMESTAMP = 374,
-TOKEN_TRUE = 375,
-TOKEN_TUPLESAMPLE = 376,
-TOKEN_UNBOUNDED = 377,
-TOKEN_UNIQUE = 378,
-TOKEN_UPDATE = 379,
-TOKEN_USING = 380,
-TOKEN_VALUES = 381,
-TOKEN_VARCHAR = 382,
-TOKEN_WHEN = 383,
-TOKEN_WHERE = 384,
-TOKEN_WINDOW = 385,
-TOKEN_WITH = 386,
-TOKEN_YEAR = 387,
-TOKEN_YEARMONTH = 388,
-TOKEN_EOF = 389,
-TOKEN_LEX_ERROR = 390
+TOKEN_TO = 375,
+TOKEN_TRUE = 376,
+TOKEN_TUPLESAMPLE = 377,
+TOKEN_UNBOUNDED = 378,
+TOKEN_UNIQUE = 379,
+TOKEN_UPDATE = 380,
+TOKEN_USING = 381,
+TOKEN_VALUES = 382,
+TOKEN_VARCHAR = 383,
+TOKEN_WHEN = 384,
+TOKEN_WHERE = 385,
+TOKEN_WINDOW = 386,
+TOKEN_WITH = 387,
+TOKEN_YEAR = 388,
+TOKEN_YEARMONTH = 389,
+TOKEN_EOF = 390,
+TOKEN_LEX_ERROR = 391
   };
 #endif
 
@@ -237,8 +238,7 @@ union YYSTYPE
   quickstep::ParseKeyStringValue *key_string_value_;
   quickstep::ParseKeyStringList *key_string_list_;
   quickstep::ParseKeyIntegerValue *key_integer_value_;
-
-  quickstep::ParseCopyFromParams *copy_from_params_;
+  quickstep::ParseKeyBoolValue *key_bool_value_;
 
   quickstep::ParseAssignment *assignment_;
   quickstep::PtrList *assignment_list_;
@@ -251,7 +251,7 @@ union YYSTYPE
   

[1/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/copy-to [created] c7bd8c6d1


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/relational_operators/TableExportOperator.hpp
--
diff --git a/relational_operators/TableExportOperator.hpp 
b/relational_operators/TableExportOperator.hpp
new file mode 100644
index 000..a8152c8
--- /dev/null
+++ b/relational_operators/TableExportOperator.hpp
@@ -0,0 +1,211 @@
+/**
+ * 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_RELATIONAL_OPERATORS_TABLE_EXPORT_OPERATOR_HPP_
+#define QUICKSTEP_RELATIONAL_OPERATORS_TABLE_EXPORT_OPERATOR_HPP_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "catalog/CatalogRelation.hpp"
+#include "catalog/CatalogTypedefs.hpp"
+#include "query_execution/QueryContext.hpp"
+#include "relational_operators/RelationalOperator.hpp"
+#include "relational_operators/WorkOrder.hpp"
+#include "storage/StorageBlockInfo.hpp"
+#include "threading/SpinMutex.hpp"
+#include "utility/BulkIOConfiguration.hpp"
+#include "utility/Macros.hpp"
+
+#include "glog/logging.h"
+
+#include "tmb/id_typedefs.h"
+
+namespace tmb { class MessageBus; }
+
+namespace quickstep {
+
+class CatalogRelationSchema;
+class InsertDestination;
+class StorageManager;
+class ValueAccessor;
+class WorkOrderProtosContainer;
+class WorkOrdersContainer;
+
+namespace serialization { class WorkOrder; }
+
+/** \addtogroup RelationalOperators
+ *  @{
+ */
+
+class TableExportOperator : public RelationalOperator {
+ public:
+  enum FeedbackMessageType : WorkOrder::FeedbackMessageType {
+  kBlockOutputMessage,
+  };
+
+  TableExportOperator(const std::size_t query_id,
+  const CatalogRelation _relation,
+  const bool input_relation_is_stored,
+  const std::string _name,
+  const BulkIOConfigurationPtr )
+  : RelationalOperator(query_id),
+input_relation_(input_relation),
+input_relation_is_stored_(input_relation_is_stored),
+file_name_(file_name),
+options_(options),
+input_relation_block_ids_(input_relation_is_stored
+  ? input_relation.getBlocksSnapshot()
+  : std::vector()),
+num_workorders_generated_(0),
+started_(false),
+query_context_(nullptr),
+num_blocks_written_(0),
+file_(nullptr) {}
+
+  ~TableExportOperator() override {}
+
+  OperatorType getOperatorType() const override {
+return kTableExport;
+  }
+
+  std::string getName() const override {
+return "TableExportOperator";
+  }
+
+  const CatalogRelation& input_relation() const {
+return input_relation_;
+  }
+
+  bool getAllWorkOrders(WorkOrdersContainer *container,
+QueryContext *query_context,
+StorageManager *storage_manager,
+const tmb::client_id scheduler_client_id,
+tmb::MessageBus *bus) override;
+
+  bool getAllWorkOrderProtos(WorkOrderProtosContainer *container) override;
+
+  void feedInputBlock(const block_id input_block_id,
+  const relation_id input_relation_id,
+  const partition_id part_id) override {
+if (input_relation_id == input_relation_.getID()) {
+  SpinMutexLock lock(block_ids_mutex_);
+  input_relation_block_ids_.emplace_back(input_block_id);
+}
+  }
+
+  void receiveFeedbackMessage(const WorkOrder::FeedbackMessage ) override;
+
+  void updateCatalogOnCompletion() override;
+
+ private:
+  const CatalogRelation _relation_;
+  const bool input_relation_is_stored_;
+  const std::string file_name_;
+  const BulkIOConfigurationPtr options_;
+
+  std::vector input_relation_block_ids_;
+  std::size_t num_workorders_generated_;
+
+  bool started_;
+
+  QueryContext *query_context_;
+  std::size_t num_blocks_written_;
+  std::unordered_map outputs_;
+  SpinMutex block_ids_mutex_;
+
+  FILE *file_;
+
+  DISALLOW_COPY_AND_ASSIGN(TableExportOperator);
+};
+
+class TableExportWorkOrder : public 

[5/6] incubator-quickstep git commit: Initial commit

2017-08-04 Thread jianqiao
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/c7bd8c6d/parser/preprocessed/SqlLexer_gen.cpp
--
diff --git a/parser/preprocessed/SqlLexer_gen.cpp 
b/parser/preprocessed/SqlLexer_gen.cpp
index bd77ee1..4800cde 100644
--- a/parser/preprocessed/SqlLexer_gen.cpp
+++ b/parser/preprocessed/SqlLexer_gen.cpp
@@ -9,88 +9,244 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 3
+#define YY_FLEX_SUBMINOR_VERSION 4
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
 
-#define yy_create_buffer quickstep_yy_create_buffer
+#ifdef yy_create_buffer
+#define quickstep_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer quickstep_yy_create_buffer
+#endif
 
-#define yy_delete_buffer quickstep_yy_delete_buffer
+#ifdef yy_delete_buffer
+#define quickstep_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer quickstep_yy_delete_buffer
+#endif
 
-#define yy_scan_buffer quickstep_yy_scan_buffer
+#ifdef yy_scan_buffer
+#define quickstep_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer quickstep_yy_scan_buffer
+#endif
 
-#define yy_scan_string quickstep_yy_scan_string
+#ifdef yy_scan_string
+#define quickstep_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string quickstep_yy_scan_string
+#endif
 
-#define yy_scan_bytes quickstep_yy_scan_bytes
+#ifdef yy_scan_bytes
+#define quickstep_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes quickstep_yy_scan_bytes
+#endif
 
-#define yy_init_buffer quickstep_yy_init_buffer
+#ifdef yy_init_buffer
+#define quickstep_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer quickstep_yy_init_buffer
+#endif
 
-#define yy_flush_buffer quickstep_yy_flush_buffer
+#ifdef yy_flush_buffer
+#define quickstep_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer quickstep_yy_flush_buffer
+#endif
 
-#define yy_load_buffer_state quickstep_yy_load_buffer_state
+#ifdef yy_load_buffer_state
+#define quickstep_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state quickstep_yy_load_buffer_state
+#endif
 
-#define yy_switch_to_buffer quickstep_yy_switch_to_buffer
+#ifdef yy_switch_to_buffer
+#define quickstep_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer quickstep_yy_switch_to_buffer
+#endif
 
-#define yypush_buffer_state quickstep_yypush_buffer_state
+#ifdef yypush_buffer_state
+#define quickstep_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state quickstep_yypush_buffer_state
+#endif
 
-#define yypop_buffer_state quickstep_yypop_buffer_state
+#ifdef yypop_buffer_state
+#define quickstep_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state quickstep_yypop_buffer_state
+#endif
 
-#define yyensure_buffer_stack quickstep_yyensure_buffer_stack
+#ifdef yyensure_buffer_stack
+#define quickstep_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack quickstep_yyensure_buffer_stack
+#endif
 
-#define yylex quickstep_yylex
+#ifdef yylex
+#define quickstep_yylex_ALREADY_DEFINED
+#else
+#define yylex quickstep_yylex
+#endif
 
-#define yyrestart quickstep_yyrestart
+#ifdef yyrestart
+#define quickstep_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart quickstep_yyrestart
+#endif
 
-#define yylex_init quickstep_yylex_init
+#ifdef yylex_init
+#define quickstep_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init quickstep_yylex_init
+#endif
 
-#define yylex_init_extra quickstep_yylex_init_extra
+#ifdef yylex_init_extra
+#define quickstep_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra quickstep_yylex_init_extra
+#endif
 
-#define yylex_destroy quickstep_yylex_destroy
+#ifdef yylex_destroy
+#define quickstep_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy quickstep_yylex_destroy
+#endif
 
-#define yyget_debug quickstep_yyget_debug
+#ifdef yyget_debug
+#define quickstep_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug quickstep_yyget_debug
+#endif
 
-#define yyset_debug quickstep_yyset_debug
+#ifdef yyset_debug
+#define quickstep_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug quickstep_yyset_debug
+#endif
 
-#define yyget_extra quickstep_yyget_extra
+#ifdef yyget_extra
+#define quickstep_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra quickstep_yyget_extra
+#endif
 
-#define yyset_extra quickstep_yyset_extra
+#ifdef yyset_extra
+#define quickstep_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra quickstep_yyset_extra
+#endif
 
-#define yyget_in quickstep_yyget_in
+#ifdef yyget_in
+#define quickstep_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in quickstep_yyget_in
+#endif
 
-#define yyset_in quickstep_yyset_in
+#ifdef yyset_in
+#define quickstep_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in quickstep_yyset_in
+#endif
 
-#define 

[incubator-quickstep] Git Push Summary

2017-08-04 Thread zuyuz
Repository: incubator-quickstep
Updated Branches:
  refs/heads/fix-compare-aggregate [deleted] 679257094


incubator-quickstep git commit: Fix the bug with min/max aggregation.

2017-08-04 Thread zuyuz
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master b1aab0096 -> 679257094


Fix the bug with min/max aggregation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/67925709
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/67925709
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/67925709

Branch: refs/heads/master
Commit: 67925709450be3ceef8a789c8054a446dc693a0a
Parents: b1aab00
Author: Jianqiao Zhu 
Authored: Wed Aug 2 15:47:30 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 16:12:15 2017 -0500

--
 .../comparisons/LiteralComparators-inl.hpp  | 76 +++-
 1 file changed, 60 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/67925709/types/operations/comparisons/LiteralComparators-inl.hpp
--
diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp 
b/types/operations/comparisons/LiteralComparators-inl.hpp
index fd59e2e..ad54d4e 100644
--- a/types/operations/comparisons/LiteralComparators-inl.hpp
+++ b/types/operations/comparisons/LiteralComparators-inl.hpp
@@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator
   column_accessor(accessor->template 
getColumnAccessor(value_accessor_id));
   DCHECK(column_accessor != nullptr);
-  while (accessor->next()) {
-const void *va_value = column_accessor->getUntypedValue();
-if (left_nullable && !va_value) {
-  continue;
+
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = column_accessor->getUntypedValue();
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value = column_accessor->getUntypedValue();
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 } else {
-  while (accessor->next()) {
-const void *va_value = accessor->template 
getUntypedValue(value_accessor_id);
-if (left_nullable && !va_value) {
-  continue;
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = accessor->template 
getUntypedValue(value_accessor_id);
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value =
+  accessor->template 
getUntypedValue(value_accessor_id);
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 }
   });
 
-  if (current_literal) {
-return TypedValue(*static_cast(current_literal));
-  } else {
+  if (is_null) {
 return TypedValue(current.getTypeID());
+  } else {
+return TypedValue(current_literal);
   }
 }
 



incubator-quickstep git commit: Fix the bug with min/max aggregation. [Forced Update!]

2017-08-04 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/fix-compare-aggregate d65f7dfba -> 679257094 (forced update)


Fix the bug with min/max aggregation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/67925709
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/67925709
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/67925709

Branch: refs/heads/fix-compare-aggregate
Commit: 67925709450be3ceef8a789c8054a446dc693a0a
Parents: b1aab00
Author: Jianqiao Zhu 
Authored: Wed Aug 2 15:47:30 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 16:12:15 2017 -0500

--
 .../comparisons/LiteralComparators-inl.hpp  | 76 +++-
 1 file changed, 60 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/67925709/types/operations/comparisons/LiteralComparators-inl.hpp
--
diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp 
b/types/operations/comparisons/LiteralComparators-inl.hpp
index fd59e2e..ad54d4e 100644
--- a/types/operations/comparisons/LiteralComparators-inl.hpp
+++ b/types/operations/comparisons/LiteralComparators-inl.hpp
@@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator
   column_accessor(accessor->template 
getColumnAccessor(value_accessor_id));
   DCHECK(column_accessor != nullptr);
-  while (accessor->next()) {
-const void *va_value = column_accessor->getUntypedValue();
-if (left_nullable && !va_value) {
-  continue;
+
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = column_accessor->getUntypedValue();
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value = column_accessor->getUntypedValue();
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 } else {
-  while (accessor->next()) {
-const void *va_value = accessor->template 
getUntypedValue(value_accessor_id);
-if (left_nullable && !va_value) {
-  continue;
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = accessor->template 
getUntypedValue(value_accessor_id);
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value =
+  accessor->template 
getUntypedValue(value_accessor_id);
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 }
   });
 
-  if (current_literal) {
-return TypedValue(*static_cast(current_literal));
-  } else {
+  if (is_null) {
 return TypedValue(current.getTypeID());
+  } else {
+return TypedValue(current_literal);
   }
 }
 



incubator-quickstep git commit: Fix the bug with min/max aggregation. [Forced Update!]

2017-08-04 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/fix-compare-aggregate f3b792bf5 -> d65f7dfba (forced update)


Fix the bug with min/max aggregation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/d65f7dfb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/d65f7dfb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/d65f7dfb

Branch: refs/heads/fix-compare-aggregate
Commit: d65f7dfba7ec2802340b5fd519ab9c46e64ffe6d
Parents: b1aab00
Author: Jianqiao Zhu 
Authored: Wed Aug 2 15:47:30 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 16:06:51 2017 -0500

--
 .../comparisons/LiteralComparators-inl.hpp  | 74 
 1 file changed, 59 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d65f7dfb/types/operations/comparisons/LiteralComparators-inl.hpp
--
diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp 
b/types/operations/comparisons/LiteralComparators-inl.hpp
index fd59e2e..1bb5d88 100644
--- a/types/operations/comparisons/LiteralComparators-inl.hpp
+++ b/types/operations/comparisons/LiteralComparators-inl.hpp
@@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator
   column_accessor(accessor->template 
getColumnAccessor(value_accessor_id));
   DCHECK(column_accessor != nullptr);
-  while (accessor->next()) {
-const void *va_value = column_accessor->getUntypedValue();
-if (left_nullable && !va_value) {
-  continue;
+
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = column_accessor->getUntypedValue();
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value = column_accessor->getUntypedValue();
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 } else {
-  while (accessor->next()) {
-const void *va_value = accessor->template 
getUntypedValue(value_accessor_id);
-if (left_nullable && !va_value) {
-  continue;
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = accessor->template 
getUntypedValue(value_accessor_id);
+  if (!left_nullable || va_value) {
+break;
+  }
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
+}
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+DCHECK(!is_null);
+while (accessor->next()) {
+  const void *va_value =
+  accessor->template 
getUntypedValue(value_accessor_id);
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 }
   });
 
-  if (current_literal) {
-return TypedValue(*static_cast(current_literal));
+  if (!is_null) {
+return TypedValue(current_literal);
   } else {
 return TypedValue(current.getTypeID());
   }



[2/3] incubator-quickstep git commit: Fixed the check failure if a query does not have profiling info.

2017-08-04 Thread jianqiao
Fixed the check failure if a query does not have profiling info.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/b1aab009
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/b1aab009
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/b1aab009

Branch: refs/heads/fix-compare-aggregate
Commit: b1aab0096ac67a623d860c1b70a6c558ea2ad450
Parents: 9dc9dfb
Author: Zuyu Zhang 
Authored: Thu Aug 3 14:43:56 2017 -0500
Committer: Zuyu Zhang 
Committed: Thu Aug 3 14:43:56 2017 -0500

--
 cli/QuickstepCli.cpp| 6 --
 query_execution/ForemanBase.hpp | 6 --
 2 files changed, 8 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b1aab009/cli/QuickstepCli.cpp
--
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
index d8e3c5c..bf65699 100644
--- a/cli/QuickstepCli.cpp
+++ b/cli/QuickstepCli.cpp
@@ -406,9 +406,11 @@ int main(int argc, char* argv[]) {
 foreman.printWorkOrderProfilingResults(query_id, stdout);
   }
   if (quickstep::FLAGS_visualize_execution_dag) {
-const auto _stats =
+const auto *profiling_stats =
 foreman.getWorkOrderProfilingResults(query_id);
-dag_visualizer->bindProfilingStats(profiling_stats);
+if (profiling_stats) {
+  dag_visualizer->bindProfilingStats(*profiling_stats);
+}
 std::cerr << "\n" << dag_visualizer->toDOT() << "\n";
   }
 } catch (const std::exception ) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/b1aab009/query_execution/ForemanBase.hpp
--
diff --git a/query_execution/ForemanBase.hpp b/query_execution/ForemanBase.hpp
index ee6c7ce..60434a3 100644
--- a/query_execution/ForemanBase.hpp
+++ b/query_execution/ForemanBase.hpp
@@ -84,9 +84,11 @@ class ForemanBase : public Thread {
* @param query_id The ID of the query for which the results are to be 
printed.
* @return A vector of records, each being a single profiling entry.
**/
-  const std::vector& getWorkOrderProfilingResults(
+  const std::vector* getWorkOrderProfilingResults(
   const std::size_t query_id) const {
-return policy_enforcer_->getProfilingResults(query_id);
+return policy_enforcer_->hasProfilingResults(query_id)
+   ? &(policy_enforcer_->getProfilingResults(query_id))
+   : nullptr;
   }
 
   /**



[1/3] incubator-quickstep git commit: Disabled NetworkUtil_unittest. [Forced Update!]

2017-08-04 Thread jianqiao
Repository: incubator-quickstep
Updated Branches:
  refs/heads/fix-compare-aggregate 88a1598c7 -> f3b792bf5 (forced update)


Disabled NetworkUtil_unittest.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/9dc9dfbf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/9dc9dfbf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/9dc9dfbf

Branch: refs/heads/fix-compare-aggregate
Commit: 9dc9dfbfcbb072b2280394d78abc8f2554881d9a
Parents: e80e5c8
Author: Zuyu Zhang 
Authored: Wed Aug 2 19:46:16 2017 -0500
Committer: Zuyu Zhang 
Committed: Wed Aug 2 20:46:21 2017 -0500

--
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/9dc9dfbf/.travis.yml
--
diff --git a/.travis.yml b/.travis.yml
index 868ffaf..9820599 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -83,7 +83,7 @@ script:
   - ./validate_cmakelists.py
   - ./cyclic_dependency.py
   - (cd build && make)
-  - (cd build && ctest --output-on-failure -j$TEST_JOBS)
+  - (cd build && ctest --output-on-failure -E NetworkUtil_unittest 
-j$TEST_JOBS)
 
 after_failure:
   - df -h



[3/3] incubator-quickstep git commit: Fix the bug with min/max aggregation.

2017-08-04 Thread jianqiao
Fix the bug with min/max aggregation.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/f3b792bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/f3b792bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/f3b792bf

Branch: refs/heads/fix-compare-aggregate
Commit: f3b792bf532aad41724b91cf88c97fcfbbdc1ea9
Parents: b1aab00
Author: Jianqiao Zhu 
Authored: Wed Aug 2 15:47:30 2017 -0500
Committer: Jianqiao Zhu 
Committed: Fri Aug 4 14:27:12 2017 -0500

--
 .../comparisons/LiteralComparators-inl.hpp  | 72 
 1 file changed, 57 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/f3b792bf/types/operations/comparisons/LiteralComparators-inl.hpp
--
diff --git a/types/operations/comparisons/LiteralComparators-inl.hpp 
b/types/operations/comparisons/LiteralComparators-inl.hpp
index fd59e2e..b7271ad 100644
--- a/types/operations/comparisons/LiteralComparators-inl.hpp
+++ b/types/operations/comparisons/LiteralComparators-inl.hpp
@@ -543,7 +543,11 @@ TypedValue LiteralUncheckedComparator
   column_accessor(accessor->template 
getColumnAccessor(value_accessor_id));
   DCHECK(column_accessor != nullptr);
-  while (accessor->next()) {
-const void *va_value = column_accessor->getUntypedValue();
-if (left_nullable && !va_value) {
-  continue;
+
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = column_accessor->getUntypedValue();
+  if (!left_nullable || va_value) {
+break;
+  }
+}
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+while (accessor->next()) {
+  const void *va_value = column_accessor->getUntypedValue();
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 } else {
-  while (accessor->next()) {
-const void *va_value = accessor->template 
getUntypedValue(value_accessor_id);
-if (left_nullable && !va_value) {
-  continue;
+  // Locate the first non-null value.
+  if (is_null) {
+const void *va_value = nullptr;
+while (accessor->next()) {
+  va_value = accessor->template 
getUntypedValue(value_accessor_id);
+  if (!left_nullable || va_value) {
+break;
+  }
 }
-if (!current_literal || this->compareDataPtrsHelper(va_value, 
current_literal)) {
-  current_literal = va_value;
+if (va_value != nullptr) {
+  is_null = false;
+  current_literal = *static_cast(va_value);
+}
+  }
+
+  // Aggregate on the remaining values.
+  if (!accessor->iterationFinished()) {
+while (accessor->next()) {
+  const void *va_value =
+  accessor->template 
getUntypedValue(value_accessor_id);
+  if (left_nullable && !va_value) {
+continue;
+  }
+  if (this->compareDataPtrsHelper(va_value, _literal)) {
+current_literal = *static_cast(va_value);
+  }
 }
   }
 }
   });
 
-  if (current_literal) {
-return TypedValue(*static_cast(current_literal));
+  if (!is_null) {
+return TypedValue(current_literal);
   } else {
 return TypedValue(current.getTypeID());
   }