changelog shortlog graph tags branches files raw help

Mercurial > core / changeset: rdb/query updates, clap fixes

changeset 491: 298ca41f7f5a
parent 490: 7a7e6c273f52
child 492: dc0cc9c69789
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 30 Jun 2024 18:26:30 -0400
files: lisp/lib/cli/clap/opt.lisp lisp/lib/cli/clap/pkg.lisp lisp/lib/cli/clap/vars.lisp lisp/lib/obj/pkg.lisp lisp/lib/obj/query.lisp lisp/lib/rdb/pkg.lisp lisp/lib/rdb/query.lisp
description: rdb/query updates, clap fixes
     1.1--- a/lisp/lib/cli/clap/opt.lisp	Sun Jun 30 17:54:33 2024 -0400
     1.2+++ b/lisp/lib/cli/clap/opt.lisp	Sun Jun 30 18:26:30 2024 -0400
     1.3@@ -32,11 +32,6 @@
     1.4 (make-opt-parser (pathname string)
     1.5   (pathname $val))
     1.6 
     1.7-(declaim ((vector symbol) *cli-opt-kinds*))
     1.8-(defvar *cli-opt-kinds* ;; make sure to keep this in sync with the list of parsers above
     1.9-  (let ((kinds '(boolean string form list symbol keyword number file directory pathname)))
    1.10-    (make-array (length kinds) :element-type 'symbol :initial-contents kinds)))
    1.11-
    1.12 ;;; Objects
    1.13 (defstruct cli-opt
    1.14   ;; note that cli-opts can have a nil or unbound name slot
     2.1--- a/lisp/lib/cli/clap/pkg.lisp	Sun Jun 30 17:54:33 2024 -0400
     2.2+++ b/lisp/lib/cli/clap/pkg.lisp	Sun Jun 30 18:26:30 2024 -0400
     2.3@@ -5,7 +5,7 @@
     2.4 ;;; Code:
     2.5 (defpackage :cli/clap/vars
     2.6   (:use :cl)
     2.7-  (:export :*cli-group-separator* :*no-exit* :*cli-opt-kinds* :*default-cli-def* :*default-cli-class*))
     2.8+  (:export :*cli-group-separator* :*no-exit* :*default-cli-def* :*default-cli-class* :*cli-opt-kinds*))
     2.9 
    2.10 (defpackage :cli/clap/util
    2.11   (:use :cl :std :log :sb-ext :cli/clap/vars)
     3.1--- a/lisp/lib/cli/clap/vars.lisp	Sun Jun 30 17:54:33 2024 -0400
     3.2+++ b/lisp/lib/cli/clap/vars.lisp	Sun Jun 30 18:26:30 2024 -0400
     3.3@@ -18,3 +18,8 @@
     3.4 (defvar *default-cli-class* 'cli
     3.5   "The name of the class of the top-level CLI object which will be
     3.6 generated by the DEFINE-CLI macro.")
     3.7+
     3.8+(declaim ((vector symbol) *cli-opt-kinds*))
     3.9+(defvar *cli-opt-kinds* ;; make sure to keep this in sync with the list of parsers above
    3.10+  (let ((kinds '(boolean string form list symbol keyword number file directory pathname)))
    3.11+    (make-array (length kinds) :element-type 'symbol :initial-contents kinds)))
     4.1--- a/lisp/lib/obj/pkg.lisp	Sun Jun 30 17:54:33 2024 -0400
     4.2+++ b/lisp/lib/obj/pkg.lisp	Sun Jun 30 18:26:30 2024 -0400
     4.3@@ -334,6 +334,7 @@
     4.4            :column-expression
     4.5            :literal-expression
     4.6            :field
     4.7+           :fields
     4.8            :row-count
     4.9            :column-count
    4.10            :record-batch
    4.11@@ -341,6 +342,7 @@
    4.12            :derive-schema
    4.13            :load-schema
    4.14            :make-schema
    4.15+           :make-query
    4.16            :field-vector
    4.17            :*literal-value-types*
    4.18            :literal-value-type
     5.1--- a/lisp/lib/obj/query.lisp	Sun Jun 30 17:54:33 2024 -0400
     5.2+++ b/lisp/lib/obj/query.lisp	Sun Jun 30 18:26:30 2024 -0400
     5.3@@ -37,7 +37,7 @@
     5.4 
     5.5 ;;; Schema
     5.6 (defclass schema ()
     5.7-  ((fields :type (vector field) :initarg :fields)))
     5.8+  ((fields :type (vector field) :initarg :fields :accessor fields)))
     5.9 
    5.10 (defclass schema-metadata ()
    5.11   ((metadata)))
    5.12@@ -49,8 +49,6 @@
    5.13 
    5.14 (defgeneric derive-schema (self))
    5.15 
    5.16-(defgeneric schema (self))
    5.17-
    5.18 ;;; Record Batch
    5.19 (defstruct record-batch
    5.20   (schema (make-schema) :type schema)
    5.21@@ -60,6 +58,13 @@
    5.22   (:method ((self record-batch) (n fixnum))
    5.23     (svref (record-batch-fields self) n)))
    5.24 
    5.25+(defmethod fields ((self record-batch))
    5.26+  (record-batch-fields self))
    5.27+
    5.28+(defgeneric schema (self)
    5.29+  (:method ((self record-batch))
    5.30+    (record-batch-schema self)))
    5.31+
    5.32 (defgeneric row-count (self)
    5.33   (:method ((self record-batch))
    5.34     (sequence:length (svref (record-batch-fields self) 0))))
    5.35@@ -241,4 +246,9 @@
    5.36 ;;; Query
    5.37 (defclass query () ())
    5.38 
    5.39+(defgeneric make-query (self &rest initargs &key &allow-other-keys)
    5.40+  (:method ((self t) &rest initargs)
    5.41+    (declare (ignore initargs))
    5.42+    (make-instance 'query)))
    5.43+
    5.44 (defgeneric execute-query (self q))
     6.1--- a/lisp/lib/rdb/pkg.lisp	Sun Jun 30 17:54:33 2024 -0400
     6.2+++ b/lisp/lib/rdb/pkg.lisp	Sun Jun 30 18:26:30 2024 -0400
     6.3@@ -8,7 +8,7 @@
     6.4 
     6.5 ;; Code:
     6.6 (defpackage :rdb
     6.7-  (:use :cl :std :rocksdb :sb-alien :obj/db)
     6.8+  (:use :cl :std :rocksdb :sb-alien :obj/db :obj/query)
     6.9   (:import-from :sb-ext :string-to-octets :octets-to-string)
    6.10   (:export 
    6.11    ;; err
     7.1--- a/lisp/lib/rdb/query.lisp	Sun Jun 30 17:54:33 2024 -0400
     7.2+++ b/lisp/lib/rdb/query.lisp	Sun Jun 30 18:26:30 2024 -0400
     7.3@@ -5,5 +5,20 @@
     7.4 ;;; Code:
     7.5 (in-package :rdb)
     7.6 
     7.7+(defclass rdb-schema (schema) ())
     7.8+
     7.9 (defclass rdb-data-source (data-source)
    7.10-  ((db :type rdb :initarg :db :accessor db)))
    7.11+  ((db :type rdb :initarg :db :accessor db)
    7.12+   (schema :type rdb-schema :initarg :schema :accessor schema)))
    7.13+
    7.14+(defclass rdb-data-frame (data-frame) ())
    7.15+
    7.16+(defclass rdb-execution-context (execution-context) ())
    7.17+
    7.18+(defclass rdb-query-plan (query-plan) ())
    7.19+
    7.20+(defclass rdb-logical-plan (logical-plan) ())
    7.21+
    7.22+(defclass rdb-physical-plan (physical-plan) ())
    7.23+
    7.24+(defclass rdb-query (query) ())