Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
rfdavid committed Sep 17, 2023
1 parent 31d1229 commit bd668b2
Show file tree
Hide file tree
Showing 12 changed files with 2,751 additions and 4,223 deletions.
1 change: 0 additions & 1 deletion dataset/copy-test/list-of-struct/copy.cypher

This file was deleted.

1 change: 0 additions & 1 deletion dataset/copy-test/list-of-struct/schema.cypher

This file was deleted.

4 changes: 0 additions & 4 deletions dataset/copy-test/list-of-struct/test.csv

This file was deleted.

2 changes: 1 addition & 1 deletion src/antlr4/Cypher.g4
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TO: ( 'T' | 't' ) ( 'O' | 'o' ) ;

kU_DataType
: oC_SymbolicName
| kU_DataType kU_ListIdentifiers
| ( oC_SymbolicName kU_ListIdentifiers )
| UNION SP? '(' SP? kU_PropertyDefinitions SP? ')'
| oC_SymbolicName SP? '(' SP? kU_PropertyDefinitions SP? ')'
| oC_SymbolicName SP? '(' SP? kU_DataType SP? ',' SP? kU_DataType SP? ')' ;
Expand Down
6 changes: 4 additions & 2 deletions src/include/common/copier_config/copier_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <vector>

#include "common/constants.h"
#include "common/types/types.h"

namespace kuzu {
namespace common {
Expand All @@ -32,15 +33,16 @@ struct CopyDescription {
FileType fileType;
std::vector<std::string> filePaths;
std::vector<std::string> columnNames;
std::vector<common::LogicalType> columnTypes;
std::vector<LogicalType> columnTypes;
std::unique_ptr<CSVReaderConfig> csvReaderConfig;

CopyDescription(FileType fileType, const std::vector<std::string>& filePaths,
std::unique_ptr<CSVReaderConfig> csvReaderConfig)
: fileType{fileType}, filePaths{filePaths}, csvReaderConfig{std::move(csvReaderConfig)} {}

CopyDescription(const CopyDescription& other)
: fileType{other.fileType}, filePaths{other.filePaths}, columnNames{other.columnNames}, columnTypes{columnTypes}, {
: fileType{other.fileType}, filePaths{other.filePaths}, columnNames{other.columnNames},
columnTypes{other.columnTypes} {
if (other.csvReaderConfig != nullptr) {
this->csvReaderConfig = std::make_unique<CSVReaderConfig>(*other.csvReaderConfig);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "common/types/date_t.h"
#include "common/types/timestamp_t.h"
#include "processor/operator/persistent/file_writer.h"
#include <parquet/api/writer.h>

Expand Down
11 changes: 0 additions & 11 deletions test/test_files/copy/copy_list_of_struct.test

This file was deleted.

2 changes: 2 additions & 0 deletions test/test_files/copy/copy_to_nested.test
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
---- 1
[[[[[[0,1]],[[2,3]]]]]]|[[[1]],[[2],[6]],[[3,4,8],[9]],[[5]]]

# Depending on PR #1955
-CASE ListStructList
-SKIP
-STATEMENT CREATE NODE TABLE Nested(id string,
field struct(a double[])[],
field2 struct(s string)[],
Expand Down
2,065 changes: 745 additions & 1,320 deletions third_party/antlr4_cypher/cypher_lexer.cpp

Large diffs are not rendered by default.

4,788 changes: 1,958 additions & 2,830 deletions third_party/antlr4_cypher/cypher_parser.cpp

Large diffs are not rendered by default.

45 changes: 19 additions & 26 deletions third_party/antlr4_cypher/include/cypher_lexer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Generated from Cypher.g4 by ANTLR 4.9
// Generated from Cypher.g4 by ANTLR 4.13.1

#pragma once

Expand Down Expand Up @@ -41,41 +41,34 @@ class CypherLexer : public antlr4::Lexer {
};

explicit CypherLexer(antlr4::CharStream *input);
~CypherLexer();

virtual std::string getGrammarFileName() const override;
virtual const std::vector<std::string>& getRuleNames() const override;
~CypherLexer() override;

virtual const std::vector<std::string>& getChannelNames() const override;
virtual const std::vector<std::string>& getModeNames() const override;
virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;

virtual const std::vector<uint16_t> getSerializedATN() const override;
virtual const antlr4::atn::ATN& getATN() const override;
std::string getGrammarFileName() const override;

private:
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
static antlr4::atn::PredictionContextCache _sharedContextCache;
static std::vector<std::string> _ruleNames;
static std::vector<std::string> _tokenNames;
static std::vector<std::string> _channelNames;
static std::vector<std::string> _modeNames;
const std::vector<std::string>& getRuleNames() const override;

const std::vector<std::string>& getChannelNames() const override;

const std::vector<std::string>& getModeNames() const override;

const antlr4::dfa::Vocabulary& getVocabulary() const override;

static std::vector<std::string> _literalNames;
static std::vector<std::string> _symbolicNames;
static antlr4::dfa::Vocabulary _vocabulary;
static antlr4::atn::ATN _atn;
static std::vector<uint16_t> _serializedATN;
antlr4::atn::SerializedATNView getSerializedATN() const override;

const antlr4::atn::ATN& getATN() const override;

// By default the static state used to implement the lexer is lazily initialized during the first
// call to the constructor. You can call this function if you wish to initialize the static state
// ahead of time.
static void initialize();

private:

// Individual action functions triggered by action() above.

// Individual semantic predicate functions triggered by sempred() above.

struct Initializer {
Initializer();
};
static Initializer _init;
};

47 changes: 20 additions & 27 deletions third_party/antlr4_cypher/include/cypher_parser.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// Generated from Cypher.g4 by ANTLR 4.9
// Generated from Cypher.g4 by ANTLR 4.13.1

#pragma once

Expand Down Expand Up @@ -90,13 +90,20 @@ class CypherParser : public antlr4::Parser {
};

explicit CypherParser(antlr4::TokenStream *input);
~CypherParser();

virtual std::string getGrammarFileName() const override;
virtual const antlr4::atn::ATN& getATN() const override { return _atn; };
virtual const std::vector<std::string>& getTokenNames() const override { return _tokenNames; }; // deprecated: use vocabulary instead.
virtual const std::vector<std::string>& getRuleNames() const override;
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
CypherParser(antlr4::TokenStream *input, const antlr4::atn::ParserATNSimulatorOptions &options);

~CypherParser() override;

std::string getGrammarFileName() const override;

const antlr4::atn::ATN& getATN() const override;

const std::vector<std::string>& getRuleNames() const override;

const antlr4::dfa::Vocabulary& getVocabulary() const override;

antlr4::atn::SerializedATNView getSerializedATN() const override;


class OC_CypherContext;
Expand Down Expand Up @@ -702,19 +709,19 @@ class CypherParser : public antlr4::Parser {
KU_DataTypeContext(antlr4::ParserRuleContext *parent, size_t invokingState);
virtual size_t getRuleIndex() const override;
OC_SymbolicNameContext *oC_SymbolicName();
KU_ListIdentifiersContext *kU_ListIdentifiers();
antlr4::tree::TerminalNode *UNION();
KU_PropertyDefinitionsContext *kU_PropertyDefinitions();
std::vector<antlr4::tree::TerminalNode *> SP();
antlr4::tree::TerminalNode* SP(size_t i);
std::vector<KU_DataTypeContext *> kU_DataType();
KU_DataTypeContext* kU_DataType(size_t i);
KU_ListIdentifiersContext *kU_ListIdentifiers();


};

KU_DataTypeContext* kU_DataType();
KU_DataTypeContext* kU_DataType(int precedence);

class KU_ListIdentifiersContext : public antlr4::ParserRuleContext {
public:
KU_ListIdentifiersContext(antlr4::ParserRuleContext *parent, size_t invokingState);
Expand Down Expand Up @@ -2143,21 +2150,12 @@ class CypherParser : public antlr4::Parser {
OC_DashContext* oC_Dash();


virtual bool sempred(antlr4::RuleContext *_localctx, size_t ruleIndex, size_t predicateIndex) override;
bool kU_DataTypeSempred(KU_DataTypeContext *_localctx, size_t predicateIndex);
// By default the static state used to implement the parser is lazily initialized during the first
// call to the constructor. You can call this function if you wish to initialize the static state
// ahead of time.
static void initialize();

private:
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
static antlr4::atn::PredictionContextCache _sharedContextCache;
static std::vector<std::string> _ruleNames;
static std::vector<std::string> _tokenNames;

static std::vector<std::string> _literalNames;
static std::vector<std::string> _symbolicNames;
static antlr4::dfa::Vocabulary _vocabulary;
static antlr4::atn::ATN _atn;
static std::vector<uint16_t> _serializedATN;


virtual void notifyQueryNotConcludeWithReturn(antlr4::Token* startToken) {};
virtual void notifyNodePatternWithoutParentheses(std::string nodeName, antlr4::Token* startToken) {};
Expand All @@ -2166,10 +2164,5 @@ class CypherParser : public antlr4::Parser {
virtual void notifyReturnNotAtEnd(antlr4::Token* startToken) {};
virtual void notifyNonBinaryComparison(antlr4::Token* startToken) {};


struct Initializer {
Initializer();
};
static Initializer _init;
};

0 comments on commit bd668b2

Please sign in to comment.