[ 
https://issues.apache.org/jira/browse/CALCITE-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17388233#comment-17388233
 ] 

Julian Hyde edited comment on CALCITE-3329 at 7/27/21, 10:06 PM:
-----------------------------------------------------------------

[~x1q1j1], Thanks for the good work. I have reviewed throughly. I think we are 
close.

As an Apache project, we can't have binaries (e.g. .so files) in checked into 
Git. So, I added [Sigar Loader|https://github.com/kamon-io/sigar-loader] as a 
dependency and removed the libraries. Take a look at 
[julianhyde/3329-os|https://github.com/julianhyde/calcite/tree/3329-os], 
cherry-pick the changes to your branch, and add your changes to it.

Some other comments:
* Add new commands to [OS 
adapter|https://calcite.apache.org/docs/os_adapter.html]
* Add {{class HexTransformationUtils}} to top-level and add unit tests
* It is inconsistent that {{class OsQueryTableUtils}} ends with an 's' (like a 
utility class) and yet can be instantiated. How about moving {{systemInfo()}} 
and all similar methods into {{enum OsQueryEnum}}? Also move method 
{{getResultInfo()}}, which would become {{switch (this)}}.
* In {{getResultInfo}} don't assign to a variable; each branch should return a 
value.
* Should the {{Sigar()}} instance be long-lived or short-lived? Probably better 
to create one just for the duration of a call to {{getResultInfo()}}. Pass 
{{sigar}} into each function (e.g. {{systemInfo()}}) as an argument.
* Rename {{getResultInfo}} to {{eval}}.
* Rename {{OsQueryEnum}} to {{OsQuery}}.
* Replace calls like {{HexTransformationUtils.kbToGb(usage.getUsed()) + "GB"}} 
with a method {{kbToGbString}}.


was (Author: julianhyde):
[~x1q1j1], Thanks for the good work. I have reviewed throughly. I think we are 
close.

As an Apache project, we can't have binaries (e.g. .so files) in checked into 
Git. So, I added [Sigar Loader|https://github.com/kamon-io/sigar-loader] as a 
dependency and removed the libraries. Take a look at 
[julianhyde/3329-os|https://github.com/julianhyde/calcite/tree/3329-os], 
cherry-pick the changes to your branch, and add your changes to it.

Some other comments:
* Add new commands to [OS 
adapter|https://calcite.apache.org/docs/os_adapter.html]
* Add {{class HexTransformationUtils}} to top-level and add unit tests
* It is inconsistent that {{class OsQueryTableUtils}} ends with an 's' (like a 
utility class) and yet can be instantiated. How about moving {{systemInfo()}} 
and all similar methods into {{enum OsQueryEnum}}? Also move method 
{{getResultInfo()}}, which would become {{switch (this)}}.
* In {{getResultInfo}} don't assign to a variable; each branch should return a 
value.
* Should the {{Sigar()}} instance be long-lived or short-lived? Probably better 
to create one just for the duration of a call to {{getResultInfo()}}.
* Rename {{getResultInfo}} to {{eval}}.
* Rename {{OsQueryEnum}} to {{OsQuery}}.
* Replace calls like {{HexTransformationUtils.kbToGb(usage.getUsed()) + "GB"}} 
with a method {{kbToGbString}}.

> Implement osquery for OS adapter
> --------------------------------
>
>                 Key: CALCITE-3329
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3329
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Forward Xu
>            Assignee: Forward Xu
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: 20160218233133330.png, 20160218233139164.png, 
> image-2019-09-09-08-27-56-974.png, image-2019-09-09-08-33-41-411.png, 
> sigar1.pdf, sigar2.pdf
>
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Implement osquery command for OS adapter, Achieve similar features of 
> FaceBook's osquery. E.g:
> select * from os_version;
> select * from system_info;
> select * from mounts;
> select * from interface_addresses
> select * from memory_info;
> select * from interface_addresses;
> select * from cpu_info;
> select * from java_info;



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to