-
Notifications
You must be signed in to change notification settings - Fork 70
add iceberg_avro interface #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
73e64a7
add libavrocpp_s
zhjwpku b195b86
install zlib using vcpkg
zhjwpku 32daed6
add iceberg_avro
zhjwpku 9358d17
make example build
zhjwpku 923bf15
Adopt change from https://github.com/apache/avro/pull/3299
wgtmac be6f8d2
fix ci
wgtmac e2c581b
rollback windows
wgtmac e3ee8df
fix windows
wgtmac 79cbf7b
fix AVRO_VENDORED
wgtmac fbc804d
Merge pull request #3 from wgtmac/add_avro
zhjwpku 0fd88c1
minor fix
wgtmac 0f0f3f2
Merge pull request #4 from wgtmac/add_avro
zhjwpku File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "iceberg/iceberg_export.h" | ||
|
|
||
| namespace iceberg { | ||
|
|
||
| class ICEBERG_EXPORT Avro { | ||
| public: | ||
| virtual ~Avro() = default; | ||
| virtual std::string print() const = 0; | ||
| }; | ||
|
|
||
| } // namespace iceberg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # 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. | ||
|
|
||
| if(NOT ICEBERG_AVRO) | ||
| return() | ||
| endif() | ||
|
|
||
| set(ICEBERG_AVRO_SOURCES demo_avro.cc) | ||
| set(ICEBERG_AVRO_INCLUDES "${ICEBERG_INCLUDES}") | ||
|
|
||
| # Libraries to link with exported libiceberg_avro.{so,a}. | ||
| set(ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS) | ||
| set(ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS) | ||
| set(ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS) | ||
| set(ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS) | ||
|
|
||
| list(APPEND | ||
| ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:iceberg_static>,iceberg_static,iceberg_shared>" | ||
| "$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>" | ||
| ) | ||
| list(APPEND | ||
| ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:iceberg_shared>,iceberg_shared,iceberg_static>" | ||
| "$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>" | ||
| ) | ||
|
|
||
| if(AVRO_VENDORED) | ||
| list(APPEND ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s) | ||
| list(APPEND ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS Iceberg::avrocpp_s) | ||
| else() | ||
| list(APPEND | ||
| ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:Avro::avrocpp_static>,Avro::avrocpp_static,Avro::avrocpp_shared>" | ||
| ) | ||
| list(APPEND | ||
| ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:Avro::avrocpp_shared>,Avro::avrocpp_shared,Avro::avrocpp_static>" | ||
| ) | ||
| endif() | ||
|
|
||
| list(APPEND | ||
| ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:Iceberg::iceberg_static>,Iceberg::iceberg_static,Iceberg::iceberg_shared>" | ||
| ) | ||
| list(APPEND | ||
| ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS | ||
| "$<IF:$<TARGET_EXISTS:Iceberg::iceberg_shared>,Iceberg::iceberg_shared,Iceberg::iceberg_static>" | ||
| ) | ||
|
|
||
| add_iceberg_lib(iceberg_avro | ||
| SOURCES | ||
| ${ICEBERG_AVRO_SOURCES} | ||
| PRIVATE_INCLUDES | ||
| ${ICEBERG_AVRO_INCLUDES} | ||
| SHARED_LINK_LIBS | ||
| ${ICEBERG_AVRO_SHARED_BUILD_INTERFACE_LIBS} | ||
| STATIC_LINK_LIBS | ||
| ${ICEBERG_AVRO_STATIC_BUILD_INTERFACE_LIBS} | ||
| STATIC_INSTALL_INTERFACE_LIBS | ||
| ${ICEBERG_AVRO_STATIC_INSTALL_INTERFACE_LIBS} | ||
| SHARED_INSTALL_INTERFACE_LIBS | ||
| ${ICEBERG_AVRO_SHARED_INSTALL_INTERFACE_LIBS}) | ||
|
|
||
| iceberg_install_all_headers(iceberg/avro) | ||
|
|
||
| install(FILES ${CMAKE_CURRENT_BINARY_DIR}/iceberg_avro_export.h | ||
| DESTINATION ${ICEBERG_INSTALL_INCLUDEDIR}/iceberg/avro) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * 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 "iceberg/avro/demo_avro.h" | ||
|
|
||
| #include <sstream> | ||
|
|
||
| #include "avro/Compiler.hh" | ||
| #include "avro/ValidSchema.hh" | ||
| #include "iceberg/demo_table.h" | ||
|
|
||
| namespace iceberg::avro { | ||
|
|
||
| std::string DemoAvro::print() const { | ||
| std::string input = | ||
| "{\n\ | ||
| \"type\": \"record\",\n\ | ||
| \"name\": \"testrecord\",\n\ | ||
| \"fields\": [\n\ | ||
| {\n\ | ||
| \"name\": \"testbytes\",\n\ | ||
| \"type\": \"bytes\",\n\ | ||
| \"default\": \"\"\n\ | ||
| }\n\ | ||
| ]\n\ | ||
| }\n\ | ||
| "; | ||
|
|
||
| ::avro::ValidSchema schema = ::avro::compileJsonSchemaFromString(input); | ||
| std::ostringstream actual; | ||
| schema.toJson(actual); | ||
|
|
||
| return actual.str(); | ||
| } | ||
|
|
||
| } // namespace iceberg::avro |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.