Skip to content
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

fix repl always return 0 #1286

Merged
merged 7 commits into from
Dec 4, 2019

Conversation

Yancey1989
Copy link
Collaborator

@Yancey1989 Yancey1989 commented Dec 2, 2019

fixed #1277
fixed #1317

related #1318

@@ -81,15 +81,13 @@ func render(rsp interface{}, table *tablewriter.Table) bool {
table.Append(row)
isTable = true
case error:
if os.Getenv("SQLFLOW_log_dir") != "" { // To avoid printing duplicated error message to console
log.New(os.Stderr, "", 0).Printf("ERROR: %v\n", s)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd better keep this check somewhere to avoid printing error message twice when logging to stderr.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use log.Fatalf to exit if some errors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log.Fatalf will terminate the program, that's no good for the interactive mode of REPL.

pkg/sql/model.go Outdated
@@ -86,7 +86,6 @@ func (m *model) saveDB(db *DB, table string, session *pb.Session) (e error) {
if e != nil {
return fmt.Errorf("cannot create sqlfs file %s: %v", table, e)
}
defer sqlf.Close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about defering with the new Close code in a lambda?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe should check the error of hiveWriter.Close, I updated this PR follow https://www.joeshaw.org/dont-defer-close-on-writable-files/ that uses a safe way to close sqlfs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe if we call hiveWriter.Close twice?

typhoonzero
typhoonzero previously approved these changes Dec 2, 2019
Copy link
Collaborator

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please checkout @shendiaomo 's comments and fix them in next PR?

@wangkuiyi wangkuiyi merged commit fd63870 into sql-machine-learning:develop Dec 4, 2019
@Yancey1989 Yancey1989 deleted the fix_repl_hive branch December 4, 2019 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

repl save model failed train successfully, but no data in hive table
4 participants