Skip to content

[Bug]: SET statement fails when a config property name contains a hyphen #487

Description

@iGarym

Version

v4.5.0

Which SQL?

Hive

SQL content

set tez.grouping.max-size = 268435456;
set tez.grouping.min-size = 134217728;
set tez.grouping.split-waves = 1;

JavaScript/TypeScript code

import { HiveSQL, SparkSQL } from 'dt-sql-parser';

const sql = `set tez.grouping.max-size=1;
set tez.grouping.min-size=1;
set tez.grouping.split-waves = 1;`;

console.log(new HiveSQL().validate(sql));
// [
//   { startLine: 1, endLine: 1, startColumn: 21, endColumn: 22,
//     message: "'-' is not valid at this position, expecting a keyword" },
//   { startLine: 2, endLine: 2, startColumn: 21, endColumn: 22,
//     message: "'-' is not valid at this position" },
//   { startLine: 3, endLine: 3, startColumn: 23, endColumn: 24,
//     message: "'-' is not valid at this position" }
// ]

console.log(new SparkSQL().validate(sql));
// []

What happened?

Hive config property names are allowed to contain hyphens, and the statements
above run fine in both Hive and Spark. SparkSQL.validate() accepts them as
well, but HiveSQL.validate() reports a syntax error on every one of them:

line message
1 '-' is not valid at this position, expecting a keyword
2 '-' is not valid at this position
3 '-' is not valid at this position

Relevant log output

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