Skip to content

Conversation

@majetideepak
Copy link

On MacOS, I see the following error when building.

././target/generated-sources/javacc/SqlParserConstants.h:142:12: error: expected unqualified-id
const  int DOMAIN = 64;
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/math.h:734:17: note: expanded from macro 'DOMAIN'
#define DOMAIN  

@kaikalur
Copy link

We should actually see why math.h is even included and clean that up.

@kaikalur
Copy link

kaikalur commented Sep 18, 2023

Also we use '_' prefixx for conflicts (like _EOF). So let's follow that practice if it is really needed. But I would like to remove useless includes and get rid of this error

@majetideepak majetideepak force-pushed the fix-domain branch 2 times, most recently from ac7ed3b to e3b59fc Compare September 18, 2023 14:36
@majetideepak
Copy link
Author

majetideepak commented Sep 18, 2023

@kaikalur I looked at the clang verbose output and the math library is not being included explicitly. It's probably part of the clang runtime.

@kaikalur
Copy link

No runtime should not matter. I think the issue is in main.cc where we include file.h

@majetideepak
Copy link
Author

@kaikalur removing fstream fixed it. I will look for an alternative.

@majetideepak
Copy link
Author

@kaikalur I replaced ifstream with C-style file reading. Let me know if you have a better approach.

@kaikalur
Copy link

kaikalur commented Sep 18, 2023

This code was a couple of weekend hacking back in 2020 lol so it's quality shows. Grammar/AST part should be decent though.

So feel free to fixup the code the way you see fit.

@kaikalur
Copy link

I just added a makefile that separates the main from the parser library. If you can setup a buck build or cmake that will be great :)

@majetideepak
Copy link
Author

@kaikalur I will be adding some CMake build files later. The background is that we want to use the parser here to parse expressions in Velox tests. See the discussion here: facebookincubator/velox#5589
The APIs we need to implement are https://github.com/facebookincubator/velox/blob/main/velox/duckdb/conversion/DuckParser.h
Would you happen to have any feedback for us? Thanks.

@majetideepak
Copy link
Author

I invoked value_expression_primary() on cast(switch(gt(c0, c1), c1, c0) as double) and was able to get the parse tree.
I need to investigate other APIs.

@kaikalur
Copy link

@kaikalur I will be adding some CMake build files later. The background is that we want to use the parser here to parse expressions in Velox tests. See the discussion here: facebookincubator/velox#5589 The APIs we need to implement are https://github.com/facebookincubator/velox/blob/main/velox/duckdb/conversion/DuckParser.h Would you happen to have any feedback for us? Thanks.

We can add methods like ParseExpression to ParserClient class that I just started working on:

https://fburl.com/kwjuum7p

@majetideepak
Copy link
Author

We can add methods like ParseExpression to ParserClient class that I just started working on:

@kaikalur Sounds good! I am not a Meta employee. So I cannot access your link. But I think we are aligned on the goal here.
I will explore the parser a bit more for Velox's needs and update it here.
I will then work on the CMake support so that we can install the parser as a library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants