Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9C3DE200BD7 for ; Sun, 11 Dec 2016 18:46:46 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9AAB0160B20; Sun, 11 Dec 2016 17:46:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9ED6C160B04 for ; Sun, 11 Dec 2016 18:46:44 +0100 (CET) Received: (qmail 14623 invoked by uid 500); 11 Dec 2016 17:46:43 -0000 Mailing-List: contact commits-help@quickstep.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@quickstep.incubator.apache.org Delivered-To: mailing list commits@quickstep.incubator.apache.org Received: (qmail 14614 invoked by uid 99); 11 Dec 2016 17:46:43 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Dec 2016 17:46:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 32DC61A00D0 for ; Sun, 11 Dec 2016 17:46:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id QF4U6S35TGrx for ; Sun, 11 Dec 2016 17:46:30 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 314CE5FC7E for ; Sun, 11 Dec 2016 17:46:29 +0000 (UTC) Received: (qmail 12393 invoked by uid 99); 11 Dec 2016 17:45:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Dec 2016 17:45:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8C986F12EF; Sun, 11 Dec 2016 17:45:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: spehl@apache.org To: commits@quickstep.incubator.apache.org Date: Sun, 11 Dec 2016 17:46:07 -0000 Message-Id: In-Reply-To: <3731e3d9799c476f8fcd2a0cd4619eeb@git.apache.org> References: <3731e3d9799c476f8fcd2a0cd4619eeb@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [44/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files archived-at: Sun, 11 Dec 2016 17:46:46 -0000 http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReader.cpp ---------------------------------------------------------------------- diff --git a/cli/LineReader.cpp b/cli/LineReader.cpp deleted file mode 100644 index 002727d..0000000 --- a/cli/LineReader.cpp +++ /dev/null @@ -1,243 +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 "cli/LineReader.hpp" - -#include -#include -#include - -using std::ispunct; -using std::size_t; -using std::string; - -namespace quickstep { - -std::string LineReader::getNextCommand() { - string multiline_buffer(leftover_); - - // Whether we are continuing to read a command across multiple lines of - // input. - bool continuing = false; - - // The state of our micro command-scanner. Either normal SQL (where the whole - // command terminates with a semicolon), various types of quoted strings - // (which terminate with a closing quote, putting the state back to normal), - // or SQL comments (which terminate with a newline, putting the state back to - // normal). - LineState line_state = kNormal; - - // The position we are scanning the multiline_buffer from. - size_t scan_position = 0; - // The position of a special character, which might terminate a statement or - // signify a change in the line_state. - for (;;) { - size_t special_char_location = string::npos; - switch (line_state) { - case kNormal: - // A semicolon to end the SQL command, or any character which might - // put us into a different mode. - special_char_location = multiline_buffer.find_first_of(";'\"-eE.\\", scan_position); - break; - case kSingleQuote: - // A single quote which ends the string (note that two successive - // single-quotes in a string, which the lexer will make into one - // single-quote, will still be fine here: we will go into kNormal - // and then, on the next iteration, immediately back into - // kSingleQuote). - special_char_location = multiline_buffer.find_first_of('\'', scan_position); - break; - case kSingleQuoteWithEscape: - // A single quote which ends the string, or the beginning of an escape - // sequence \' which does not end the string. - special_char_location = multiline_buffer.find_first_of("'\\", scan_position); - break; - case kDoubleQuote: - // A double quote which ends the string. As above, two successive - // double-quotes will still get handled properly. - special_char_location = multiline_buffer.find_first_of('"', scan_position); - break; - case kDoubleQuoteWithEscape: - // A single quote which ends the string, or the beginning of an escape - // sequence \" which does not end the string. - special_char_location = multiline_buffer.find_first_of("\"\\", scan_position); - break; - case kComment: - case kCommand: // Fall Through. - // A newline which ends the command and comment and resumes normal SQL parsing. - special_char_location = multiline_buffer.find_first_of('\n', scan_position); - break; - } - - if (special_char_location == string::npos) { - // No special character found in the buffer. Get some more input. - scan_position = multiline_buffer.size(); - if (!getMoreInput(&multiline_buffer, &continuing)) { - return string(""); - } - } else { - switch (line_state) { - case kNormal: - // In kNormal, we may end the SQL command or switch into one of the - // other states. - switch (multiline_buffer[special_char_location]) { - case ';': - // Command finished. Return it. - leftover_ = multiline_buffer.substr(special_char_location + 1); - // Clear 'leftover_' if it is blank to avoid counting the remaining - // lines in the previous command in computing the positions of each parser node. - if (std::all_of(leftover_.begin(), leftover_.end(), ::isspace)) { - leftover_.clear(); - } - return multiline_buffer.substr(0, special_char_location + 1); - case '\'': - // Starting a single-quote string. - line_state = kSingleQuote; - scan_position = special_char_location + 1; - break; - case '"': - // Starting a double-quote string. - line_state = kDoubleQuote; - scan_position = special_char_location + 1; - break; - case '-': - // Possibly starting a comment. We must peek ahead to the next - // character to be sure. - if (multiline_buffer.size() > special_char_location + 1) { - if (multiline_buffer[special_char_location + 1] == '-') { - line_state = kComment; - scan_position = special_char_location + 2; - } else { - // False alarm. - scan_position = special_char_location + 1; - } - } else { - // No next character is available. Get more input and try - // again. - scan_position = special_char_location; - if (!getMoreInput(&multiline_buffer, &continuing)) { - return string(""); - } - } - break; - case 'e': - case 'E': - // e' or E' begins a quoted string with escape sequences. First, - // check that the e or E either begins the string or is - // immediately preceded by whitespace or punctuation. - if ((special_char_location == 0) - || ::isspace(multiline_buffer[special_char_location - 1]) - || ::ispunct(multiline_buffer[special_char_location - 1])) { - // Peek ahead to see if the next character is a single-quote. - if (multiline_buffer.size() > special_char_location + 1) { - if (multiline_buffer[special_char_location + 1] == '\'') { - line_state = kSingleQuoteWithEscape; - scan_position = special_char_location + 2; - } else if (multiline_buffer[special_char_location + 1] == '\"') { - line_state = kDoubleQuoteWithEscape; - scan_position = special_char_location + 2; - } else { - // False alarm. Just a normal character. - scan_position = special_char_location + 1; - } - } else { - // Can't peek ahead yet. Get more input and re-scan from - // current position. - scan_position = special_char_location; - if (!getMoreInput(&multiline_buffer, &continuing)) { - return string(""); - } - } - } else { - scan_position = special_char_location + 1; - } - break; - case '.': - case '\\': // Fall Through. - // If the dot or forward slash begins the line, begin a command search. - if (scan_position == 0) { - line_state = kCommand; - } else { - // This is a regular character, so skip over it. - scan_position = special_char_location + 1; - } - break; - default: - FATAL_ERROR("Unexpected special character in LineReader::getNextCommand()"); - } - break; - case kSingleQuote: - case kDoubleQuote: - case kComment: - // Reached the terminal character for this state. Go back to normal - // SQL mode. - line_state = kNormal; - scan_position = special_char_location + 1; - break; - case kSingleQuoteWithEscape: - if (multiline_buffer[special_char_location] == '\'') { - line_state = kNormal; - scan_position = special_char_location + 1; - } else { - // Skip past an escape character. - scan_position = special_char_location + 2; - } - break; - case kDoubleQuoteWithEscape: - if (multiline_buffer[special_char_location] == '\"') { - line_state = kNormal; - scan_position = special_char_location + 1; - } else { - // Skip past an escape character. - scan_position = special_char_location + 2; - } - break; - case kCommand: - if (multiline_buffer[special_char_location] == '\n') { - // Command finished. Return it. - leftover_ = multiline_buffer.substr(special_char_location + 1); - // Clear 'leftover_' if it is blank to avoid counting the remaining - // lines in the previous command in computing the positions of each parser node. - if (std::all_of(leftover_.begin(), leftover_.end(), ::isspace)) { - leftover_.clear(); - } - return multiline_buffer.substr(0, special_char_location + 1); - } - break; - } - } - } -} - -bool LineReader::getMoreInput(std::string *input_buffer, bool *continuing) { - string nextline = getLineInternal(*continuing); - if (nextline.empty()) { - return false; - } else { - if (*continuing - || !std::all_of(nextline.begin(), nextline.end(), ::isspace)) { - // Don't show the continuing prompt if a blank line was entered. - *continuing = true; - } - input_buffer->append(nextline); - return true; - } -} - -} // namespace quickstep http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReader.hpp ---------------------------------------------------------------------- diff --git a/cli/LineReader.hpp b/cli/LineReader.hpp deleted file mode 100644 index c7c073f..0000000 --- a/cli/LineReader.hpp +++ /dev/null @@ -1,97 +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_CLI_LINE_READER_HPP_ -#define QUICKSTEP_CLI_LINE_READER_HPP_ - -#include - -#include "utility/Macros.hpp" - -namespace quickstep { - -/** \addtogroup CLI - * @{ - */ - -/** - * @brief An interface for reading user input from command lines. - **/ -class LineReader { - public: - /** - * @brief Constructor. - * - * @param default_prompt The default command prompt. - * @param continue_prompt The prompt given when a command extends over more - * than one line. - **/ - LineReader(const std::string &default_prompt, - const std::string &continue_prompt) - : default_prompt_(default_prompt), continue_prompt_(continue_prompt) { - } - - /** - * @brief Virtual destructor. - **/ - virtual ~LineReader() { - } - - /** - * @brief Obtain the next full SQL command from user input. - * - * @return The next user-inputted command. - **/ - std::string getNextCommand(); - - protected: - /** - * @brief Get the next newline-terminated line from input. - * - * @param continuing True if continuing a command from a previous line, false - * otherwise. - * @return The next line of input. - **/ - virtual std::string getLineInternal(const bool continuing) = 0; - - const std::string default_prompt_; - const std::string continue_prompt_; - std::string leftover_; - - private: - enum LineState { - kNormal, - kSingleQuote, - kSingleQuoteWithEscape, - kDoubleQuote, - kDoubleQuoteWithEscape, - kComment, - kCommand - }; - - bool getMoreInput(std::string *input_buffer, bool *continuing); - - DISALLOW_COPY_AND_ASSIGN(LineReader); -}; - -/** @} */ - -} // namespace quickstep - -#endif // QUICKSTEP_CLI_LINE_READER_HPP_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderDumb.cpp ---------------------------------------------------------------------- diff --git a/cli/LineReaderDumb.cpp b/cli/LineReaderDumb.cpp deleted file mode 100644 index 36edf73..0000000 --- a/cli/LineReaderDumb.cpp +++ /dev/null @@ -1,78 +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 "cli/LineReaderDumb.hpp" - -#include -#include -#include - -using std::feof; -using std::fflush; -using std::fgetc; -using std::fgets; -using std::printf; -using std::string; -using std::ungetc; - -namespace quickstep { - -namespace { -static constexpr std::size_t kReadBufferSize = 1024; -} // namespace - -LineReaderDumb::LineReaderDumb(const string &default_prompt, const string &continue_prompt) - : LineReader(default_prompt, continue_prompt) { -} - -std::string LineReaderDumb::getLineInternal(const bool continuing) { - if (feof(stdin)) { - printf("\n"); - return string(""); - } - - printf("%s", continuing ? continue_prompt_.c_str() : default_prompt_.c_str()); - fflush(stdout); - - string line; - char read_buffer[kReadBufferSize]; - while (fgets(read_buffer, sizeof(read_buffer), stdin) != nullptr) { - line.append(read_buffer); - if ((!line.empty()) && (line.back() == '\n')) { - return line; - } else { - if (feof(stdin)) { - break; - } - const int next_char = fgetc(stdin); - if (next_char == EOF) { - break; - } else { - ungetc(next_char, stdin); - } - } - } - - // The above while loop terminated because fgets() hit EOF before it got to - // a newline. - printf("\n"); - return string(""); -} - -} // namespace quickstep http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderDumb.hpp ---------------------------------------------------------------------- diff --git a/cli/LineReaderDumb.hpp b/cli/LineReaderDumb.hpp deleted file mode 100644 index 080268a..0000000 --- a/cli/LineReaderDumb.hpp +++ /dev/null @@ -1,54 +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_CLI_LINE_READER_DUMB_HPP_ -#define QUICKSTEP_CLI_LINE_READER_DUMB_HPP_ - -#include - -#include "cli/LineReader.hpp" -#include "utility/Macros.hpp" - -namespace quickstep { - -/** \addtogroup CLI - * @{ - */ - -/** - * @brief An implementation of LineReader that uses cstdio and doesn't support - * history or command editing. - **/ -class LineReaderDumb : public LineReader { - public: - LineReaderDumb(const std::string &default_prompt, - const std::string &continue_prompt); - - protected: - std::string getLineInternal(const bool continuing) override; - - private: - DISALLOW_COPY_AND_ASSIGN(LineReaderDumb); -}; - -/** @} */ - -} // namespace quickstep - -#endif // QUICKSTEP_CLI_LINE_READER_DUMB_HPP_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderLineNoise.cpp ---------------------------------------------------------------------- diff --git a/cli/LineReaderLineNoise.cpp b/cli/LineReaderLineNoise.cpp deleted file mode 100644 index 9c3650e..0000000 --- a/cli/LineReaderLineNoise.cpp +++ /dev/null @@ -1,60 +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 "cli/LineReaderLineNoise.hpp" - -#include -#include -#include -#include -#include - -#include "third_party/linenoise/linenoise.h" - -namespace quickstep { - -LineReaderLineNoise::LineReaderLineNoise(const std::string &default_prompt, - const std::string &continue_prompt) - : LineReader(default_prompt, continue_prompt) { -} - -std::string LineReaderLineNoise::getLineInternal(const bool continuing) { - const char *prompt; - if (continuing) { - prompt = continue_prompt_.c_str(); - } else { - prompt = default_prompt_.c_str(); - } - char *input_line; - - if ((input_line = linenoise(prompt)) != nullptr) { - std::string retval(input_line); - if (continuing - || !std::all_of(retval.begin(), retval.end(), ::isspace)) { - // Don't add a blank line that's not part of a command to history. - linenoiseHistoryAdd(input_line); - } - std::free(input_line); - return retval; - } else { - return std::string(""); - } -} - -} // namespace quickstep http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderLineNoise.hpp ---------------------------------------------------------------------- diff --git a/cli/LineReaderLineNoise.hpp b/cli/LineReaderLineNoise.hpp deleted file mode 100644 index ec256f6..0000000 --- a/cli/LineReaderLineNoise.hpp +++ /dev/null @@ -1,57 +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_CLI_LINE_READER_LINE_NOISE_HPP_ -#define QUICKSTEP_CLI_LINE_READER_LINE_NOISE_HPP_ - -#include - -#include "cli/LineReader.hpp" -#include "utility/Macros.hpp" - -namespace quickstep { - -/** \addtogroup CLI - * @{ - */ - -/** - * @brief An implementation of LineReader that uses linenoise to provide - * command-history and editing support. - **/ -class LineReaderLineNoise : public LineReader { - public: - LineReaderLineNoise(const std::string &default_prompt, - const std::string &continue_prompt); - - ~LineReaderLineNoise() override { - } - - protected: - std::string getLineInternal(const bool continuing) override; - - private: - DISALLOW_COPY_AND_ASSIGN(LineReaderLineNoise); -}; - -/** @} */ - -} // namespace quickstep - -#endif // QUICKSTEP_CLI_LINE_READER_LINE_NOISE_HPP_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/PrintToScreen.cpp ---------------------------------------------------------------------- diff --git a/cli/PrintToScreen.cpp b/cli/PrintToScreen.cpp deleted file mode 100644 index 7d06474..0000000 --- a/cli/PrintToScreen.cpp +++ /dev/null @@ -1,185 +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 "cli/PrintToScreen.hpp" - -#include -#include -#include -#include -#include - -#include "catalog/CatalogAttribute.hpp" -#include "catalog/CatalogRelation.hpp" -#include "storage/StorageBlock.hpp" -#include "storage/StorageBlockInfo.hpp" -#include "storage/StorageManager.hpp" -#include "storage/TupleIdSequence.hpp" -#include "storage/TupleStorageSubBlock.hpp" -#include "types/IntType.hpp" -#include "types/Type.hpp" -#include "types/TypedValue.hpp" -#include "utility/Macros.hpp" - -#include "gflags/gflags.h" - -using std::fprintf; -using std::fputc; -using std::size_t; -using std::vector; - -namespace quickstep { - -DEFINE_bool(printing_enabled, true, - "If true, print query results to screen normally. If false, skip " - "printing output (e.g. for benchmarking)."); - -int PrintToScreen::GetNumberOfDigits(int number) { - if (number > 0) { - return static_cast(log10 (number)) + 1; - } else if (number < 0) { - return static_cast(log10 ( abs(number) )) + 2; - } else { - return 1; - } -} - -void PrintToScreen::PrintRelation(const CatalogRelation &relation, - StorageManager *storage_manager, - FILE *out) { - if (!FLAGS_printing_enabled) { - return; - } - - vector column_widths; - column_widths.reserve(relation.size()); - - for (CatalogRelation::const_iterator attr_it = relation.begin(); - attr_it != relation.end(); - ++attr_it) { - // Printed column needs to be wide enough to print: - // 1. The attribute name (in the printed "header"). - // 2. Any value of the attribute's Type. - // 3. If the attribute's Type is nullable, the 4-character string "NULL". - // We pick the largest of these 3 widths as the column width. - int column_width = static_cast(attr_it->getDisplayName().length()); - column_width = column_width < attr_it->getType().getPrintWidth() - ? attr_it->getType().getPrintWidth() - : column_width; - column_width = attr_it->getType().isNullable() && (column_width < 4) - ? 4 - : column_width; - column_widths.push_back(column_width); - } - - printHBar(column_widths, out); - - fputc('|', out); - vector::const_iterator width_it = column_widths.begin(); - CatalogRelation::const_iterator attr_it = relation.begin(); - for (; width_it != column_widths.end(); ++width_it, ++attr_it) { - fprintf(out, - "%-*s|", - *width_it, - attr_it->getDisplayName().c_str()); - } - fputc('\n', out); - - printHBar(column_widths, out); - - std::vector blocks = relation.getBlocksSnapshot(); - for (const block_id current_block_id : blocks) { - BlockReference block = storage_manager->getBlock(current_block_id, relation); - const TupleStorageSubBlock &tuple_store = block->getTupleStorageSubBlock(); - - if (tuple_store.isPacked()) { - for (tuple_id tid = 0; tid <= tuple_store.getMaxTupleID(); ++tid) { - printTuple(tuple_store, tid, column_widths, out); - } - } else { - std::unique_ptr existence_map(tuple_store.getExistenceMap()); - for (tuple_id tid : *existence_map) { - printTuple(tuple_store, tid, column_widths, out); - } - } - } - - printHBar(column_widths, out); -} - -void PrintToScreen::printHBar(const vector &column_widths, - FILE *out) { - fputc('+', out); - for (const int width : column_widths) { - for (int i = 0; i < width; ++i) { - fputc('-', out); - } - fputc('+', out); - } - fputc('\n', out); -} - -void PrintToScreen::printTuple(const TupleStorageSubBlock &tuple_store, - const tuple_id tid, - const vector &column_widths, - FILE *out) { - DEBUG_ASSERT(tuple_store.hasTupleWithID(tid)); - fputc('|', out); - - const CatalogRelationSchema &relation = tuple_store.getRelation(); - vector::const_iterator width_it = column_widths.begin(); - CatalogRelation::const_iterator attr_it = relation.begin(); - for (; attr_it != relation.end(); ++attr_it, ++width_it) { - TypedValue value(tuple_store.getAttributeValueTyped(tid, attr_it->getID())); - if (value.isNull()) { - fprintf(out, - "%*s", - *width_it, - "NULL"); - } else { - attr_it->getType().printValueToFile(value, out, *width_it); - } - - fputc('|', out); - } - fputc('\n', out); -} - -std::size_t PrintToScreen::GetNumTuplesInRelation( - const CatalogRelation &relation, StorageManager *storage_manager) { - const std::vector &blocks = relation.getBlocksSnapshot(); - std::size_t total_num_tuples = 0; - for (block_id block : blocks) { - total_num_tuples += - storage_manager->getBlock(block, relation)->getNumTuples(); - } - return total_num_tuples; -} - -void PrintToScreen::PrintOutputSize(const CatalogRelation &relation, - StorageManager *storage_manager, - FILE *out) { - const std::size_t num_rows = GetNumTuplesInRelation(relation, storage_manager); - fprintf(out, - "(%lu %s)\n", - num_rows, - (num_rows == 1) ? "row" : "rows"); -} - -} // namespace quickstep http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/PrintToScreen.hpp ---------------------------------------------------------------------- diff --git a/cli/PrintToScreen.hpp b/cli/PrintToScreen.hpp deleted file mode 100644 index 2b5fd7e..0000000 --- a/cli/PrintToScreen.hpp +++ /dev/null @@ -1,99 +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_CLI_PRINT_TO_SCREEN_HPP_ -#define QUICKSTEP_CLI_PRINT_TO_SCREEN_HPP_ - -#include -#include - -#include "storage/StorageBlockInfo.hpp" -#include "utility/Macros.hpp" - -namespace quickstep { - -class CatalogRelation; -class StorageManager; -class TupleStorageSubBlock; - -/** \addtogroup CLI - * @{ - */ - -/** - * @brief All static methods which print all of the tuples in a relation to - * a FILE* stream. - **/ -class PrintToScreen { - public: - static void PrintRelation(const CatalogRelation &relation, - StorageManager *storage_manager, - FILE *out); - - static void printHBar(const std::vector &column_widths, - FILE *out); - - /** - * @brief Get the total number of tuples in the given relation. - * - * @param relation The given relation. - * @param storage_manager The storage manager. - * - * @return The total number of tuples in the relation. - **/ - static std::size_t GetNumTuplesInRelation(const CatalogRelation &relation, - StorageManager *storage_manager); - - /** - * @brief Print the size of the output (i.e. number of rows in the relation). - * - * @param relation The given relation. - * @param storage_manager The storage manager. - * @param out The output stream. - **/ - static void PrintOutputSize(const CatalogRelation &relation, - StorageManager *storage_manager, - FILE *out); - - /** - * @brief Return the number of digits in a number - * - * @param number The input number. - * @param out The number of digits in the input number. - **/ - static int GetNumberOfDigits(int number); - - private: - // Undefined default constructor. Class is all-static and should not be - // instantiated. - PrintToScreen(); - - static void printTuple(const TupleStorageSubBlock &tuple_store, - const tuple_id tid, - const std::vector &column_widths, - FILE *out); - - DISALLOW_COPY_AND_ASSIGN(PrintToScreen); -}; - -/** @} */ - -} // namespace quickstep - -#endif // QUICKSTEP_CLI_PRINT_TO_SCREEN_HPP_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/QuickstepCli.cpp ---------------------------------------------------------------------- diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp deleted file mode 100644 index 656786a..0000000 --- a/cli/QuickstepCli.cpp +++ /dev/null @@ -1,451 +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. - **/ - -/* A standalone command-line interface to QuickStep */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cli/CliConfig.h" // For QUICKSTEP_USE_LINENOISE, QUICKSTEP_ENABLE_GOOGLE_PROFILER. - -#include "cli/CommandExecutor.hpp" -#include "cli/DropRelation.hpp" - -#ifdef QUICKSTEP_USE_LINENOISE -#include "cli/LineReaderLineNoise.hpp" -typedef quickstep::LineReaderLineNoise LineReaderImpl; -#else -#include "cli/LineReaderDumb.hpp" -typedef quickstep::LineReaderDumb LineReaderImpl; -#endif - -#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER -#include -#endif - -#include "cli/DefaultsConfigurator.hpp" -#include "cli/Flags.hpp" -#include "cli/InputParserUtil.hpp" -#include "cli/PrintToScreen.hpp" -#include "parser/ParseStatement.hpp" -#include "parser/SqlParserWrapper.hpp" -#include "query_execution/ForemanSingleNode.hpp" -#include "query_execution/QueryExecutionTypedefs.hpp" -#include "query_execution/QueryExecutionUtil.hpp" -#include "query_execution/Worker.hpp" -#include "query_execution/WorkerDirectory.hpp" -#include "query_optimizer/QueryHandle.hpp" -#include "query_optimizer/QueryProcessor.hpp" -#include "storage/StorageConfig.h" // For QUICKSTEP_HAVE_FILE_MANAGER_HDFS. - -#ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS -#include "storage/FileManagerHdfs.hpp" -#endif - -#include "storage/PreloaderThread.hpp" -#include "storage/StorageConstants.hpp" -#include "storage/StorageManager.hpp" -#include "threading/ThreadIDBasedMap.hpp" -#include "utility/ExecutionDAGVisualizer.hpp" -#include "utility/Macros.hpp" -#include "utility/PtrVector.hpp" -#include "utility/SqlError.hpp" -#include "utility/StringUtil.hpp" - -#include "gflags/gflags.h" - -#include "glog/logging.h" - -#include "tmb/id_typedefs.h" -#include "tmb/message_bus.h" - -namespace quickstep { -class CatalogRelation; -} - -using std::fflush; -using std::fprintf; -using std::printf; -using std::string; -using std::vector; - -using quickstep::CatalogRelation; -using quickstep::DefaultsConfigurator; -using quickstep::DropRelation; -using quickstep::FLAGS_num_workers; -using quickstep::FLAGS_storage_path; -using quickstep::ForemanSingleNode; -using quickstep::InputParserUtil; -using quickstep::MessageBusImpl; -using quickstep::ParseResult; -using quickstep::ParseStatement; -using quickstep::PrintToScreen; -using quickstep::PtrVector; -using quickstep::QueryExecutionUtil; -using quickstep::QueryHandle; -using quickstep::QueryProcessor; -using quickstep::SqlParserWrapper; -using quickstep::Worker; -using quickstep::WorkerDirectory; -using quickstep::kAdmitRequestMessage; -using quickstep::kCatalogFilename; -using quickstep::kPoisonMessage; -using quickstep::kWorkloadCompletionMessage; - -using tmb::client_id; - -namespace quickstep { - -DEFINE_bool(preload_buffer_pool, false, - "If true, pre-load all known blocks into buffer pool before " - "accepting queries (should also set --buffer_pool_slots to be " - "large enough to accomodate the entire database)."); -DEFINE_string(worker_affinities, "", - "A comma-separated list of CPU IDs to pin worker threads to " - "(leaving this empty will cause all worker threads to inherit " - "the affinity mask of the Quickstep process, which typically " - "means that they will all be runable on any CPU according to " - "the kernel's own scheduling policy)."); -DEFINE_bool(initialize_db, false, "If true, initialize a database."); -DEFINE_bool(print_query, false, - "Print each input query statement. This is useful when running a " - "large number of queries in a batch."); -DEFINE_string(profile_file_name, "", - "If nonempty, enable profiling using GOOGLE CPU Profiler, and write " - "its output to the given file name. This flag has no effect if " - "ENABLE_GOOGLE_PROFILER CMake flag was not set during build. " - "The profiler only starts collecting samples after the first query, " - "so that it runs against a warm buffer pool and caches. If you want to profile " - "everything, including the first query run, set the " - "environment variable CPUPROFILE instead of passing this flag."); - // Here's a detailed explanation of why we skip the first query run - // during profiling: - // Unless you’ve preloaded the buffer pool (which is not always a good - // idea), the first run of the query results in disk I/O and other overhead - // that significantly skews the profiling results. It’s the same reason we don’t - // include the first run time in our benchmarking: when profiling query - // execution, it makes more sense to get numbers using a warm buffer pool and - // warm caches. This is not *always* the right thing to do: it’s obviously - // wrong for profiling the TextScan operator. In those cases, you might want - // to put in your own Profiler probes (just follow the start/stop pattern used - // in this file) or just run quickstep with the CPUPROFILE environment variable - // set (as per gperftools documentation) to get the full profile for the - // entire execution. - // To put things in perspective, the first run is, in my experiments, about 5-10 - // times more expensive than the average run. That means the query needs to be - // run at least a hundred times to make the impact of the first run small (< 5 %). - -DECLARE_bool(profile_and_report_workorder_perf); -DECLARE_bool(visualize_execution_dag); - -} // namespace quickstep - -int main(int argc, char* argv[]) { - google::InitGoogleLogging(argv[0]); - gflags::ParseCommandLineFlags(&argc, &argv, true); - - printf("Starting Quickstep with %d worker thread(s) and a %.2f GB buffer pool.\n", - FLAGS_num_workers, - (static_cast(quickstep::FLAGS_buffer_pool_slots) * quickstep::kSlotSizeBytes)/quickstep::kAGigaByte); - -#ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS - if (quickstep::FLAGS_use_hdfs) { - LOG(INFO) << "Using HDFS as the default persistent storage, with namenode at " - << quickstep::FLAGS_hdfs_namenode_host << ":" - << quickstep::FLAGS_hdfs_namenode_port << " and block replication factor " - << quickstep::FLAGS_hdfs_num_replications << "\n"; - } -#endif - - // Initialize the thread ID based map here before the Foreman and workers are - // constructed because the initialization isn't thread safe. - quickstep::ClientIDMap::Instance(); - - MessageBusImpl bus; - bus.Initialize(); - - // The TMB client id for the main thread, used to kill workers at the end. - const client_id main_thread_client_id = bus.Connect(); - bus.RegisterClientAsSender(main_thread_client_id, kAdmitRequestMessage); - bus.RegisterClientAsSender(main_thread_client_id, kPoisonMessage); - bus.RegisterClientAsReceiver(main_thread_client_id, kWorkloadCompletionMessage); - - quickstep::StorageManager storage_manager(FLAGS_storage_path); - - string catalog_path(FLAGS_storage_path); - catalog_path.append(kCatalogFilename); - if (quickstep::FLAGS_initialize_db) { // Initialize the database - DefaultsConfigurator::InitializeDefaultDatabase(FLAGS_storage_path, catalog_path); - } - - // Setup QueryProcessor, including CatalogDatabase. - std::unique_ptr query_processor; - try { - query_processor = std::make_unique(std::move(catalog_path)); - } catch (const std::exception &e) { - LOG(FATAL) << "FATAL ERROR DURING STARTUP: " - << e.what() - << "\nIf you intended to create a new database, " - << "please use the \"-initialize_db=true\" command line option."; - } catch (...) { - LOG(FATAL) << "NON-STANDARD EXCEPTION DURING STARTUP"; - } - - // Parse the CPU affinities for workers and the preloader thread, if enabled - // to warm up the buffer pool. - const vector worker_cpu_affinities = - InputParserUtil::ParseWorkerAffinities(FLAGS_num_workers, - quickstep::FLAGS_worker_affinities); - - const std::size_t num_numa_nodes_system = DefaultsConfigurator::GetNumNUMANodes(); - - if (quickstep::FLAGS_preload_buffer_pool) { - std::chrono::time_point preload_start, preload_end; - preload_start = std::chrono::steady_clock::now(); - printf("Preloading the buffer pool ... "); - fflush(stdout); - quickstep::PreloaderThread preloader(*query_processor->getDefaultDatabase(), - &storage_manager, - worker_cpu_affinities.front()); - - preloader.start(); - preloader.join(); - preload_end = std::chrono::steady_clock::now(); - printf("in %g seconds\n", - std::chrono::duration(preload_end - preload_start).count()); - } - - // Get the NUMA affinities for workers. - vector cpu_numa_nodes = InputParserUtil::GetNUMANodesForCPUs(); - if (cpu_numa_nodes.empty()) { - // libnuma is not present. Assign -1 as the NUMA node for every worker. - cpu_numa_nodes.assign(worker_cpu_affinities.size(), -1); - } - - vector worker_numa_nodes; - PtrVector workers; - vector worker_client_ids; - - // Initialize the worker threads. - DCHECK_EQ(static_cast(FLAGS_num_workers), - worker_cpu_affinities.size()); - for (std::size_t worker_thread_index = 0; - worker_thread_index < worker_cpu_affinities.size(); - ++worker_thread_index) { - int numa_node_id = -1; - if (worker_cpu_affinities[worker_thread_index] >= 0) { - // This worker can be NUMA affinitized. - numa_node_id = cpu_numa_nodes[worker_cpu_affinities[worker_thread_index]]; - } - worker_numa_nodes.push_back(numa_node_id); - - workers.push_back( - new Worker(worker_thread_index, &bus, worker_cpu_affinities[worker_thread_index])); - worker_client_ids.push_back(workers.back().getBusClientID()); - } - - // TODO(zuyu): Move WorkerDirectory within Shiftboss once the latter is added. - WorkerDirectory worker_directory(worker_cpu_affinities.size(), - worker_client_ids, - worker_numa_nodes); - - ForemanSingleNode foreman( - main_thread_client_id, - &worker_directory, - &bus, - query_processor->getDefaultDatabase(), - &storage_manager, - -1, // Don't pin the Foreman thread. - num_numa_nodes_system); - - // Start the worker threads. - for (Worker &worker : workers) { - worker.start(); - } - - foreman.start(); - - LineReaderImpl line_reader("quickstep> ", - " ...> "); - std::unique_ptr parser_wrapper(new SqlParserWrapper()); - std::chrono::time_point start, end; - -#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER - bool started_profiling = false; -#endif - for (;;) { - string *command_string = new string(); - *command_string = line_reader.getNextCommand(); - if (command_string->size() == 0) { - delete command_string; - break; - } - - if (quickstep::FLAGS_print_query) { - printf("\n%s\n", command_string->c_str()); - } - - parser_wrapper->feedNextBuffer(command_string); - - bool quitting = false; - // A parse error should reset the parser. This is because the thrown quickstep - // SqlError does not do the proper reset work of the YYABORT macro. - bool reset_parser = false; - for (;;) { - ParseResult result = parser_wrapper->getNextStatement(); - const ParseStatement &statement = *result.parsed_statement; - if (result.condition == ParseResult::kSuccess) { - if (statement.getStatementType() == ParseStatement::kQuit) { - quitting = true; - break; - } - - if (statement.getStatementType() == ParseStatement::kCommand) { - try { - quickstep::cli::executeCommand( - statement, - *(query_processor->getDefaultDatabase()), - main_thread_client_id, - foreman.getBusClientID(), - &bus, - &storage_manager, - query_processor.get(), - stdout); - } catch (const quickstep::SqlError &sql_error) { - fprintf(stderr, "%s", - sql_error.formatMessage(*command_string).c_str()); - reset_parser = true; - break; - } - continue; - } - - std::unique_ptr query_handle( - std::make_unique(query_processor->query_id(), - main_thread_client_id, - statement.getPriority())); - try { - query_processor->generateQueryHandle(statement, query_handle.get()); - } catch (const quickstep::SqlError &sql_error) { - fprintf(stderr, "%s", sql_error.formatMessage(*command_string).c_str()); - reset_parser = true; - break; - } - - DCHECK(query_handle->getQueryPlanMutable() != nullptr); - std::unique_ptr dag_visualizer; - if (quickstep::FLAGS_visualize_execution_dag) { - dag_visualizer.reset( - new quickstep::ExecutionDAGVisualizer(*query_handle->getQueryPlanMutable())); - } - - start = std::chrono::steady_clock::now(); - QueryExecutionUtil::ConstructAndSendAdmitRequestMessage( - main_thread_client_id, - foreman.getBusClientID(), - query_handle.get(), - &bus); - - try { - QueryExecutionUtil::ReceiveQueryCompletionMessage( - main_thread_client_id, &bus); - end = std::chrono::steady_clock::now(); - - const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation(); - if (query_result_relation) { - PrintToScreen::PrintRelation(*query_result_relation, - &storage_manager, - stdout); - PrintToScreen::PrintOutputSize( - *query_result_relation, - &storage_manager, - stdout); - - DropRelation::Drop(*query_result_relation, - query_processor->getDefaultDatabase(), - &storage_manager); - } - - query_processor->saveCatalog(); - std::chrono::duration time_ms = end - start; - printf("Time: %s ms\n", - quickstep::DoubleToStringWithSignificantDigits( - time_ms.count(), 3).c_str()); - if (quickstep::FLAGS_profile_and_report_workorder_perf) { - // TODO(harshad) - Allow user specified file instead of stdout. - foreman.printWorkOrderProfilingResults(query_handle->query_id(), - stdout); - } - if (quickstep::FLAGS_visualize_execution_dag) { - const auto &profiling_stats = - foreman.getWorkOrderProfilingResults(query_handle->query_id()); - dag_visualizer->bindProfilingStats(profiling_stats); - std::cerr << "\n" << dag_visualizer->toDOT() << "\n"; - } - } catch (const std::exception &e) { - fprintf(stderr, "QUERY EXECUTION ERROR: %s\n", e.what()); - break; - } - } else { - if (result.condition == ParseResult::kError) { - fprintf(stderr, "%s", result.error_message.c_str()); - } - reset_parser = true; - break; - } -#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER - // Profile only if profile_file_name flag is set - if (!started_profiling && !quickstep::FLAGS_profile_file_name.empty()) { - started_profiling = true; - ProfilerStart(quickstep::FLAGS_profile_file_name.c_str()); - } -#endif - } - - if (quitting) { - break; - } else if (reset_parser) { - parser_wrapper.reset(new SqlParserWrapper()); - reset_parser = false; - } - } - -#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER - if (started_profiling) { - ProfilerStop(); - ProfilerFlush(); - } -#endif - - // Kill the foreman and workers. - QueryExecutionUtil::BroadcastPoisonMessage(main_thread_client_id, &bus); - - for (Worker &worker : workers) { - worker.join(); - } - - foreman.join(); - return 0; -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/cli/tests/CMakeLists.txt b/cli/tests/CMakeLists.txt deleted file mode 100644 index 99fa3a3..0000000 --- a/cli/tests/CMakeLists.txt +++ /dev/null @@ -1,52 +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. - -add_subdirectory(command_executor) - -add_executable(quickstep_cli_tests_CommandExecutorTest - CommandExecutorTest.cpp - CommandExecutorTestRunner.cpp - CommandExecutorTestRunner.hpp - "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp" - "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp") - -target_link_libraries(quickstep_cli_tests_CommandExecutorTest - glog - gtest - gtest_main - quickstep_catalog_CatalogDatabase - quickstep_cli_CommandExecutor - quickstep_cli_DropRelation - quickstep_cli_PrintToScreen - quickstep_parser_ParseStatement - quickstep_parser_SqlParserWrapper - quickstep_queryexecution_AdmitRequestMessage - quickstep_queryexecution_ForemanSingleNode - quickstep_queryexecution_QueryExecutionTypedefs - quickstep_queryexecution_QueryExecutionUtil - quickstep_queryexecution_Worker - quickstep_queryexecution_WorkerDirectory - quickstep_queryoptimizer_Optimizer - quickstep_queryoptimizer_OptimizerContext - quickstep_queryoptimizer_QueryHandle - quickstep_queryoptimizer_tests_TestDatabaseLoader - quickstep_utility_Macros - quickstep_utility_MemStream - quickstep_utility_SqlError - quickstep_utility_TextBasedTestDriver - tmb - ${LIBS}) http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTest.cpp ---------------------------------------------------------------------- diff --git a/cli/tests/CommandExecutorTest.cpp b/cli/tests/CommandExecutorTest.cpp deleted file mode 100644 index 6ad2183..0000000 --- a/cli/tests/CommandExecutorTest.cpp +++ /dev/null @@ -1,58 +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 -#include -#include - -#include "cli/tests/CommandExecutorTestRunner.hpp" -#include "utility/textbased_test/TextBasedTestDriver.hpp" - -#include "glog/logging.h" - -using quickstep::TextBasedTest; - -QUICKSTEP_GENERATE_TEXT_TEST(COMMAND_EXECUTOR_TEST); - -int main(int argc, char** argv) { - google::InitGoogleLogging(argv[0]); - - if (argc < 4) { - LOG(ERROR) << "Must have at least 3 arguments, but " << argc - 1 - << " are provided"; - } - - std::ifstream input_file(argv[1]); - CHECK(input_file.is_open()) << argv[1]; - std::unique_ptr - test_runner( - new quickstep::CommandExecutorTestRunner(argv[3])); - test_driver.reset( - new quickstep::TextBasedTestDriver(&input_file, test_runner.get())); - test_driver->registerOption( - quickstep::CommandExecutorTestRunner::kResetOption); - - ::testing::InitGoogleTest(&argc, argv); - const int success = RUN_ALL_TESTS(); - if (success != 0) { - test_driver->writeActualOutputToFile(argv[2]); - } - - return success; -} http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTestRunner.cpp ---------------------------------------------------------------------- diff --git a/cli/tests/CommandExecutorTestRunner.cpp b/cli/tests/CommandExecutorTestRunner.cpp deleted file mode 100644 index 41cc9da..0000000 --- a/cli/tests/CommandExecutorTestRunner.cpp +++ /dev/null @@ -1,134 +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 "cli/tests/CommandExecutorTestRunner.hpp" - -#include -#include -#include -#include - -#include "cli/CommandExecutor.hpp" -#include "cli/DropRelation.hpp" -#include "cli/PrintToScreen.hpp" -#include "parser/ParseStatement.hpp" -#include "query_execution/AdmitRequestMessage.hpp" -#include "query_execution/ForemanSingleNode.hpp" -#include "query_execution/QueryExecutionTypedefs.hpp" -#include "query_optimizer/Optimizer.hpp" -#include "query_optimizer/OptimizerContext.hpp" -#include "query_optimizer/QueryHandle.hpp" -#include "utility/MemStream.hpp" -#include "utility/SqlError.hpp" - -#include "glog/logging.h" - -#include "tmb/tagged_message.h" - -namespace quickstep { - -class CatalogRelation; - -namespace O = ::quickstep::optimizer; - -const char CommandExecutorTestRunner::kResetOption[] = - "reset_before_execution"; - -void CommandExecutorTestRunner::runTestCase( - const std::string &input, const std::set &options, - std::string *output) { - // TODO(qzeng): Test multi-threaded query execution when we have a Sort operator. - - VLOG(4) << "Test SQL(s): " << input; - - if (options.find(kResetOption) != options.end()) { - test_database_loader_.clear(); - test_database_loader_.createTestRelation(false /* allow_vchar */); - test_database_loader_.loadTestRelation(); - } - - MemStream output_stream; - sql_parser_.feedNextBuffer(new std::string(input)); - - while (true) { - ParseResult result = sql_parser_.getNextStatement(); - if (result.condition != ParseResult::kSuccess) { - if (result.condition == ParseResult::kError) { - *output = result.error_message; - } - break; - } else { - const ParseStatement &parse_statement = *result.parsed_statement; - std::printf("%s\n", parse_statement.toString().c_str()); - try { - if (parse_statement.getStatementType() == ParseStatement::kCommand) { - quickstep::cli::executeCommand( - *result.parsed_statement, - *(test_database_loader_.catalog_database()), - main_thread_client_id_, - foreman_->getBusClientID(), - &bus_, - test_database_loader_.storage_manager(), - nullptr, - output_stream.file()); - } else { - QueryHandle query_handle(0 /* query_id */, main_thread_client_id_); - O::OptimizerContext optimizer_context; - - optimizer_.generateQueryHandle(parse_statement, - test_database_loader_.catalog_database(), - &optimizer_context, - &query_handle); - - AdmitRequestMessage request_message(&query_handle); - TaggedMessage admit_tagged_message( - &request_message, sizeof(request_message), kAdmitRequestMessage); - QueryExecutionUtil::SendTMBMessage(&bus_, - main_thread_client_id_, - foreman_->getBusClientID(), - std::move(admit_tagged_message)); - - // Receive workload completion message from Foreman. - const AnnotatedMessage annotated_msg = - bus_.Receive(main_thread_client_id_, 0, true); - const TaggedMessage &tagged_message = annotated_msg.tagged_message; - DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type()); - const CatalogRelation *query_result_relation = query_handle.getQueryResultRelation(); - if (query_result_relation) { - PrintToScreen::PrintRelation(*query_result_relation, - test_database_loader_.storage_manager(), - output_stream.file()); - DropRelation::Drop(*query_result_relation, - test_database_loader_.catalog_database(), - test_database_loader_.storage_manager()); - } - } - } catch (const SqlError &error) { - *output = error.formatMessage(input); - break; - } - } - } - - if (output->empty()) { - *output = output_stream.str(); - } -} - -} // namespace quickstep http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTestRunner.hpp ---------------------------------------------------------------------- diff --git a/cli/tests/CommandExecutorTestRunner.hpp b/cli/tests/CommandExecutorTestRunner.hpp deleted file mode 100644 index 83c5a9a..0000000 --- a/cli/tests/CommandExecutorTestRunner.hpp +++ /dev/null @@ -1,122 +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_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_ -#define QUICKSTEP_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_ - -#include -#include -#include -#include -#include - -#include "parser/SqlParserWrapper.hpp" -#include "query_execution/ForemanSingleNode.hpp" -#include "query_execution/QueryExecutionTypedefs.hpp" -#include "query_execution/QueryExecutionUtil.hpp" -#include "query_execution/Worker.hpp" -#include "query_execution/WorkerDirectory.hpp" -#include "query_execution/WorkerMessage.hpp" -#include "query_optimizer/Optimizer.hpp" -#include "query_optimizer/tests/TestDatabaseLoader.hpp" -#include "utility/Macros.hpp" -#include "utility/textbased_test/TextBasedTestDriver.hpp" - -#include "tmb/id_typedefs.h" -#include "tmb/message_bus.h" - -namespace quickstep { - -/** - * @brief TextBasedTestRunner for testing the ExecutionGenerator. - */ -class CommandExecutorTestRunner : public TextBasedTestRunner { - public: - /** - * @brief If this option is enabled, recreate the entire database and - * repopulate the data before every test. - */ - static const char kResetOption[]; - - /** - * @brief Constructor. - */ - explicit CommandExecutorTestRunner(const std::string &storage_path) - : test_database_loader_(storage_path) { - test_database_loader_.createTestRelation(false /* allow_vchar */); - test_database_loader_.loadTestRelation(); - - bus_.Initialize(); - - main_thread_client_id_ = bus_.Connect(); - bus_.RegisterClientAsSender(main_thread_client_id_, kAdmitRequestMessage); - bus_.RegisterClientAsSender(main_thread_client_id_, kPoisonMessage); - bus_.RegisterClientAsReceiver(main_thread_client_id_, kWorkloadCompletionMessage); - - worker_.reset(new Worker(0, &bus_)); - - std::vector worker_client_ids; - worker_client_ids.push_back(worker_->getBusClientID()); - - // We don't use the NUMA aware version of foreman code. - std::vector numa_nodes; - numa_nodes.push_back(-1); - - workers_.reset(new WorkerDirectory(1 /* number of workers */, - worker_client_ids, numa_nodes)); - foreman_.reset( - new ForemanSingleNode(main_thread_client_id_, - workers_.get(), - &bus_, - test_database_loader_.catalog_database(), - test_database_loader_.storage_manager())); - - foreman_->start(); - worker_->start(); - } - - ~CommandExecutorTestRunner() { - QueryExecutionUtil::BroadcastPoisonMessage(main_thread_client_id_, &bus_); - worker_->join(); - foreman_->join(); - } - - void runTestCase(const std::string &input, - const std::set &options, - std::string *output) override; - - private: - SqlParserWrapper sql_parser_; - optimizer::TestDatabaseLoader test_database_loader_; - optimizer::Optimizer optimizer_; - - tmb::client_id main_thread_client_id_; - - MessageBusImpl bus_; - std::unique_ptr foreman_; - std::unique_ptr worker_; - - std::unique_ptr workers_; - - DISALLOW_COPY_AND_ASSIGN(CommandExecutorTestRunner); -}; - -} // namespace quickstep - -#endif // QUICKSTEP_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/cli/tests/command_executor/CMakeLists.txt b/cli/tests/command_executor/CMakeLists.txt deleted file mode 100644 index 0bdf865..0000000 --- a/cli/tests/command_executor/CMakeLists.txt +++ /dev/null @@ -1,33 +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. - -add_test(quickstep_cli_tests_commandexecutor_d - "../quickstep_cli_tests_CommandExecutorTest" - "${CMAKE_CURRENT_SOURCE_DIR}/D.test" - "${CMAKE_CURRENT_BINARY_DIR}/Dt.test" - "${CMAKE_CURRENT_BINARY_DIR}/D/") -add_test(quickstep_cli_tests_commandexecutor_dt - "../quickstep_cli_tests_CommandExecutorTest" - "${CMAKE_CURRENT_SOURCE_DIR}/Dt.test" - "${CMAKE_CURRENT_BINARY_DIR}/Dt.test" - "${CMAKE_CURRENT_BINARY_DIR}/Dt/") - -# Create the folders where the unit tests will store their data blocks for the -# duration of their test. -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D) -file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Dt) - http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/D.test ---------------------------------------------------------------------- diff --git a/cli/tests/command_executor/D.test b/cli/tests/command_executor/D.test deleted file mode 100644 index 1b35b58..0000000 --- a/cli/tests/command_executor/D.test +++ /dev/null @@ -1,122 +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. - -CREATE TABLE foo (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -CREATE TABLE foo2 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - averyverylongcolumnnamefortest CHAR(5)); -CREATE TABLE foo3 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -CREATE INDEX foo3_index_1 ON foo3 (col1) USING CSBTREE; -CREATE TABLE foo4 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -CREATE INDEX foo4_index_1 ON foo4 (col1, col2) USING CSBTREE; -CREATE INDEX foo4_index_2 ON foo4 (col3, col4) USING CSBTREE; -CREATE TABLE averylongtablenamethatseemstoneverend (col1 INT); -DROP TABLE TEST; -INSERT INTO averylongtablenamethatseemstoneverend VALUES (1); -INSERT INTO averylongtablenamethatseemstoneverend VALUES (2); -INSERT INTO averylongtablenamethatseemstoneverend VALUES (3); -INSERT INTO foo values(1, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(2, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(3, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(4, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ'); --- -== -\d foo --- - Table "foo" - Column | Type -+-------+--------+ - col1 | Int - col2 | Long - col3 | Double - col4 | Float - col5 | Char(5) -== -\d foo2 --- - Table "foo2" - Column | Type -+-------------------------------+--------+ - col1 | Int - col2 | Long - col3 | Double - col4 | Float - averyverylongcolumnnamefortest | Char(5) -== -\d foo3 --- - Table "foo3" - Column | Type -+-------+--------+ - col1 | Int - col2 | Long - col3 | Double - col4 | Float - col5 | Char(5) - Indexes - "foo3_index_1" CSB_TREE (col1) -== -\d foo4 --- - Table "foo4" - Column | Type -+-------+--------+ - col1 | Int - col2 | Long - col3 | Double - col4 | Float - col5 | Char(5) - Indexes - "foo4_index_2" CSB_TREE (col3, col4) - "foo4_index_1" CSB_TREE (col1, col2) -== -\d --- - List of relations - - Name | Type | Blocks -+--------------------------------------+-------+---------+ - foo | table | 1 - foo2 | table | 1 - foo3 | table | 1 - foo4 | table | 0 - averylongtablenamethatseemstoneverend | table | 1 - -== -\d invalidtable --- -ERROR: Unrecognized relation invalidtable (1 : 4) -\d invalidtable - ^ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/Dt.test ---------------------------------------------------------------------- diff --git a/cli/tests/command_executor/Dt.test b/cli/tests/command_executor/Dt.test deleted file mode 100644 index 8d81029..0000000 --- a/cli/tests/command_executor/Dt.test +++ /dev/null @@ -1,79 +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. - -CREATE TABLE foo (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -CREATE TABLE foo2 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - averyverylongcolumnnamefortest CHAR(5)); -CREATE TABLE foo3 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -CREATE TABLE foo4 (col1 INT, - col2 LONG, - col3 DOUBLE, - col4 FLOAT, - col5 CHAR(5)); -DROP TABLE TEST; -CREATE TABLE averylongtablenamethatseemstoneverend (col1 INT); -INSERT INTO averylongtablenamethatseemstoneverend VALUES (1); -INSERT INTO averylongtablenamethatseemstoneverend VALUES (2); -INSERT INTO averylongtablenamethatseemstoneverend VALUES (3); -INSERT INTO foo values(1, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(2, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(3, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(4, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ'); -INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ'); --- -== -\dt --- - List of relations - - Name | Type | Blocks -+--------------------------------------+-------+---------+ - foo | table | 1 - foo2 | table | 1 - foo3 | table | 1 - foo4 | table | 0 - averylongtablenamethatseemstoneverend | table | 1 - -== -\dt foo --- - List of relations - - Name | Type | Blocks -+-------+-------+---------+ - foo | table | 1 - -== -\dt invalidtable --- -ERROR: Unrecognized relation invalidtable (1 : 5) -\dt invalidtable - ^ http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindGSasl.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindGSasl.cmake b/cmake/FindGSasl.cmake deleted file mode 100644 index 28fb5b8..0000000 --- a/cmake/FindGSasl.cmake +++ /dev/null @@ -1,42 +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. - -# - Try to find the GNU sasl library (gsasl) -# -# Once done this will define -# -# GSASL_FOUND - System has gnutls -# GSASL_INCLUDE_DIR - The gnutls include directory -# GSASL_LIBRARY - The libraries needed to use gnutls - - -IF (GSASL_INCLUDE_DIR AND GSASL_LIBRARY) - # in cache already - SET(GSASL_FIND_QUIETLY TRUE) -ENDIF (GSASL_INCLUDE_DIR AND GSASL_LIBRARY) - -FIND_PATH(GSASL_INCLUDE_DIR gsasl.h) - -FIND_LIBRARY(GSASL_LIBRARY gsasl) - -INCLUDE(FindPackageHandleStandardArgs) - -# handle the QUIETLY and REQUIRED arguments and set GSASL_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSASL DEFAULT_MSG GSASL_LIBRARY GSASL_INCLUDE_DIR) - -MARK_AS_ADVANCED(GSASL_INCLUDE_DIR GSASL_LIBRARY) http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindKerberos.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindKerberos.cmake b/cmake/FindKerberos.cmake deleted file mode 100644 index 11835fb..0000000 --- a/cmake/FindKerberos.cmake +++ /dev/null @@ -1,40 +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. - -# - Find kerberos -# Find the native KERBEROS includes and library -# -# KERBEROS_INCLUDE_DIR - where to find krb5.h, etc. -# KERBEROS_LIBRARY - List of libraries when using krb5. -# KERBEROS_FOUND - True if krb5 found. - -IF (KERBEROS_INCLUDE_DIR) - # Already in cache, be silent - SET(KERBEROS_FIND_QUIETLY TRUE) -ENDIF (KERBEROS_INCLUDE_DIR) - -FIND_PATH(KERBEROS_INCLUDE_DIR krb5.h) - -SET(KERBEROS_NAMES krb5 k5crypto com_err) -FIND_LIBRARY(KERBEROS_LIBRARY NAMES ${KERBEROS_NAMES}) - -# handle the QUIETLY and REQUIRED arguments and set KERBEROS_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(KERBEROS DEFAULT_MSG KERBEROS_LIBRARY KERBEROS_INCLUDE_DIR) - -MARK_AS_ADVANCED(KERBEROS_LIBRARY KERBEROS_INCLUDE_DIR) http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindLibNuma.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindLibNuma.cmake b/cmake/FindLibNuma.cmake deleted file mode 100644 index 47a65f4..0000000 --- a/cmake/FindLibNuma.cmake +++ /dev/null @@ -1,28 +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. - -# Module to find LibNuma -find_path(LIBNUMA_INCLUDE_DIR NAMES numa.h numaif.h) -find_library(LIBNUMA_LIBRARY NAMES numa) - -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args(LibNuma DEFAULT_MSG - LIBNUMA_LIBRARY - LIBNUMA_INCLUDE_DIR) - -mark_as_advanced(LIBNUMA_INCLUDE_DIR LIBNUMA_LIBRARY) - http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindLibhdfs3.cmake ---------------------------------------------------------------------- diff --git a/cmake/FindLibhdfs3.cmake b/cmake/FindLibhdfs3.cmake deleted file mode 100644 index 7bd7c7c..0000000 --- a/cmake/FindLibhdfs3.cmake +++ /dev/null @@ -1,39 +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. - -# Module to find the Pivotal libhdfs3. - -find_path(LIBHDFS3_INCLUDE_DIR hdfs/hdfs.h) - -find_library(LIBHDFS3_LIBRARY NAMES hdfs3 libhdfs3) - -# Linking against libhdfs3 also requires linking against gsasl and kerberos. -find_package(GSasl REQUIRED) -find_package(Kerberos REQUIRED) - -set(LIBHDFS3_LIBRARIES ${LIBHDFS3_LIBRARY} - ${GSASL_LIBRARY} - ${KERBEROS_LIBRARY}) -set(LIBHDFS3_INCLUDE_DIRS ${LIBHDFS3_INCLUDE_DIR} - ${GSASL_INCLUDE_DIR} - ${KERBEROS_INCLUDE_DIR}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Libhdfs3 DEFAULT_MSG - LIBHDFS3_LIBRARY LIBHDFS3_INCLUDE_DIR) - -mark_as_advanced(LIBHDFS3_INCLUDE_DIR LIBHDFS3_LIBRARY) http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/compression/CMakeLists.txt b/compression/CMakeLists.txt deleted file mode 100644 index ede899c..0000000 --- a/compression/CMakeLists.txt +++ /dev/null @@ -1,78 +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. - -# Declare micro-libs: -add_library(quickstep_compression_CompressionDictionary - CompressionDictionary.cpp - CompressionDictionary.hpp) -add_library(quickstep_compression_CompressionDictionaryBuilder - CompressionDictionaryBuilder.cpp - CompressionDictionaryBuilder.hpp) -add_library(quickstep_compression_CompressionDictionaryLite - CompressionDictionaryLite.cpp - CompressionDictionaryLite.hpp) - -# Link dependencies: -target_link_libraries(quickstep_compression_CompressionDictionary - glog - quickstep_compression_CompressionDictionaryLite - quickstep_types_Type - quickstep_types_TypedValue - quickstep_types_operations_comparisons_ComparisonID - quickstep_types_operations_comparisons_ComparisonUtil - quickstep_types_operations_comparisons_EqualComparison - quickstep_utility_Macros) -target_link_libraries(quickstep_compression_CompressionDictionaryBuilder - glog - quickstep_types_Type - quickstep_types_TypedValue - quickstep_types_operations_comparisons_ComparisonUtil - quickstep_utility_Macros) -target_link_libraries(quickstep_compression_CompressionDictionaryLite - glog - quickstep_types_Type - quickstep_types_TypedValue - quickstep_utility_Macros) - -# Module all-in-one library: -add_library(quickstep_compression ../empty_src.cpp CompressionModule.hpp) -target_link_libraries(quickstep_compression - quickstep_compression_CompressionDictionary - quickstep_compression_CompressionDictionaryBuilder - quickstep_compression_CompressionDictionaryLite) - -# Tests: -add_executable(CompressionDictionary_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/CompressionDictionary_unittest.cpp") -target_link_libraries(CompressionDictionary_unittest - gtest - gtest_main - quickstep_compression_CompressionDictionary - quickstep_compression_CompressionDictionaryBuilder - quickstep_types_CharType - quickstep_types_DoubleType - quickstep_types_IntType - quickstep_types_Type - quickstep_types_TypeFactory - quickstep_types_TypeID - quickstep_types_TypedValue - quickstep_types_VarCharType - quickstep_types_operations_comparisons_Comparison - quickstep_types_operations_comparisons_ComparisonFactory - quickstep_types_operations_comparisons_ComparisonID - quickstep_utility_ScopedBuffer - ${LIBS}) -add_test(CompressionDictionary_unittest CompressionDictionary_unittest)