Skip to content

Run training and prediction statement error #46

@DevinKin

Description

@DevinKin

According to the SQLFlowRemoteTest test file, I used Clojure to wrap the test process.

(ns devinkin.sqlflow-remote-cli
  (:import [io.grpc ManagedChannelBuilder]
           [proto Sqlflow])
  (:require
   [devinkin.message-handler-example :as mh]))

(defn get-remote-client
  "get remote client"
  [sqlflow-server sqlflow-submitter sqlflow-data-source user-id message-handler]
  (let [chan (-> (ManagedChannelBuilder/forTarget sqlflow-server)
                 (.usePlaintext)
                 (.build))
        session (-> (proto.Sqlflow$Session/newBuilder)
                    (.setUserId user-id)
                    (.setSubmitter sqlflow-submitter)
                    (.setDbConnStr sqlflow-data-source)
                    (.build))]
    (-> (org.sqlflow.client.SQLFlow$Builder/newInstance)
        (.withSession session)
        (.withIntervalFetching 2000)
        (.withMessageHandler message-handler)
        (.withChannel chan)
        (.build))))

(defn run-remote-test
  [sql]
  (let [client (get-remote-client "192.168.31.102:50051"
                                  "pai"
                                  "mysql://root:root@tcp(192.168.31.102:3306)/iris?maxAllowedPacket=0"
                                  "devin"
                                  (mh/get-message-handler-example))]
    (prn sql)
    (.run client sql)))

;; success
(run-remote-test "SELECT 1")
(run-remote-test "describe iris.train")
(run-remote-test "select * from iris.train limit 5")

;; fail
(run-remote-test "SELECT * FROM iris.train TO TRAIN DNNClassifier WITH  model.n_classes = 3,  model.hidden_units = [10, 10],  train.epoch = 10 COLUMN sepal_length, sepal_width, petal_length, petal_width LABEL class INTO sqlflow_models.my_dnn_model")
(run-remote-test "SELECT * FROM iris.test TO PREDICT iris.predict.class USING sqlflow_models.my_dnn_model")

;; success
(run-remote-test "SELECT * FROM iris.test")
(run-remote-test "SELECT * FROM iris.predict LIMIT 5")

Success

Run normal sql query statements such as

(run-remote-test "SELECT 1")
(run-remote-test "describe iris.train")
(run-remote-test "select * from iris.train limit 5")
(run-remote-test "SELECT * FROM iris.test")
(run-remote-test "SELECT * FROM iris.predict LIMIT 5")

Failure

Run predictions and training statements such as

(run-remote-test "SELECT * FROM iris.train TO TRAIN DNNClassifier WITH  model.n_classes = 3,  model.hidden_units = [10, 10],  train.epoch = 10 COLUMN sepal_length, sepal_width, petal_length, petal_width LABEL class INTO sqlflow_models.my_dnn_model")
(run-remote-test "SELECT * FROM iris.test TO PREDICT iris.predict.class USING sqlflow_models.my_dnn_model")

and got the same error message

1. Unhandled io.grpc.StatusRuntimeException
   UNKNOWN: runSQLProgram error: syntax error near or before
   "sqlflow_models.my_dnn_model". You might want to refer to the
   https://sqlflow.org/sqlflow/doc/language_guide

1. Unhandled io.grpc.StatusRuntimeException
   UNKNOWN: runSQLProgram error: syntax error near or before
   "sqlflow_models.my_dnn_model". You might want to refer to the
   https://sqlflow.org/sqlflow/doc/language_guide

I still don't know why I can't run training and prediction sentences.

Environment

  1. java11
  2. dependency:
<!-- https://mvnrepository.com/artifact/org.sqlflow/jsqlflow -->
<dependency>
    <groupId>org.sqlflow</groupId>
    <artifactId>jsqlflow</artifactId>
    <version>0.2.3</version>
</dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions