@@ -99,7 +99,6 @@ abstract class AbstractParser extends DataTypeParserInterface with Logging {
99
99
throw new ParseException (
100
100
command = Option (command),
101
101
start = e.origin,
102
- stop = e.origin,
103
102
errorClass = e.getCondition,
104
103
messageParameters = e.getMessageParameters.asScala.toMap,
105
104
queryContext = e.getQueryContext)
@@ -158,24 +157,19 @@ case object ParseErrorListener extends BaseErrorListener {
158
157
charPositionInLine : Int ,
159
158
msg : String ,
160
159
e : RecognitionException ): Unit = {
161
- val ( start, stop) = offendingSymbol match {
160
+ val start = offendingSymbol match {
162
161
case token : CommonToken =>
163
- val start = Origin (Some (line), Some (token.getCharPositionInLine))
164
- val length = token.getStopIndex - token.getStartIndex + 1
165
- val stop = Origin (Some (line), Some (token.getCharPositionInLine + length))
166
- (start, stop)
162
+ Origin (Some (line), Some (token.getCharPositionInLine))
167
163
case _ =>
168
- val start = Origin (Some (line), Some (charPositionInLine))
169
- (start, start)
164
+ Origin (Some (line), Some (charPositionInLine))
170
165
}
171
166
e match {
172
167
case sre : SparkRecognitionException if sre.errorClass.isDefined =>
173
- throw new ParseException (None , start, stop, sre.errorClass.get, sre.messageParameters)
168
+ throw new ParseException (None , start, sre.errorClass.get, sre.messageParameters)
174
169
case _ =>
175
170
throw new ParseException (
176
171
command = None ,
177
172
start = start,
178
- stop = stop,
179
173
errorClass = " PARSE_SYNTAX_ERROR" ,
180
174
messageParameters = Map (" error" -> msg, " hint" -> " " ))
181
175
}
@@ -190,7 +184,6 @@ class ParseException private (
190
184
val command : Option [String ],
191
185
message : String ,
192
186
val start : Origin ,
193
- val stop : Origin ,
194
187
errorClass : Option [String ] = None ,
195
188
messageParameters : Map [String , String ] = Map .empty,
196
189
queryContext : Array [QueryContext ] = ParseException .getQueryContext())
@@ -208,40 +201,36 @@ class ParseException private (
208
201
Option (SparkParserUtils .command(ctx)),
209
202
SparkThrowableHelper .getMessage(errorClass, messageParameters),
210
203
SparkParserUtils .position(ctx.getStart),
211
- SparkParserUtils .position(ctx.getStop),
212
204
Some (errorClass),
213
205
messageParameters)
214
206
215
- def this (errorClass : String , ctx : ParserRuleContext ) = this (errorClass, Map .empty, ctx)
207
+ def this (errorClass : String , ctx : ParserRuleContext ) =
208
+ this (errorClass = errorClass, messageParameters = Map .empty, ctx = ctx)
216
209
217
210
/** Compose the message through SparkThrowableHelper given errorClass and messageParameters. */
218
211
def this (
219
212
command : Option [String ],
220
213
start : Origin ,
221
- stop : Origin ,
222
214
errorClass : String ,
223
215
messageParameters : Map [String , String ]) =
224
216
this (
225
217
command,
226
218
SparkThrowableHelper .getMessage(errorClass, messageParameters),
227
219
start,
228
- stop,
229
220
Some (errorClass),
230
221
messageParameters,
231
222
queryContext = ParseException .getQueryContext())
232
223
233
224
def this (
234
225
command : Option [String ],
235
226
start : Origin ,
236
- stop : Origin ,
237
227
errorClass : String ,
238
228
messageParameters : Map [String , String ],
239
229
queryContext : Array [QueryContext ]) =
240
230
this (
241
231
command,
242
232
SparkThrowableHelper .getMessage(errorClass, messageParameters),
243
233
start,
244
- stop,
245
234
Some (errorClass),
246
235
messageParameters,
247
236
queryContext)
@@ -282,7 +271,7 @@ class ParseException private (
282
271
} else {
283
272
(cl, messageParameters)
284
273
}
285
- new ParseException (Option (cmd), start, stop, newCl, params, queryContext)
274
+ new ParseException (Option (cmd), start, newCl, params, queryContext)
286
275
}
287
276
288
277
override def getQueryContext : Array [QueryContext ] = queryContext
0 commit comments