Re: Calcite-Clojure integration - use Clojure to implement calcite back-ends

2022-01-12 Thread Eugen Stan

Thanks!

On 12.01.2022 11:02, Stamatis Zampetakis wrote:

I added your talk to the meetup event.

The meetup is on January 19, apologies for the confusion.

Best,
Stamatis

On Tue, Jan 11, 2022 at 10:18 PM Eugen Stan > wrote:


Hello Stamatis,

I sent my proposal on the original meeting thread.

Forgot to ask: What is the exact day of the event?
I see January 19 mentioned here:
https://www.meetup.com/Apache-Calcite/events/282836907/


And you mentioned January 17 on this email.


Regards,
-- 
Eugen Stan


+40770 941 271  / https://www.netdava.com 




--
Eugen Stan

+40770 941 271  / https://www.netdava.combegin:vcard
fn:Eugen Stan
n:Stan;Eugen
email;internet:eugen.s...@netdava.com
tel;cell:+40720898747
x-mozilla-html:FALSE
url:https://www.netdava.com
version:2.1
end:vcard



Re: Calcite-Clojure integration - use Clojure to implement calcite back-ends

2022-01-12 Thread Stamatis Zampetakis
I added your talk to the meetup event.

The meetup is on January 19, apologies for the confusion.

Best,
Stamatis

On Tue, Jan 11, 2022 at 10:18 PM Eugen Stan  wrote:

> Hello Stamatis,
>
> I sent my proposal on the original meeting thread.
>
> Forgot to ask: What is the exact day of the event?
> I see January 19 mentioned here:
> https://www.meetup.com/Apache-Calcite/events/282836907/
>
> And you mentioned January 17 on this email.
>
>
> Regards,
> --
> Eugen Stan
>
> +40770 941 271  / https://www.netdava.com


Re: Calcite-Clojure integration - use Clojure to implement calcite back-ends

2022-01-10 Thread Stamatis Zampetakis
Hi Eugen,

Thanks for sharing this project. It will be very helpful for those who want
to use Calcite with Clojure.

I guess many people will be interested to learn more about the project and
see it in action.
If you plan to give a talk to the Calcite meetup on January 17, please send
me a title, abstract, and expected duration.

Best,
Stamatis

On Sun, Jan 9, 2022 at 8:03 PM Eugen Stan  wrote:

> Hello,
>
> You can now write Apache Calcite adapters in Clojure.
>
> There is a library to help you and an example code to guide you.
>
> I found some time to work on this and I published a library version of
> that class and also a Clojure example that showcases how you would use
> it in your app
>
>
> The code is available https://github.com/ieugen/calcite-clj .
>
> Library published on Clojars
> https://clojars.org/io.github.ieugen/calcite-clj .
>
> Would this be of interest for the community meeting ?
>
> Regards,
> --
> Eugen Stan
>
> +40770 941 271  / https://www.netdava.com


RE: Calcite-Clojure integration - use Clojure to implement calcite back-ends

2022-01-09 Thread Eugen Stan

Hello,

You can now write Apache Calcite adapters in Clojure.

There is a library to help you and an example code to guide you.

I found some time to work on this and I published a library version of 
that class and also a Clojure example that showcases how you would use 
it in your app



The code is available https://github.com/ieugen/calcite-clj .

Library published on Clojars 
https://clojars.org/io.github.ieugen/calcite-clj .


Would this be of interest for the community meeting ?

Regards,
--
Eugen Stan

+40770 941 271  / https://www.netdava.combegin:vcard
fn:Eugen Stan
n:Stan;Eugen
email;internet:eugen.s...@netdava.com
tel;cell:+40720898747
x-mozilla-html:FALSE
url:https://www.netdava.com
version:2.1
end:vcard



Calcite-Clojure integration - use Clojure to implement calcite back-ends

2021-12-27 Thread Eugen Stan

Hello,

I would like to announce that I have ported the Calcite CSV example 
(scannable table only) from Java to Clojure.


I did it mainly as an exercise: to learn how Calicte works and how it 
would look with Clojure.


I learn a lot in the process and also discovered a Calcite bug 
https://issues.apache.org/jira/browse/CALCITE-4966 .


If anyone is interested, my code is available here: 
https://github.com/ieugen/clojure-training/tree/main/csv-clojure .


Id does need a version of Calcite with the fix for 
https://issues.apache.org/jira/browse/CALCITE-4966  (I built and 
deployed a local version).


It also needs a small 1 class library used as a bridge (build and 
install locally): 
https://github.com/ieugen/clojure-training/blob/main/csv-clojure/calcite-clj/src/main/java/ro.ieugen.calcite.clj/SchemaFactory.java 
.


With the above code I was able to call code like this:
(let [db {:jdbcUrl "jdbc:calcite:model=resources/model.json"
:user "admin"
:password "admin"}
ds (jdbc/get-datasource db)]
(jdbc/execute! ds ["select * from emps where age is null or age >= 
40"])))


and get back SQL results.

Part of the magic is in model.json file.
It uses ro.ieugen.calcite.clj.SchemaFactory and it has an operand property
 "clojure-clj.schema-factory": "ro.ieugen.calcite-csv/csv-schema" .

This property is a reference to the Clojure namespace 
(ro.ieugen.calcite-csv) and function (csv-schema) to call for generating 
the Schema.


The schema factory is generic and if there is interest I would like to 
contribute it upstream.


It allows the use of Clojure functions to be used as Schema factories 
thus creating a bridge to Clojure in a seamless way.



Full model.json bellow:

```
{
"version": "1.0",
"defaultSchema": "SALES",
"schemas": [
  {
"name": "SALES",
"type": "custom",
"factory": "ro.ieugen.calcite.clj.SchemaFactory",
"operand": {
  "clojure-clj.schema-factory": "ro.ieugen.calcite-csv/csv-schema",
  "directory": "resources/sales"
}
  }
]
  }

```
--
Eugen Stan

+40770 941 271  / https://www.netdava.combegin:vcard
fn:Eugen Stan
n:Stan;Eugen
email;internet:eugen.s...@netdava.com
tel;cell:+40720898747
x-mozilla-html:FALSE
url:https://www.netdava.com
version:2.1
end:vcard