Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
majetideepak committed Nov 15, 2023
1 parent 35de81e commit 6c348dd
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion velox/type/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if(${VELOX_BUILD_TESTING})
add_subdirectory(tests)
endif()

add_subdirectory(parser)
add_subdirectory(tz)
add_subdirectory(type_parser)
add_subdirectory(fbhive)

add_library(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class Scanner : public yyFlexLexer {
}

// Store input to print it as part of the error message.
std::string input() {
std::string_view input() {
return input_;
}

private:
TypePtr& outputType_;
std::string input_;
const std::string_view input_;
};

} // namespace facebook::velox::type
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,20 @@
#include "velox/type/Type.h"

namespace facebook::velox {

/// Parses a type string in Presto format to Velox type.
/// Example type strings:
/// row(col0 bigint, varchar)
/// array(bigint)
/// map(bigint, array(bigint))
/// function(bigint,bigint,bigint)
/// The parsing is case-insensitive. i.e. 'Row' and 'row' are equal.
/// Field names for rows are optional.
/// Quoted field names are supported.
/// All types except for Presto types need to be registered. An error is thrown
/// otherwise.
/// Uses the Type::hasType and Type::getType APIs to convert a string to Velox
/// type.

TypePtr parseType(const std::string& typeText);
}
} // namespace facebook::velox
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#include <vector>
#include <memory>

#include "velox/type/type_parser/TypeParser.yy.h" // @manual
#include "velox/type/type_parser/Scanner.h"
#include "velox/type/parser/TypeParser.yy.h" // @manual
#include "velox/type/parser/Scanner.h"
#define YY_DECL int facebook::velox::type::Scanner::lex(facebook::velox::type::Parser::semantic_type *yylval)
%}

%option c++ noyywrap noyylineno nodefault caseless
%option c++ noyywrap noyylineno nodefault

A [A|a]
B [B|b]
Expand Down Expand Up @@ -64,7 +64,7 @@ int yyFlexLexer::yylex() {
throw std::runtime_error("Bad call to yyFlexLexer::yylex()");
}

#include "velox/type/type_parser/TypeParser.h"
#include "velox/type/parser/TypeParser.h"

facebook::velox::TypePtr facebook::velox::parseType(const std::string& typeText)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

%code
{
#include <velox/type/type_parser/Scanner.h>
#include <velox/type/parser/Scanner.h>
#define yylex(x) scanner->lex(x)
using namespace facebook::velox;
TypePtr typeFromString(const std::string& type) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "velox/functions/prestosql/types/HyperLogLogType.h"
#include "velox/functions/prestosql/types/JsonType.h"
#include "velox/functions/prestosql/types/TimestampWithTimeZoneType.h"
#include "velox/type/type_parser/TypeParser.h"
#include "velox/type/parser/TypeParser.h"

namespace facebook::velox {
namespace {
Expand Down

0 comments on commit 6c348dd

Please sign in to comment.